Support » Themes and Templates » Show div of content only if user is role 8 or higher

  • Hello,
    I want to know if it’s possible to make determinated content show only if the user of the post has and role higher then X.

    For example, make and div TEST in the single.php, if an “Author” post, it doesn’t show. If an “Administrator” post, it show.

    Is that possible?
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • hi
    check this.gud luk.hope this will work for you
    also this

    I tried this two ways, didn’ work:

    <?php
    global $userdata;
    get_currentuserinfo();
    if ( $user_info->ID == 1 )
    {
      echo 'User is an Author';
    }
    else
    {
      echo 'User is not an Author';
    }
    ?>

    and

    <?php
    $user = wp_get_current_user();
    if ($user->ID)
      if ( $user->ID == 1 )
        echo 'Admin';
      else
        echo 'Autor';
    ?>

    It only shows to first echo :/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show div of content only if user is role 8 or higher’ is closed to new replies.