latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Hiding ads using Shortcode / PHP conditionals

Home Forums Community Forum Hiding ads using Shortcode / PHP conditionals

This topic contains 4 replies, has 2 voices. Last updated by  Mark Warner 3 years ago.

Topic Author Topic
Posted: Wednesday Nov 27th, 2013 at 3:41 pm #61442

Hi

I’ve been using S2Member on an existing site for six months and it has changed my life. THANK YOU!

I am thinking about using it on a new site, so before I upgrade my licence to ‘Unlimited Sites’, I was hoping that someone could confirm something.

If I want to hide ads from members, I know that I can use Shortcode / PHP conditionals. I’m currently using these to hide other content on my current site, but I wanted to check… if I’m using conditionals to hide ads from logged-in members, the ad script is never executed, is it? That would obviously be against the terms of service of the ad companies as the script would be executed but the ad wouldn’t be displayed to visitors.

Apologies for my ignorance, but am I correct?

Thanks!

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Thursday Nov 28th, 2013 at 12:07 pm #61467
Moderator
@markwarner

If I want to hide ads from members, I know that I can use Shortcode / PHP conditionals. I’m currently using these to hide other content on my current site, but I wanted to check… if I’m using conditionals to hide ads from logged-in members, the ad script is never executed, is it? That would obviously be against the terms of service of the ad companies as the script would be executed but the ad wouldn’t be displayed to visitors.

This is correct, it would be completely excluded :-)

Posted: Thursday Nov 28th, 2013 at 2:37 pm #61475

Fantastic… thanks for your response.

Time to upgrade!

Posted: Wednesday Dec 11th, 2013 at 3:07 pm #61823

Just to follow up on this… is it possible to use these conditionals outside of the post / page content and widget areas?

I’ve tried inserting this code…

<?php if(is_user_logged_in()){ ?>
    Content for anyone that is logged in, regardless of their Membership Level.
<?php } else { ?>
    Some public content.
<?php } ?>

… inside a ‘hook’ area (provided by my site’s theme) at the top of every page. But it’s not working… it’s just showing both types of content.

Thanks!

  • This reply was modified 3 years ago by  Mark Warner.
Posted: Friday Dec 13th, 2013 at 12:53 pm #61913

Managed to fix this… the PHP wasn’t executing when inserted via the theme’s hook, but inserting it directly into the theme’s code worked OK.

Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.