Skip to:
Content
Pages
Categories
Search
Top
Bottom

Page elements viewable only by admin?

  • @edwinfoo

    Member

    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

Viewing 6 replies - 1 through 6 (of 6 total)
  • @gautam2011

    Member

    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…….

    @_ck_

    Participant

    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')) { ?>

    @gautam2011

    Member

    oh….

    @edwinfoo

    Member

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

    @chandersbs

    Member

    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.

    @johnhiler

    Member
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar