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 as $key => $job )
if( $job['args'][0]['customer']['user_id'] == $user_id )
return array( 'id' => $user_id, 'timestamp' => $timestamp, 'key' => $key );
}
Then I use this function to go through and create a new job with the new args and unset the old one
function replace_cron_args( $hook, $user_id ) {
// lets find the cron job corresponding to the user id
$user = search_user_cron( $hook, $user_id );
// get all the current cron jobs
$crons = _get_cron_array();
// get the most recent updated arguments
$stored_args = get_user_meta( $user['id'], 'oe_customer_details', true );
// get the current user key
$key = $user['key'];
// get the current user timestamp
$timestamp = $user['timestamp'];
// serialize the new arguments
$newkey = md5( serialize( $stored_args ) );
// update the stored arguments
$crons[$timestamp][$hook][$key]['args'][0] = $stored_args;
// replace the key with the new serialized key
$crons[$timestamp][$hook][$newkey] = $crons[$timestamp][$hook][$key];
// unset the old array
unset( $crons[$timestamp][$hook][$key] );
// set the new cron jobs
_set_cron_array( $crons );
}
If anyone can think of a more efficient way, please let me know.