Info
- 7 posts
- 5 voices
- Started 2 years ago by edwinfoo
- Latest reply from johnhiler
- This topic is resolved
Page elements viewable only by admin?
-
- Posted 2 years ago #
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.phpplugin 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.phpfile 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
-
- Posted 2 years ago #
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.......
-
- Posted 2 years ago #
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')) { ?> -
- Posted 2 years ago #
oh....
-
- Posted 2 years ago #
Thank you so much _ck_ & Gautam, it worked perfectly.
-
- Posted 2 years ago #
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.
-
- Posted 2 years ago #
Chandersbs - Try this?
http://bbpress.org/forums/topic/check-if-a-user-is-logged-in#post-19953 -
You must log in to post.