Skip to content

Instantly share code, notes, and snippets.

View wp-user-manager's full-sized avatar

wp-user-manager

View GitHub Profile
@wp-user-manager
wp-user-manager / wpum_privacy_text.php
Created September 15, 2021 10:37
WP User Manager - Alter the privacy checkbox text
<?php
add_filter( 'wpum_privacy_text', 'wpum_change_message', 10, 3 );
function wpum_change_message( $text, $privacy_url, $blogname ) {
return sprintf( __( 'I have read and accept the <a href="%1$s" target="_blank">privacy policy</a> and allow %2$s to collect and store the data I submit through this form.', 'wp-user-manager' ), $privacy_url, $blogname );
}
@wp-user-manager
wp-user-manager / wpum_conditional_account_tabs_based_on_role.php
Last active September 9, 2021 09:25
WP User Manager - Change account tabs based on role
<?php
function wpum_account_remove_tab( $tabs ) {
$user = wp_get_current_user();
if ( in_array( 'affiliate', (array) $user->roles ) ) {
unset( $tabs['subscriptions'] );
}
return $tabs;
}
@wp-user-manager
wp-user-manager / wpum_login_form_register_link.php
Created September 7, 2021 17:29
WP User Manager - Alter the signup link on the login form
@wp-user-manager
wp-user-manager / wpum_conditional_role_based_on_field.php
Created September 1, 2021 09:45
WP User Manager - Conditional user role at registration based on a custom field
<?php
add_action( 'wpum_after_registration', 'wpum_conditional_role', 20, 2 );
function wpum_conditional_role( $user_id, $values ) {
$field_key = 'wpum_field_14'; // Change this to your field key
if ( ! isset( $values['register'][ $field_key ] ) ) {
return;
}
@wp-user-manager
wp-user-manager / wpum_remove_cover_image.php
Created August 21, 2021 18:59
WP User Manager - Remove user profile cover image
<?php
add_filter( 'wpum_profile_display_cover_image', '__return_false' );
@wp-user-manager
wp-user-manager / wpum_remove_honeypot.php
Created August 21, 2021 07:31
WP User Manager - Remove the honeypot from the Registration Form
<?php
add_filter( 'wpum_get_registration_fields', function ( $fields ) {
unset( $fields['robo'] );
return $fields;
} );
<?php
add_action( 'admin_init', function () {
remove_submenu_page( 'options-general.php' ,'wpum-licenses' );
}, 100 );
@wp-user-manager
wp-user-manager / wpum_edit_account_label.php
Created June 25, 2021 09:37
WP User Manager - Change the 'Edit account' text on the profile page
<?php
add_filter( 'gettext_wp-user-manager', function ( $text ) {
if ( $text == '( Edit account )' ) {
return '( Edit profile )';
}
return $text;
} );
@wp-user-manager
wp-user-manager / wpum_mailchimp_conditional_list_from_field_value.php
Created June 21, 2021 20:18
WP User Manager - Mailchimp conditionally list signup based on another field value
<?php
add_action( 'wpum_after_registration', 'wpum_mailchimp_conditional_subscribe', 20, 2 );
function wpum_mailchimp_conditional_subscribe( $user_id, $values ) {
$api_key = carbon_get_theme_option( 'mailchimp_api_key' );
if ( empty( $api_key ) ) {
return;
}
@wp-user-manager
wp-user-manager / wpum_page_body_class.php
Created June 4, 2021 09:25
WP User Manager - Add classes to the body element for WPUM pages
<?php
add_filter( 'body_class', function ( $classes ) {
$wpum_pages = array(
'login_page',
'password_recovery_page',
'registration_page',
'account_page',
'profile_page',