How to programtically queue a function for 48 hours (to change webform Author) The code below changes the submission author to that of a user referenced in the webform (pulls username:uid). However now need this to change after 48 hours.

I am unsure how to effectively queue this for 48 hours before it runs or even if that is possible (I guess I will have to change the hook to "hook_webform_submission_update")..

I was thinking of rules but is there a hook which would help? Also if rules is the answer could anyone shed some light on how I can implement it into my code?

// change submission author to the submitted user lookup
function helper_custom_webform_submission_presave($node, &amp;$submission) {

    // get uid from user_lookup
    $user_lookup_cid = 1;
    $user_string = $submission-&gt;data[$user_lookup_cid]['value'][0];
    $user_string = explode(":", $user_string);
    $uid = $user_string[1];

    //change submission to be saved by user
    $submission-&gt;uid = $uid;
}
Implement hook_webform_submission_insert() such that it saves $node-&gt;nid, $submission-&gt;sid and the current time to a designated table (e.g. newsubmissions).

Implement hook_cron() such that it goes through all records in the newsubmissions table, that are more than 48 hours old. For each such record, you should


load the submission by calling webform_get_submission(),
change the owner of the submission,
save the submission by calling webform_submission_update(),
delete the record from the newsubmissions table.


Implementing hook_webform_submission_presave() the same way as hook_webform_submission_insert() will not work, because


$submission-&gt;sid is not yet set and
hook_webform_submission_presave() is also called for old submissions.