1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WP plugin to autmate PHPBay on autoblogs 4 BHW

Discussion in 'Blogging' started by scb335, Apr 22, 2009.

  1. scb335

    scb335 BANNED BANNED

    Joined:
    Mar 5, 2008
    Messages:
    272
    Likes Received:
    438
    I wasn't sure if this should go in Downloads or Blogging, hope I picked right since it's not really a download, just a share for the community.

    Anyway, I threw this together earlier for a member in another thread here and thought it might be useful to others who run auto-blogs and have PHPBay on them.

    What this plugin does is use the tags of your auto-blog posts to automatically add related phpbay code to the end of each posting.

    Step #1
    Create a file in your wp-content/plugins folder named addPHPBay.php and paste the following code into it:
    Code:
    <?php
    /*
    Plugin Name: addPHPBay
    Plugin URI: http://www.yourdomain.com
    Description: Plugin to add PHPBay code to end of posts based on post tags
    Version: 0.1
    Author: scb335
    Author URI: http://www.yourdomain.com/
    */
    
    function filter_addPBay($content) {
    $toAdd = '[phpbay]';
    $posttags = get_the_tags();
       if ($posttags) {
          foreach($posttags as $tag) {
             $toAdd .= $tag->name.' '; 
          }
          $toAdd  .= ', 10, "", ""[/phpbay]';
          $content = $content.$toAdd;
       }
       return $content;
    }
    
    add_filter('the_content','filter_addPBay');
    ?>
    Step #2
    Login to your WP admin dashboard and activate the plugin.

    That's it.

    What it will do is get each of the tags from your post when the post is displayed on someone's screen and add the following code to the end of the post output:
    Code:
    [phpbay]tag tag tag , 10, "", ""[/phpbay]
    where each "tag" is a tag used in the posting. Then your PHPBay plugin will use that line of code from the posting to display the appropriate products and so on.

    If your post doesn't have any tags then the plugin will just display the post normally without the PHPBay code line added on.

    Feel free to use this however you want, tweak it as needed or desired and even resell it as your own to suckers over at DP and WF if you want.

    Hope it's useful to some of you.
     
    • Thanks Thanks x 25
  2. MiLiTARYiV

    MiLiTARYiV Senior Member

    Joined:
    Jan 9, 2008
    Messages:
    959
    Likes Received:
    595
    Occupation:
    Webmaster
    Location:
    The Office
    Work out good. much props
     
    Last edited: Apr 30, 2009
  3. scb335

    scb335 BANNED BANNED

    Joined:
    Mar 5, 2008
    Messages:
    272
    Likes Received:
    438
    Happy to contribute something to the community here.
     
  4. huggybear_dk

    huggybear_dk Registered Member

    Joined:
    Dec 11, 2008
    Messages:
    51
    Likes Received:
    9
    Location:
    on the cusp of making money..
    Nice, thanks for that. i am pretty crap at any sort of coding. So if I wanted to do the same but use the title of the post to create the entry would I change the $posttags - get_the_title

    D
     
  5. Syowred

    Syowred BANNED BANNED

    Joined:
    Jun 9, 2008
    Messages:
    53
    Likes Received:
    15
    Sweet lil bit of code. thanks for sharing it
     
  6. dhamma_man

    dhamma_man Junior Member

    Joined:
    Feb 9, 2008
    Messages:
    128
    Likes Received:
    613
    Occupation:
    Retired
    Location:
    Northern California
    Hi, scb335!

    Thanks for the code! Everything helps! "Thanks" and +rep given. Keep up the great work!

    Cheers! :)
     
  7. scb335

    scb335 BANNED BANNED

    Joined:
    Mar 5, 2008
    Messages:
    272
    Likes Received:
    438
    huggybear_dk, I don't think that would work with this plugin as it is because of what content is being passed to the filter for reading. I'll play with it tomorrow and see if I can find a quick fix to do what you want though.
     
  8. digitalcrew

    digitalcrew Regular Member

    Joined:
    Jan 2, 2009
    Messages:
    330
    Likes Received:
    43
    Location:
    India!
    Smart code ! now just need to find feeds of all major product review sites.
     
  9. MichiganManiac

    MichiganManiac Regular Member

    Joined:
    Feb 2, 2009
    Messages:
    204
    Likes Received:
    168
    Great snipet. I was wondering how to do this myself...but you answered the question before I even asked it. How cool is that?
     
  10. ztws

    ztws Newbie

    Joined:
    Jan 13, 2009
    Messages:
    26
    Likes Received:
    13
    I think something similar can be done with Bayrss. I'll play around with it and see. I don't have phpBay yet.
     
  11. scb335

    scb335 BANNED BANNED

    Joined:
    Mar 5, 2008
    Messages:
    272
    Likes Received:
    438
    huggybear_dk, I've tried but I'm afraid I don't see a way to grab the title like you want without writing a whole new plugin for it.

    The problem really is that this plugin only has the body of the post content to extract data from, that's everything after the title and before the comments box on a post page.

    Sorry I couldn't do more with it for you.
     
    • Thanks Thanks x 1
  12. stmadeveloper

    stmadeveloper Registered Member

    Joined:
    Nov 27, 2007
    Messages:
    53
    Likes Received:
    13
    You CAN do this - but then you have to manipulate the title to strip out all the extra words. Ebay doesn't return crap with full length post titles :) --
     
  13. magicalwonders

    magicalwonders Newbie

    Joined:
    Mar 19, 2009
    Messages:
    1
    Likes Received:
    0
    Thanks for the script, it looks good. Just one question. I notice that the scripts for plugins I've used so far, reside in their own folder. Will this plugin work if I put it in its own folder?
     
  14. funktrust

    funktrust Regular Member

    Joined:
    Apr 3, 2009
    Messages:
    208
    Likes Received:
    54
    Occupation:
    Cisco Engineer
    Location:
    Sydney
    This is really handy good work mate :)
     
  15. blackhatjohn

    blackhatjohn Regular Member

    Joined:
    Feb 25, 2009
    Messages:
    396
    Likes Received:
    367
    Anyone please give some guide on how to use this script? Do i need to fill in some detail inside the script and where should i add my epn account?
     
  16. TotalNewbie

    TotalNewbie Newbie

    Joined:
    Mar 10, 2008
    Messages:
    31
    Likes Received:
    0
    I am looking forward to trying this out. I want to automate the process for PHPbay and posting new content, this might be the trick.
     
  17. Rob the Builder

    Rob the Builder Regular Member

    Joined:
    Nov 12, 2005
    Messages:
    243
    Likes Received:
    121
    Very clever and works really well. The same arrangement for wprobot would be great so we could mix ebay amazon and clickbank stuff

    Great work
     
  18. stoned

    stoned Registered Member

    Joined:
    Dec 6, 2007
    Messages:
    59
    Likes Received:
    26
    awesome this is surely a time saver i've been looking for a way to automate things for a while now
     
  19. scb335

    scb335 BANNED BANNED

    Joined:
    Mar 5, 2008
    Messages:
    272
    Likes Received:
    438
    Glad people are getting use out of this.

    @Rob the Builder, I haven't used wprobot before but if I get a chance in the next few days I'll take a look at it. If I can whip something quick up I'll post it here for anyone that wants it.
     
    • Thanks Thanks x 1
  20. VNEIN

    VNEIN Newbie

    Joined:
    Aug 21, 2009
    Messages:
    1
    Likes Received:
    0
    Very nice! Thanks!