Wordpress Schedule Single Event Bug!

buddyram

New Voyage
Hi Wordpress Geeks,

I am a novice in Wordpress, was working on a schedule single event function(wp_schedule_single_event) wherein to update the database on a given time period. I am unable to set the wp_schedule_single_event function.

Below are the code snippets which i followed to get the result:

Code:
	...
	...
	<form action="sms.php" method="POST">
		Number: <input type="text" name="t1"><br />
		Message: <input type="text" name="t2"><br />
		Timings: <input type="text" name="t3"><br />
		<input type="submit" name="submit" value="Submit">
	</form>
			
	...
	...

^^I placed this code in the functions.php in the themes path and the action is set to the sms.php which is in the BASE PATH.

Code:
	 ...
	 ...
	if(preg_match('/^(9|8|7)[0-9]{1,}$/', $num) && strlen($num) == 10)		{
		if( $time_stamped >= $db_mrng_time_stamped && $time_stamped <= $db_evng_time_stamped)		{
		echo "<br>Call the API";
		wp_schedule_single_event(time(), 'my_new_event');
	}
	else
		echo "<br>Not in the Time Frame";
	 }
		 
	   function do_this_in_an_hour() {
		// do something
		$wpdb->insert( 
			'wp_insert', 
			array( 
				'username' => 'check1', 
				'message' => 'check2' 
				) 
		);
		
		}
			
	add_action('my_new_event','do_this_in_an_hour');
	...
	...
 
Top Bottom