Forums

howto check user level or role (3 posts)

  1. cookie_dude
    Member
    Posted 4 years ago #

    In comments i want to check if the user is contributer or subscriber, if he's contributer i want to display a image with the name.

    i tried lots of stuff in comment just before <?php comment_author_link(); ?> and they don't seem to work.

    can anyone help, Last i tried was something like

    if ( current_user_can('level_1')) {
    echo "show image"; }
    else
    {
    echo "no image"; }
  2. moshu
    Member
    Posted 4 years ago #

  3. cookie_dude
    Member
    Posted 4 years ago #

    i tried, does'nt seem to work. For comment author would it be like

    <?php
    global $comment ;
    comment_author() ;
    if ( $comment->user_level == 1 )
    {
    echo 'User is an Author';
    }
    else
    {
    echo 'User is not an Author';
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic