Community Support Forums — WordPress® ( Users Helping Users ) — 2011-01-11T17:31:42-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=1091 2011-01-11T17:31:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1091&p=5495#p5495 <![CDATA[Re: Drip Feeding Posts or Pages to menu?]]>
Code:

<?php
/*
Plugin Name: [yourname] Cron Jobs
Version: 1.0
Description: Cron Jobs for [yoursite]
Author: [yourname]
*/

//handle registration/deregistration
register_activation_hook(__FILE__, 'yourname_activate');
register_deactivation_hook(__FILE__, 'yourname_deactivate');

//add actions
add_action('yourname_daily_event', 'yourname_daily');


function yourname_activate() {
   if (!wp_next_scheduled('yourname_daily_event')) {
      wp_schedule_event(time(), 'daily', 'yourname_daily_event');
   }
}

function yourname_deactivate() {
   wp_clear_scheduled_hook('yourname_daily_event');
}

function yourname_daily() {

   foreach (get_users_of_blog () as $user)
   {
      $user = new WP_User ($user->ID);
         
      /**/
      if (strtotime ($user->user_registered) <= strtotime ("-30 days"))
         $user->add_cap ("access_s2member_ccap_30days");
      /**/
      if (strtotime ($user->user_registered) <= strtotime ("-60 days"))
         $user->add_cap ("access_s2member_ccap_60days");
      /**/
      if (strtotime ($user->user_registered) <= strtotime ("-90 days"))
         $user->add_cap ("access_s2member_ccap_90days");
   }   

}


?>


Statistics: Posted by smitchell360 — January 11th, 2011, 5:31 pm


]]>
2011-01-04T16:28:29-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1091&p=5269#p5269 <![CDATA[Re: Drip Feeding Posts or Pages to menu?]]>
Can you verify the code above. This would be great if I can make the drip content work correctly.

Thanks,

-Plrblockbuster

Statistics: Posted by plrblockbusters — January 4th, 2011, 4:28 pm


]]>
2010-12-07T19:35:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1091&p=5029#p5029 <![CDATA[Re: Drip Feeding Posts or Pages to menu?]]>
Tried using the code mentioned below and unfortunately did not have any luck with dripping the content as shown in your example. Here are the steps I performed below:

1. Added the 30days, 60days and 90days to the needed post in the (Require Custom Capabilities) section.
2. Then copied the code mentioned below into a (my-s2-cron-job.php) file and placed it in the plugins section of my wordpress.
3. Created a cron job per your suggestion to run once a day.

If I have missed something please let me know. If I can get this to work, I'm planning on purchasing the Pro version as well.

Regards,

-Juan
PLRBlockbusters.com
Code:
<?php
function my_s2_cron_job ()
    {
        if ($_GET["my_s2_cron_job"])
            {
                foreach (get_users_of_blog () as $user)
                    {
                        $user = new WP_User ($user->ID);
                        /**/
                        if (strtotime ($user->user_registered) <= strtotime ("-30 days"))
                            $user->add_cap ("access_s2member_ccap_30days");
                        /**/
                        if (strtotime ($user->user_registered) <= strtotime ("-60 days"))
                            $user->add_cap ("access_s2member_ccap_60days");
                        /**/
                        if (strtotime ($user->user_registered) <= strtotime ("-90 days"))
                            $user->add_cap ("access_s2member_ccap_90days");
                    }
                exit ();
            }
    }
add_action ("init", "my_s2_cron_job");
?>

Statistics: Posted by plrblockbusters — December 7th, 2010, 7:35 pm


]]>
2010-10-29T09:13:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1091&p=4393#p4393 <![CDATA[Re: Drip Feeding Posts or Pages to menu?]]>

Title: An Example Post C
- require Custom Capability: 90days

If I implement this custom capability for the Bronze level, what happens when the viewer upgrades to the Silver level? Are they bumped back to ...

Title: An Example Post A
- require Custom Capability: 30days

Statistics: Posted by KirkWard — October 29th, 2010, 9:13 am


]]>
2010-10-29T07:17:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1091&p=4392#p4392 <![CDATA[Re: Drip Feeding Posts or Pages to menu?]]> Statistics: Posted by KirkWard — October 29th, 2010, 7:17 am


]]>
2010-10-29T02:35:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1091&p=4382#p4382 <![CDATA[Re: Drip Feeding Posts or Pages to menu?]]> Thanks for the great question/suggestion.

No, s2Member does NOT make this particular feature available as of v3.2.9. s2Member's ability to handle Content Dripping is still limited to its API Constants and documentation made available in your Dashboard under: s2Member -> API Scripting -> Content Dripping.

That being said, you could certainly implement this in a few different ways. Here is one idea for you.

Using s2Member's Meta Box panel on your Post/Page editing forms, you could require specific Custom Capabilities for Posts/Pages that you plan to drip. So let's look at how I might handle this.


Title: An Example Post A
- require Custom Capability: 30days

Title: An Example Post B
- require Custom Capability: 60days

Title: An Example Post C
- require Custom Capability: 90days


So configuring this is pretty simple, as all of that functionality is already built-in with s2Member installed. The only thing left to deal with, is how to assign these Custom Capabilities on a per-User basis, based on how long they've been registered with your site.

You can use the sample script provided below as a starting point:
Save it here: /wp-content/mu-plugins/my-s2-cron-job.php
Code:
<?php
function my_s2_cron_job 
()
    {
        if ($_GET["my_s2_cron_job"])
            {
                foreach (get_users_of_blog () as $user)
                    {
                        $user = new WP_User ($user->ID);
                        /**/
                        if (strtotime ($user->user_registered) <= strtotime ("-30 days"))
                            $user->add_cap ("access_s2member_ccap_30days");
                        /**/
                        if (strtotime ($user->user_registered) <= strtotime ("-60 days"))
                            $user->add_cap ("access_s2member_ccap_60days");
                        /**/
                        if (strtotime ($user->user_registered) <= strtotime ("-90 days"))
                            $user->add_cap ("access_s2member_ccap_90days");
                    }
                exit ();
            }
    }
add_action ("init", "my_s2_cron_job");
?>

You can run this script as a Cron job, once per day:
Code:
http://www.example.com/?my_s2_cron_job=1
OR: http://www.example.com/path/to/wordpress/?my_s2_cron_job=1

Statistics: Posted by Jason Caldwell — October 29th, 2010, 2:35 am


]]>
2010-10-26T11:44:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1091&p=4248#p4248 <![CDATA[Drip Feeding Posts or Pages to menu?]]>
I would like to restrict the visiblity of a particular post or page until a member has been registered at the protected level for x period of time. Using the built in features of Wordpress would be easier than having to create a menu on a single protected page. It would also allow more freedom in the use of most Wordpress themes.

Thanks

Statistics: Posted by KirkWard — October 26th, 2010, 11:44 am


]]>