Recent Topics

Hiding "views" from visitors

Started by on May 24, 2007 – Contents updated: May 24, 2007

May 24, 2007 02:28    

My b2evolution Version: 1.9.3

How would I makes the views that are displayed under post titles only viewable when your logged in? I don't think regular visitors need to see them but I would like to see it when I'm logged in to the site. I searched through the Misc. section of the code that was on the sidebar in the default skin to see how it displays its sections when your logged in as a user, but didn't find what made this happen.

TIA
Tom

http://hudsonvalley.bytheplate.com

May 24, 2007 02:45

Open your skins/yourskin/_main.php file and look through it a bit. Eventually you'll find something that looks like "$Item->views()", or at least very similar to that. Whatever the line actually is, you'll need to wrap it in a login check, like this:

Code

if( is_logged_in() ) {
* the line that displays the view count
}

Be a bit careful with your php stuff too. Use a "smart" editor like html-kit (and there are many others) so that you get color-coded syntax. It will help you see if your php tags are open or not. For example let me grab a quick piece of code with php open and closed and open again...

PHP

<div class="bSmallHead">
    <?php 
    locale_flag$Item->locale'h10px' );
    echo ' &nbsp;';
    $Item->issue_date('F jS, Y');
    echo ' by ';
    ?>
    <a href="<?php echo url_add_param$Blog->get'blogurl''htmlattr' ), 'author='$Item->get('creator_user_ID') ) ?>" title="<?php echo T_('Browse all posts by'?> <?php $Item->author() ?>"><?php $Item->author() ?></a>
    <?php 
    echo ' (';
    $Item->msgform_link$Blog->get('msgformurl') );
    echo ')';
    ?>
    </div>
 
<div class="bText">
    <?php 
    $Item->content();
    link_pages();
    ?>
    </div>

The "<php" line starts php stuff, and "?>" ends it, so anyway it shouldn't be that hard after you get a handle on which parts are php and which parts are html.


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.