Regenerating array key for wp_schedule_event args

So what I came up with, which seems to work is the following: This function will search by the user id and find the corresponding cron job function search_user_cron( $hook, $user_id ) { $crons = _get_cron_array(); foreach( $crons as $timestamp => $cron ) if( isset( $cron[$hook] ) ) foreach( $cron as $jobs ) foreach( $jobs … Read more

Using a Cron Job to dynamically populate a field ONCE, and then making the field blank the next time someone visits page

I’m gonna attempt an answer here: In your GF code, you’re going to need to have a snippet that checks the hidden field in the db first. IF value is blank.. THEN they are not a winner = Proceed. If value is ‘winner’.. then update value to blank… Proceed with ‘winner’ functionality. In your cron, … Read more

Cron jobs repeating themselves

The wp_schedule_single_event function in cron.php (http://core.trac.wordpress.org/browser/tags/3.7.1/src/wp-includes/cron.php#L0) has a comment which says: // don’t schedule a duplicate if there’s already an identical event due in the next 10 minutes So I’d say that no it won’t trigger lots of calls for earlier in the day.

WP Cron: Save third party data as user meta

An alternative way to do what I wanted : Save the time when the action has been ran and check the difference with actual time : function my_save_statistiques( $user_id ) { $user_id = get_current_user_id(); $current_time = time(); if (empty($current_time)) { update_usermeta( $user_id, ‘last_analytics’, $current_time ); } $last_analytics = get_user_meta( $user_id, ‘last_analytics’, true ); $diff = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)