Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save champsupertramp/b83e3b4c57e089f36184b095a99671dd to your computer and use it in GitHub Desktop.
Save champsupertramp/b83e3b4c57e089f36184b095a99671dd to your computer and use it in GitHub Desktop.
Ultimate Member - Add custom menu shortcode/short tags
<?php
/**
* Subscribe to my newsletter: www.champ.ninja
*/
​add_filter("um_allowed_user_tags_patterns","um_custom_tags_patterns");
​function um_custom_tags_patterns( $patterns ){
​ $patterns = "{user_avatar_large}";
​ return $patterns;
​}
​add_filter("um_profile_tag_hook__user_avatar_large","um_custom_tags_pattern_value");
​function um_custom_tags_pattern_value( $value, $user_id ){
​ um_fetch_user( $user_id );
if ( $profile_photo = um_profile( 'profile_photo' ) ) {
$profile_photo_url = um_get_avatar_uri($profile_photo, 40 );
return '<img src="{$profile_photo_url}''/>';
}
​ return $value;
​}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment