Please read carefully about wp_schedule_single_event in Codex. As you can see, there is a third argument $args
.
You can schedule a singule WP_Cron
event by modifying the function you use above and passing arguments as third parameter:
<?php
// Your basic hook schelduling...
wp_schedule_single_event( time() + 30, 'user_cron_event',
array(
'user_id' => $user_id,
'oldmoney' => $oldmoney,
'totalprice' => $totalprice
)
);
and your base action in this case…
add_action('user_cron_event', 'user_cron_event_callback');
function user_cron_event_callback($args){
update_user_meta( $args['user_id'], 'money', $args['oldmoney']-$args['totalprice']);
}