• Resolved Fabio

    (@fpuccinelli8)


    Hi Guys,

    I am creating a popup with dynamic information including the member’s first name.
    I would also like to include the member’s role. Is there a short tag for the user’s role or account type?

    Currently, this is what I have in the text editor:

    [um_loggedin]Hi, {first_name} start your {account_type} membership on the right foot.? Check your profile information and make any corrections by clicking the cog ? icon below. Upon completing your profile, please request to be verified.[/um_loggedin]

    We have five custom membership roles. I tried everything with no luck.

    Your help would be much appreciated,

    Kind regards,
    Fabio

    • This topic was modified 3 years, 4 months ago by Fabio.
    • This topic was modified 3 years, 4 months ago by Fabio.
    • This topic was modified 3 years, 4 months ago by Fabio.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Fabio

    (@fpuccinelli8)

    Sorry to have wasted your time.
    I found the short tag.

    {usermeta:role_select}

    Again, thanks for a great plugin, and looking forward to your third version.

    Fabio

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @fpuccinelli8

    You can try the basic extension “User Meta Shortcode” in the link: https://github.com/ultimatemember/Extended#installation

    Once you’ve installed the extension, you can display the first name like this [um_user meta_key="first_name" ] and to retrieve the User Role, you need to add the following PHP code snippet to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.

    add_filter("um_user_shortcode_filter__user_role", "um_111821_user_role_shortcode" ); function um_111821_user_role_shortcode( $meta_value ){
         if( ! class_exists("UM") ) return;
         $role = um_user("role");
         return UM()->roles()->get_role_name( $role );
    }

    Once the above code is added to your site, you can now use this shortcode to display the user role: [um_user meta_key="user_role" ]

    Regards,

    Thread Starter Fabio

    (@fpuccinelli8)

    Hi Champ Camba,

    Sorry for the delay in my reply. Thank you for the code.

    Please close this support request.

    Kind regards,
    Fab

    Thread Starter Fabio

    (@fpuccinelli8)

    I’ve closed this request.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Short Tag for Members role’ is closed to new replies.