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
/* | |
This code sample shows you how to use the API to create | |
and add custom notifications (for real-time notifications) | |
plugin. | |
STEP 1: You need to extend the filter: um_notifications_core_log_types with your | |
new notification type as follows for example | |
*/ |
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 | |
/** | |
* Imports files and images( except cover and profile photo ) | |
* @since UM 2.0 | |
* | |
* Sample Usage: | |
* - Fields should be created first in the UM Form Builder. | |
* - Files should be added to /wp-content/uploads/ultimatemember/<user_id>/ before running the import function. | |
* | |
* add_action('init', function(){ |
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
function um_020123_submit_form_errors_hook__exclude_blockedemails( $args ) { | |
$emails = UM()->options()->get( 'blocked_emails' ); | |
if ( ! $emails ) { | |
return; | |
} | |
$arr_excluded_emails = array( | |
"test1@gmail.com", | |
"test2@gmail.com", | |
); |
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); |
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); |
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; | |
} |
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>"; |
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 /* Template: Profile Tab */ ?> | |
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>"> | |
<div class="um-form"> | |
<?php | |
$edit = ( isset( $_GET['um_action'] ) && $_GET['um_action'] == 'edit' ); | |
if ( $edit && ! isset( UM()->user()->cannot_edit ) ) { | |
echo '<form method="post" action="">'; | |
} |
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 | |
add_filter('um_profile_tabs', 'pages_tab', 1000 ); | |
function pages_tab( $tabs ) { | |
$user_id = um_get_requested_user(); | |
// Show to profile owners only | |
if ( is_user_logged_in() && get_current_user_id() == $user_id ) { | |
$tabs['faves'] = array( | |
'name' => 'Faves', | |
'icon' => 'fa fa-star', |
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 | |
/** | |
* @um_user_after_updating_profile | |
*/ | |
function doggycom_redirect_after_updating_profile( $to_update ){ | |
exit( wp_redirect( remove_query_arg( array('profiletab','um_action') ) ) ); | |
} | |
add_action('um_user_after_updating_profile','doggycom_redirect_after_updating_profile',10,1); | |
?> |