• cyhpercase


    The option to add {user_avatar_small} to display the user profile-picture doesn’t want to work. There seems to be an issue with the class-shortcodes.php file

    The get_avatar() function seems to be working correctly, however this seems to be causing the issue: $str = preg_replace(‘/’.$pattern.’/’, $value , $str );

    My test profile username is “ICEMAN” and the custom menu name displays the following string text immediately to the left of the profile picture and username:

    So visual this being the menu display name (*picture* = actual picture image
    *username* = display_name):

    ICEMAN” HREF=”https://WWW.YATALT.COM/INDEX.PHP/USER/”> *picture* *username*

    So the main issue is that the username is being shown twice and the href is also showing. I only want to see the picture and the username. Can anyone please let me know how to fix this. I have feeling it might be a regex issue.

    • This topic was modified 3 years ago by cyhpercase.
    • This topic was modified 3 years ago by cyhpercase.
Viewing 6 replies - 1 through 6 (of 6 total)
  • abouet


    There is a slight malfunction with get_avatar(). When passing additionnal classes in $args, it is not included, no matter how you pass it (string or array). Whereas it works fine if you disable UM
    get_avatar(..., .., ..., ..., array('class' => 'rounded-circle mb-2'));
    result with UM
    <img class="gravatar avatar avatar-70 um-avatar um-avatar-uploaded" ...
    result without UM
    <img class="avatar avatar-70 photo rounded-circle mb-2" ...

    Thread Starter cyhpercase


    Thanks alot for the response! I tried replacing the following in class-shortcodes.php:
    if ( $usermeta == ‘user_avatar_small’ ) {
    $value = get_avatar( um_user(‘ID’),40);


    if ( $usermeta == ‘user_avatar_small’ ) {
    $value = get_avatar( um_user(’rounded-circle mb-2′),40);

    and it fixes the issue however the uploaded profile picture doesn’t show, it just shows a default grey ‘mystery man’ icon/avatar. Am I putting it in the wrong location?

    Plugin Support Ultimate Member Support


    Hi @cyhpercase,

    What version of the Ultimate member you have installed on your site?
    Please make sure to remove /index.php/ from the URL on your site.
    Set permalink structure to “postname” in Dashboard -> Settings -> Permalinks.

    Check this article on how to remove index.php from the URL and see if it helps.


    Thread Starter cyhpercase


    Hello, I am running version 2.0.25
    I tried setting permalinks to postname and removing index.php but that didn’t work either. I am using {user_avatar_small} {display_name} and in my front page menu I am still seeing the follwing ICEMAN”HREF=“https://www.yatalt.com/user”>*avatar picture*ICEMAN


    I am facing the exact same problem as the OP. The profile picture URL seems to be wrong, as no image is displayed. Besides, href is being treated like plain text instead of an a tag attribute.

    So what I see in my menu is:

    ” HREF=”/HOLISTICTRAINERS/USER/” CLASS=”NAV-LINK”> *default plugin avatar*

    Any suggestions?


    Okay, so I finally figured it out!

    For those encountering the same issue (including OP if he hasn’t solved it yet), here’s the trick:

    – I inspected the code carefully, and noticed there was a title attribute which was messing everything up. There was HTML code (actually the code from UM that allows the profile picture to display) inside the title tag, and it was unintentionally closing the menu “a” tag, causing the href attribute and everything after it to display on screen.

    – I tried to remove the closing characters “/>” in the plugin’s code, and although it worked, it was not perfect (it was adding unnecessary spaces, as the rendered image tag was not closed, if that makes sense).

    – Finally, I came up with the solution: to give the menu link a custom title. In the menu section in the WordPress Dashboard, where you add the menu items, you have to enable the title field by checking it in Screen Options > Show advanced menu properties > Title Attribute. Then, you write your title (in my case, I used “{first_name} {last_name} photo”, so the image title matched the user’s full name) and the problem is solved.

    After some weeks without success, I found this workaround. However, it would be nice if the plugin (which is awesome, by the way) prevented this issue beforehand, or at least mentioned it in the documentation.

    • This reply was modified 2 years, 10 months ago by deariinsanity.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘profile avatar/username in menu’ is closed to new replies.