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_user_shortcode_filter__country', 'um_091223_user_shortcode_country' ); | |
function um_091223_user_shortcode_country( $value ) { | |
$current_logged_user_id = get_current_user_id(); | |
um_fetch_user( $current_logged_user_id ); | |
if( um_user('country') ) { | |
return $value; // returns the country of the current viewing profile when the current logged-in user's country is not empty | |
} |
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
/** | |
* Returns a user meta value | |
* Usage [um_user user_id="" meta_key="" ] // leave user_id empty if you want to retrive the current user's meta value. | |
* meta_key is the field name that you've set in the UM form builder | |
* You can modify the return meta_value with filter hook 'um_user_shortcode_filter__{$meta_key}' | |
*/ | |
function um_user_shortcode( $atts ) { | |
$atts = extract( shortcode_atts( array( | |
'user_id' => get_current_user_id(), | |
'meta_key' => '', |
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
/** | |
* Sample usage: [um_embed_profile user_id="123" form_id="3"] | |
*/ | |
add_shortcode("um_embed_profile","um_082321_embed_specific_profile"); | |
function um_082321_embed_specific_profile( $atts ){ | |
$atts = shortcode_atts( array( | |
'user_id' => get_current_user_id(), | |
'form_id' => 0, | |
), $atts ); |
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_user_avatar_url_filter",function( $url, $user_id, $data ){ | |
um_fetch_user( $user_id ); | |
$role = um_user("role"); | |
if( strpos( $url ,"gravatar") > -1 || strpos( $url ,"profile_photo") < -1 ){ | |
if( $role == 'subscriber' ){ | |
return "https://via.placeholder.com/150/0000FF/FFFFFF?text=Subscriber"; | |
}else if( $role == 'administrator' ){ | |
return "https://via.placeholder.com/150/FF0000/FFFFFF?text=Administrator"; | |
}else if( $role == 'bbp_spectator' ){ |
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 | |
/** | |
* Hides current user from search query in member directory | |
*/ | |
add_filter('um_prepare_user_query_args', 'um_remove_current_user_from_query', 10, 2); | |
function um_remove_current_user_from_query( $query_args, $args ){ | |
$query_args['exclude'] = array( get_current_user_id() ); | |
return $query_args; |
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(){ |