PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

customizing what gets shown and how...

s2Member Plugin. A Membership plugin for WordPress®.

customizing what gets shown and how...

Postby godrob » September 5th, 2011, 2:46 pm

Hi guys,

I'm trying to hide a chat script from appearing on my buddypress site under certain conditions. The conditions are:

1) Only level 1 members and higher can see the chat script.
2) The chat script shouldn't appear on any of my payment pages.

So, I added the code below to my themes header.php file:

Code: Select all
<?php if(current_user_can("access_s2member_level1") OR (!is_page( array( 100, 1773, 1791, 1778, 1784 ) ) ) ) {
               
            echo '<link type="text/css" rel="stylesheet" id="arrowchat_css" media="all" href="/arrowchat/external.php?type=css" charset="utf-8" />';
       echo '<script type="text/javascript" src="/arrowchat/includes/js/jquery.js"></script>';
            echo '<script type="text/javascript" src="/arrowchat/includes/js/jquery-ui.js"></script>';
              
             }
            ?>


However the chat script still shows. But if I isolate the code to just one query ie, use just
current_user_can or !is_page they work fine independently, but combined together it doesn't work

What am I doing wrong?

Thanks
Rob.
User avatar
godrob
Registered User
Registered User
 
Posts: 33
Joined: August 26, 2011

Re: customizing what gets shown and how...

Postby Cristián Lávaque » September 6th, 2011, 10:20 pm

You should use AND instead of OR. Using OR, if the user can access level 1, the condition will be true in the first statement, if you use OR it'll be true only if he can access level 1 and it isn't one of those pages. If it's one of those pages, you don't want to show even if he can access level 1. See?

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron