<?php
add_action ("init", "my_cron_job", 1);
function my_cron_job ()
{
if ($_GET["my_cron_job"] === "secret-cron-job-key")
{
foreach (get_users () as $user)
{
$user = new WP_User ($user->ID);
if (SELECT * FROM 'wp_users' WHERE training = 1)
{
# A Member for at least 10 days.
# Promote them now to Level #2.
if (!$user->has_cap ("access_s2member_level2"))
$user->set_role ("s2member_level2");
}
}
/**/
exit ();
}
}
?>
Statistics: Posted by tonyt — January 16th, 2012, 8:50 am
<?php
$user_id = 123;
$user = new WP_User($user_id);
/* Or, $user = wp_get_current_user(); */
$user->add_cap("access_s2member_ccap_prospectivepa");
?>
<?php
$user_id = 123;
$user = new WP_User($user_id);
/* Or, $user = wp_get_current_user(); */
$user->remove_cap("access_s2member_ccap_prospectivepa");
$user->add_cap("access_s2member_ccap_pastudent");
?>
<?php
$user_id = 123;
$user = new WP_User($user_id);
/* Or, $user = wp_get_current_user(); */
foreach($user->allcaps as $cap)
if(strpos($cap, "access_s2member_ccap_") === 0)
echo 'This is a Custom Capability';
?>
Statistics: Posted by Jason Caldwell — November 21st, 2011, 1:56 pm
Statistics: Posted by davidpayne — November 21st, 2011, 5:48 am
<?php
add_action ("init", "my_cron_job", 1);
function my_cron_job ()
{
if ($_GET["my_cron_job"] === "secret-cron-job-key")
{
foreach (get_users () as $user)
{
$user = new WP_User ($user->ID);
$_10_days_ago = strtotime ("-10 days");
if (s2member_registration_time ($user->ID) <= $_10_days_ago)
{
# A Member for at least 10 days.
# Promote them now to Level #2.
if (!$user->has_cap ("access_s2member_level2"))
$user->set_role ("s2member_level2");
}
}
/**/
exit ();
}
}
?>
http://www.example.com/?my_cron_job=secret-cron-job-key
Statistics: Posted by Jason Caldwell — March 15th, 2011, 1:06 am
<?php
$user_id = "123";
$user = new WP_User($user_id);
$user->set_role("s2member_level1");
?>
subscriber
s2member_level1
s2member_level2
s2member_level3
s2member_level4
author
contributor
administrator
editor
<?php
$user_id = "123";
$user = new WP_User($user_id);
$user->add_cap("access_s2member_level0");
$user->add_cap("access_s2member_level1");
$user->add_cap("access_s2member_ccap_music");
$user->add_cap("access_s2member_ccap_videos");
$user->remove_cap("access_s2member_level2");
?>
Statistics: Posted by Jason Caldwell — March 4th, 2011, 10:45 pm