No Ads for Logged In Members - WP Plugin?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AAB
    Confirmed User
    • Apr 2009
    • 874

    #1

    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
    Consigliere
    • Feb 2003
    • 1771

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

    Comment

    • AAB
      Confirmed User
      • Apr 2009
      • 874

      #3
      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

      Comment

      • fris
        I have to go potty
        • Aug 2002
        • 55750

        #4
        Originally posted by AAB
        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.
        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


        Totally Free Templates

        Comment

        • just a punk
          So fuckin' bored
          • Jun 2003
          • 32385

          #5
          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?
          Obey the Cowgod

          Comment

          • AAB
            Confirmed User
            • Apr 2009
            • 874

            #6
            Let me give this a try, cyber :D

            UPDATE: Would it work if I pasted the code in the widgetized sidebar as "Text"?
            Last edited by AAB; 12-22-2011, 09:46 AM.

            Comment

            • AAB
              Confirmed User
              • Apr 2009
              • 874

              #7
              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.

              Comment

              • just a punk
                So fuckin' bored
                • Jun 2003
                • 32385

                #8
                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

                Comment

                • fris
                  I have to go potty
                  • Aug 2002
                  • 55750

                  #9
                  Originally posted by AAB
                  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');
                  Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                  Totally Free Templates

                  Comment

                  • fris
                    I have to go potty
                    • Aug 2002
                    • 55750

                    #10
                    Originally posted by AAB
                    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 );
                    }
                    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                    Totally Free Templates

                    Comment

                    • Stephen
                      Consigliere
                      • Feb 2003
                      • 1771

                      #11
                      Originally posted by cyberxxx
                      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"); } ?>

                      Comment

                      • AAB
                        Confirmed User
                        • Apr 2009
                        • 874

                        #12
                        Originally posted by cyberxxx
                        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.

                        Comment

                        Working...