GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   No Ads for Logged In Members - WP Plugin? (https://gfy.com/showthread.php?t=1050923)

AAB 12-22-2011 07:26 AM

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?

Stephen 12-22-2011 07:38 AM

I avoid 3rd party plugins. You can use cookies and conditionals to do what you want.

AAB 12-22-2011 07:47 AM

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 :(

fris 12-22-2011 10:21 AM

Quote:

Originally Posted by AAB (Post 18646528)
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 :(

wouldnt be hard to do, adrotate is a good plugin.

prob just a single function to add to only show ads for non members.

just a punk 12-22-2011 11:34 AM

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";
}
?>

Or do you want it made as a widget or so?

AAB 12-22-2011 11:45 AM

Let me give this a try, cyber :D

UPDATE: Would it work if I pasted the code in the widgetized sidebar as "Text"?

AAB 12-22-2011 11:58 AM

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.

just a punk 12-22-2011 12:03 PM

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.

fris 12-22-2011 01:18 PM

Quote:

Originally Posted by AAB (Post 18646490)
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?

adrotate is a good plugin

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');


fris 12-23-2011 12:17 PM

Quote:

Originally Posted by AAB (Post 18646490)
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?

actually if you are using a text widget, you could run a filter on the widget to only show it to non members.

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 );
}


Stephen 12-23-2011 12:50 PM

Quote:

Originally Posted by cyberxxx (Post 18646964)
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";
}
?>

Or do you want it made as a widget or so?

That works well with the WP login system, but I like to use straight .htaccess (CCBill) with a similar check for a "members" cookie:

Code:

<?php if (isset($_COOKIE['Members'])) { include("members.php"); } ?>

AAB 12-25-2011 08:17 AM

Quote:

Originally Posted by cyberxxx (Post 18646964)
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";
}
?>

Or do you want it made as a widget or so?

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.


All times are GMT -7. The time now is 07:35 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc