Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
12-22-2011, 07:26 AM | #1 |
Confirmed User
Join Date: Apr 2009
Location: Alberta
Posts: 874
|
No Ads for Logged In Members - WP Plugin?
Donncha's "No Ad for Friends" was last updated in 2007 and doesn't work. Does anybody know of a plugin that would block display of ads for logged in members?
|
12-22-2011, 07:38 AM | #2 |
Consigliere
Industry Role:
Join Date: Feb 2003
Posts: 1,771
|
I avoid 3rd party plugins. You can use cookies and conditionals to do what you want.
|
12-22-2011, 07:47 AM | #3 |
Confirmed User
Join Date: Apr 2009
Location: Alberta
Posts: 874
|
Sadly, plugins are a feasible alternative for webmasters who are not programmers. I can imagine this may not be a big deal for someone good with PHP, but that ain't me
|
12-22-2011, 10:21 AM | #4 | |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 54,868
|
Quote:
prob just a single function to add to only show ads for non members.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. WP Tube Themes |
|
12-22-2011, 11:34 AM | #5 |
So fuckin' bored
Industry Role:
Join Date: Jun 2003
Posts: 32,376
|
This code will do the trick (insert it right into your WP theme):
Code:
<?php if (!is_user_logged_in()) { echo "your annoying ad is here"; } ?>
__________________
Obey the Cowgod |
12-22-2011, 11:45 AM | #6 |
Confirmed User
Join Date: Apr 2009
Location: Alberta
Posts: 874
|
Let me give this a try, cyber :D
UPDATE: Would it work if I pasted the code in the widgetized sidebar as "Text"? |
12-22-2011, 11:58 AM | #7 |
Confirmed User
Join Date: Apr 2009
Location: Alberta
Posts: 874
|
What would be the trick to make it work with widgets? When I use the code in a "Text" widget, it shows nothing when I log out, but displays ;}?> when I log in.
|
12-22-2011, 12:03 PM | #8 |
So fuckin' bored
Industry Role:
Join Date: Jun 2003
Posts: 32,376
|
If you don't want to make it managed as a widget, you can use it as is. Just insert the mentioned above code into your sidebar.php.
P.S. Fuck and replace your avatar with something neutral according to the GFY rules.
__________________
Obey the Cowgod |
12-22-2011, 01:18 PM | #9 | |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 54,868
|
Quote:
http://adrotateplugin.com/page/features.php and if you wanted to disable the ads for logged in users. Code:
function adrotate_shortcode_strip() { if (!is_user_logged_in()) { remove_shortcode('adrotate'); } } add_filter('the_content', 'adrotate_shortcode_strip');
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. WP Tube Themes |
|
12-23-2011, 12:17 PM | #10 | |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 54,868
|
Quote:
Code:
add_filter( 'widget_text', 'non_members' ); function non_members($content = null ) { /* If the user is logged in, return nothing. */ if ( is_user_logged_in() || is_null( $content ) ) return ''; /* Return the content. */ return do_shortcode( $content ); }
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. WP Tube Themes |
|
12-23-2011, 12:50 PM | #11 | |
Consigliere
Industry Role:
Join Date: Feb 2003
Posts: 1,771
|
Quote:
Code:
<?php if (isset($_COOKIE['Members'])) { include("members.php"); } ?> |
|
12-25-2011, 08:17 AM | #12 |
Confirmed User
Join Date: Apr 2009
Location: Alberta
Posts: 874
|
The double quotes seem to make this code unusable. Because every ad code will contain double quotes somewhere within it, it will break the echo which is exactly what happened when I tried it.
|