This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'um_submit_form_errors_hook__registration', 'um_custom_validate_username', 99 ); | |
| function um_custom_validate_username( $args ) { | |
| static $domain = '.in, .ru'; | |
| if ( isset( $args['user_email'] ) ) { | |
| if ( str_ends_with( $args['user_email'], '.in' ) || str_ends_with( $args['user_email'], '.ru' )) { | |
| $message = sprintf( __( 'Cant use email domain %1$s for registration', 'ultimate-member' ), $domain ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Code snippet of Plugin Ultimate Member | |
| URL: https://wordpress.org/plugins/ultimate-member/ | |
| */ | |
| // Display field data of Ultimate Member | |
| // e.g. [um_field_data userid='24'] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Display UM Country Column Label | |
| function um_add_meta_user_table( $column ) { | |
| $column['country'] = 'Country'; | |
| return $column; | |
| } | |
| add_filter( 'manage_users_columns', 'um_add_meta_user_table' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'um_after_member_role_upgrade', 'my_um_after_member_role_upgrade', 10, 3 ); | |
| function my_um_after_member_role_upgrade( $hook_roles, $old_roles, $user_id ){ | |
| $user = get_userdata( $user_id ); | |
| UM()->mail()->send( $user->user_email, 'welcome_email' ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('um_profile_menu', 'um_profile_content_posts_custom_cat'); | |
| function um_profile_content_posts_custom_cat(){ | |
| $active_tab = UM()->profile()->active_tab(); | |
| if ($active_tab == 'posts') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Ultimate member - Make all UM User Profile Private by Default. | |
| * URL: https://wordpress.org/plugins/ultimate-member/ | |
| */ | |
| add_filter( 'get_user_metadata', function( $profile_privacy, $object_id, $meta_key ) { | |
| if( $meta_key === 'profile_privacy' ) { | |
| $profile_privacy = 'Only me'; | |
| } | |
| return $profile_privacy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Ultimate member - Restrict registration based on email domain. | |
| * URL: https://wordpress.org/support/topic/email-domain-restriction-at-registration/ | |
| */ | |
| add_action( 'um_submit_form_errors_hook__registration', 'um_register_email_provider_restrict', 99 ); | |
| function um_register_email_provider_restrict( $args ) { | |
| // List the email providers you want to allow | |
| $allowed_domains = array('@gmail.com', '@hey.com'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Display custom field image url in Member Directory | |
| * URL: https://wordpress.org/support/topic/get-uloaded-image-url/ | |
| */ | |
| add_action( 'um_members_just_after_name', 'custom_function_tester_dir' ); | |
| function custom_function_tester_dir(){ | |
| // Get the filename | |
| $image_filename = um_user( 'national_id' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * title & label Gender to Gender Identity | |
| * see: https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-builtin.php#L832 | |
| * | |
| * @param 'title', 'metakey', 'type', 'label', 'required', 'public', 'editable', 'options' | |
| * | |
| * @return array | |
| */ | |
| add_filter( 'um_core_fields_hook', 'um_custom_modify_text', 10, 1 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'manage_users_columns', 'um_custom_add_new_user_column' ); | |
| function um_custom_add_new_user_column( $columns ) { | |
| $columns['um_country'] = 'Country'; | |
| return $columns; | |
| } | |
| add_filter( 'manage_users_custom_column', 'um_custom_add_new_user_column_content', 10, 3 ); | |