Add inline label styling

/** * Add inline label and button styling to Paid Memberships Pro checkout page. */ function my_load_inline_labels_checkout() { global $pmpro_pages; if ( ! is_page( $pmpro_pages[‘checkout’] ) ) { return; } ?>Continue reading

Disable administrator role checkbox

function disable_administrator_role_checkbox() { $current_user = wp_get_current_user(); $current_user_roles = (array) $current_user->roles; // Check if the current user is an administrator if (in_array(‘administrator’, $current_user_roles)) { ?>Continue reading

Add custom submenu page for restricted name change users

// Add custom submenu page for restricted name change users function add_restricted_name_change_users_submenu_page() { add_submenu_page( ‘users.php’, // parent slug __(‘Restricted Name Change Users’), // page title __(‘Restricted Name Change Users’), // menu title ‘manage_options’, // capability ‘restricted_name_change_users’, // menu slug ‘display_restricted_name_change_users’…Continue reading

Remove color scheme options

function remove_color_scheme_options() { remove_action(‘admin_color_scheme_picker’, ‘admin_color_scheme_picker’); } add_action(‘admin_init’, ‘remove_color_scheme_options’);Continue reading

Remove old roles on membership upgrade

add_action( ‘pmpro_after_change_membership_level’, ‘remove_old_roles_on_membership_upgrade’, 10, 2 ); function remove_old_roles_on_membership_upgrade( $level_id, $user_id ) { // Get the user’s current roles $user = new WP_User( $user_id ); $current_roles = $user->roles; // Define your membership level to role mapping $membership_roles = array( ‘1’ =>…Continue reading

Hide SEO tab link

if ( ! is_admin() || ! function_exists( ‘get_current_screen’ ) ) return; $current_screen = get_current_screen(); if ( $current_screen && ‘profile’ === $current_screen->id ) { // Your code here } add_filter( “aioseo_user_profile_tab_disable”, “__return_true” );Continue reading

Add Membership end column in user list

function modify_user_list_columns($columns) { if (!current_user_can(‘edit_users’)) { return $columns; } // Add our custom column right after the ‘pmpro_membership_level’ column. $new_columns = array(); $add_after = ‘pmpro_membership_level’; // Adjust if necessary. foreach ($columns as $key => $value) { $new_columns[$key] = $value; if…Continue reading

capture_user_registration_details

add_action(‘user_register’, ‘capture_user_registration_details’, 10, 1); function capture_user_registration_details($user_id) { $user_info = get_userdata($user_id); // Capture and store registration details $details = [ ‘First name’ => $user_info->first_name, ‘Last name’ => $user_info->last_name, ‘Email’ => $user_info->user_email, ]; // Store details in a transient, expire after 1…Continue reading

Admin Editable Usernames

// Register the form field and save action only if the Code Snippets plugin is active if (function_exists(‘add_action’)) { // Show the new username field on the user profile page for admins add_action(‘edit_user_profile’, ‘custom_admin_edit_username_field’); // Save the new username if…Continue reading