I need to set up a cron to change role of a user at a specific time. For example- At 8 PM everyday, the role of a specific user should be changed from "Customer" to "Editor"
How to accomplish this in wordpress?
UPDATE:
I have scheduled the function as follows but it's not running at the time set:
if( !wp_next_scheduled( 'import_into_db' ) ) {
wp_schedule_event( strtotime('12:04:00'), 'daily', 'import_into_db' );
function import_into_db(){
$u = new WP_User(3);
$u->set_role('editor');
}
add_action('wp', 'import_into_db');
}
The functions is running fine independently (without scheduling) but doesn't run when scheduled. Cron is working fine on my install and time is set as per UTC. What's wrong in the scheduling part of my code?