Forums

Join
bbPress Support ForumsTroubleshootingPage elements viewable only by admin?

Info

Page elements viewable only by admin?

  1. Hello,

    I was wondering if someone can point me in the right direction. Though I am a webmaster, marketing is my forte and cutting code is quite foreign to me but I get by.

    Have the members_online.php plugin installed and though I like to see who's been online today, I don't want potential advertisers seeing that information or indeed forum members as it can provide a distorted view of site traffic stats.

    Here is the snippet of code from the front-page.php file which generates the summary on the forum front page.

    <div id="useronline">
    <h3><?php _e('ONLINE TODAY'); ?></h3>
    <p><?php do_action('members_online_today',''); ?></p>
    </div>

    Can someone please tell me what to do to make that output visible only to admins?

    Thank you in advance

  2. Use this:

    <?php if(bb_is_admin()){ ?>
    <div id="useronline">
    <h3><?php _e('ONLINE TODAY'); ?></h3>
    <p><?php do_action('members_online_today',''); ?></p>
    </div>
    <?php } ?>

    This should work.......

  3. No, no no, bb_is_admin is to detect if you are in the admin control panel

    First line should be

    <?php if (bb_current_user_can('administrate')) { ?>

  4. oh....

  5. Thank you so much _ck_ & Gautam, it worked perfectly.

  6. I'm also searching for something similar to hide all links for visitors who are not logged in. I have a download section, and that has topics, with new downloads. Want to hide the links for guests.

  7. Chandersbs - Try this?
    http://bbpress.org/forums/topic/check-if-a-user-is-logged-in#post-19953

  8. You must log in to post.