Have a look at this function:
`wp_schedule_single_event`
You can find it in wp-includes/cron.php. There’s a bunch of other cron related functions in there, but the one I mentioned above is probably your best bet. Then schedule an event by attaching it to a hook, when a user signs up
Thanks Travel-Junkie. That looks like it will work well hooked to a specific function (ie. user creation). I’ll look into it for some cases.
How about something that runs nightly and sends an email to a group of users based on a BP query of the users? Is there a way to schedule this in BP?
No worries. There’s a recurring scheduling function as well in that file.
Do you know of any plugins that implement these types of cron? I learn better looking at other example code and building it from there.
something like: (what i use for sitemap generator for a daily function call)
`
//on plugin activation register cron
function myplugin_activation() {
wp_schedule_event( time(), ‘daily’, ‘myplugin_wp_cron_call’ );
}
register_activation_hook(__FILE__, ‘myplugin_activation’);
//on plugin deactivation remove cron
function myplugin_deactivation() {
wp_clear_scheduled_hook( ‘myplugin_wp_cron_call’ );
}
register_deactivation_hook(__FILE__, ‘myplugin_deactivation’);
//hook the action to call from wp_cron
add_action( ‘myplugin_wp_cron_call’, ‘myplugin_some_function_to_hook_for_wp_cron’ );
`
Here’s a pretty good guide that covers what Rich has shown here, plus how to designate custom intervals: http://themocracy.com/2010/02/wp-cron-automating-scheduling/