Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of hnla

If displayed_user_can then …. (4 posts)

Started 1 year, 5 months ago by: jimhellas

  • Profile picture of jimhellas jimhellas said 1 year, 5 months ago:

    I want to show a special icon next to admins and premium members names in their profile (preferably in the activity stream as well). Is there a function that checks if something is true about the displayed user, as the current_user_can function does?

    e.g, I want something that does something similar to this, but it takes into account the displayed user:
    <?php if(current_user_can(‘level_1′)) : ?>PREMIUM MEMBER<?php endif; ?>

    Thanks!

  • Profile picture of pcwriter pcwriter said 1 year, 5 months ago:

    Check out the codex here for a full list of all functions (great stuff!):

    http://codex.wordpress.org/Function_Reference

  • Profile picture of Travel-Junkie Travel-Junkie said 1 year, 5 months ago:

    well, you could check against usermeta for example:

    global $bp;
    $meta = get_usermeta( $bp->displayed_user->id, 'member_status' );
    if( $meta == 'premium' )
    {
        //do stuff, like showing a badge
    }
    else
    {
        //show something else or do nothing
    }

    doing something like this in a loop will add a lot of database calls though. also in a loop you won’t be able to use $bp->displayed_user->id.

    you could also check against profile field data.

  • Profile picture of jimhellas jimhellas said 1 year, 5 months ago:

    Thanks for the ideas.

    I’ll try to check against some usermeta (not for the loop though…). I guess it will work for the profile pages :)