View Ultimate Member - Reorder languages filter in Member Directory
This file contains 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
add_filter("um_member_directory_filter_select_options_sorted","um_011723_sort_languages",10,2); | |
function um_011723_sort_languages( $options, $atts ){ | |
if( "languages" == $atts['metakey'] ){ | |
$key = 'en'; | |
$value = $options[$key]; | |
unset($options[$key]); | |
array_unshift($options, $value); |
View Ultimate Member - Support WebP in the Image Uploader
This file contains 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 | |
// Cover & Profile Photo | |
add_filter("um_get_field__cover_photo","um_010223_allowed_webp_image_type", 10, 1 ); | |
add_filter("um_get_field__profile_photo","um_010223_allowed_webp_image_type", 10, 1 ); | |
function um_010223_allowed_webp_image_type( $data ){ | |
$arr = explode( ",", $data['allowed_types'] ); | |
$arr[ ] = "webp"; | |
$data['allowed_types'] = implode(",", $arr); |
View Ultimate Member - Restrict Login form for specific role
This file contains 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
add_action( 'um_submit_form_errors_hook_login', 'um_071621_login_for_specific_role', 10 ); | |
function um_071621_login_for_specific_role( $args ){ | |
if ( isset( $args['username'] ) && $args['username'] == '' ) { | |
return; | |
} | |
if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) { | |
return; | |
} |
View Ultimate Member - Upcoming Birthday future age as tag line in the Member Directory
This file contains 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
add_filter("um_ajax_get_members_data","um_061522_future_age_birthdays", 10, 3 ); | |
function um_061522_future_age_birthdays( $data_array, $user_id, $directory_data ){ | |
$directory_id = $directory_data['form_id']; | |
if( 325 !== $directory_id ) return $data_array; | |
um_fetch_user( $user_id ); | |
$hours_in_day = 24; |
View gist:cf6e0bfbaa2691eabda172d7d67a6ff7
This file contains 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
add_action('um_user_before_query','um_061522_show_upcoming_birthdays', 10, 2); | |
function um_061522_show_upcoming_birthdays( $query_args, $obj ){ | |
$directory_id = $obj->get_directory_by_hash( sanitize_key( $_POST['directory_id'] ) ); | |
if( 325 !== $directory_id ) return $query_args; | |
add_action( 'pre_user_query', function( $uqi ) { | |
global $wpdb; | |
View gist:2f68b8cf74f5c83244ab3d2e1184c6f9
This file contains 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
add_filter("um_prepare_user_query_args","um_061522_show_todays_birthdays", 10, 2 ); | |
function um_061522_show_todays_birthdays( $query_args, $directory_data ){ | |
$directory_id = $directory_data['form_id']; | |
if( 320 !== $directory_id ) return $query_args; | |
$query_args['meta_query'][ ] = array( | |
'key' => 'birth_date', | |
'value' => date("/m/d"), |
View Ultimate Member - Make mobile number as username
This file contains 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
add_action("um_submit_form_register","um_090321_mobile_number_validation"); | |
function um_090321_mobile_number_validation( $post_form ){ | |
if( isset( $post_form['mobile_number'] ) && ! empty( $post_form['mobile_number'] ) ){ | |
global $wpdb; | |
$wpdb->get_results( $wpdb->prepare("SELECT * FROM {$wpdb->usermeta} WHERE meta_key = 'mobile_number' AND meta_value = %s", $post_form['mobile_number'] ) ); | |
if( $wpdb->num_rows > 0 ) { | |
UM()->form()->add_error('mobile_number', __( 'Mobile Number already registered', 'ultimate-member' ) ); | |
} |
View Ultimate Member - Display Mp3 player in Member Directory Profile Cards
This file contains 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
add_filter("um_ajax_get_members_data","um_012122_display_audio_member_directory_data", 10, 3 ); | |
function um_012122_display_audio_member_directory_data( $data_array, $user_id, $directory_data ){ | |
if( um_profile( 'mp3' ) ){ | |
$mp3_url = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . um_profile( 'mp3' ); | |
$data_array['audio_embed'] = " | |
<audio controls style='width: 90%;margin:auto;'> | |
<source src='{$mp3_url}' type='audio/mpeg'> | |
Your browser does not support the audio element. | |
</audio>"; |
View Ultimate Member - Make UM Files Field including cover and profile photos syncronized
This file contains 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
add_filter("upload_dir", function( $upload ){ | |
if( ( isset( $_REQUEST['action'] ) && ( "um_resize_image" == $_REQUEST['action'] || "um_imageupload" == $_REQUEST['action'] ) ) || isset( $_REQUEST['um_action'] ) ){ | |
$upload['basedir'] = str_replace( "/sites/2", "", $upload['basedir'] ); | |
$upload['baseurl'] = str_replace( "/sites/2", "", $upload['baseurl'] ); | |
} | |
return $upload; | |
}); | |
NewerOlder