Forums

[resolved] Content available only to specified users (4 posts)

  1. daniel851
    Member
    Posted 3 years ago #

    Hello everyone,

    I am trying to make certain content visible to staff members only. This is what I have so far:

    <?php if ($current_user->ID == 1){ ?>
    <!--this is what I want only certain users to see-->
    <?php } ?>

    This works great if I want this information visible only to the admin. However, we have more than one staff member. Is there a way I can enter multiple user IDs? Or is there perhaps an ever better way to manipulate the code?

    Thanks.

  2. MichaelH
    Member
    Posted 3 years ago #

  3. daniel851
    Member
    Posted 3 years ago #

    These plugins are all great for specific pages and posts. However, I just have a bit of information (admin links etc.) in sidebar.php that I would like to make visible only specific users.

  4. MichaelH
    Member
    Posted 3 years ago #

    I guess then the PHP OR operator is what you want:

    <?php if ( $current_user->ID == 1 || $current_user->ID == 2 ){ ?>

Topic Closed

This topic has been closed to new replies.

About this Topic