Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dandeibert

    (@dandeibert)

    Perfect. Thanks.

    Thread Starter dandeibert

    (@dandeibert)

    hapening_now.php

    <?php
    		/*
    		Plugin Name: Happening Now Headline Generator
    		Plugin URI: http://www.dspotblog.com
    		Description: Custom Plugin for The D-Spot Blog
    		Author: Dan Deibert
    		Version: 1.0
    		Author URI: http://www.dspotblog.com
    		*/
    
    		function happening_now() {
    			include('happening_now_data_management.php');
    			}
    
    function happening_now_actions() {
        	add_options_page("Happening Now", "Happening Now", 1, "Happening Now", "happening_now");
    		}
    
    		add_action('admin_menu', 'happening_now_actions');
    		?>

    happening_now_data_management.php

    <?php
    global $wpdb;
    require_once('wp-load.php');
    
    ?>
    
    <?php
    		if($_POST['oscimp_hidden'] == 'Y') {
    			//Form data sent
    
         $hap_now_text = $_POST['haptext'];
    	$link_now_text = $_POST['linktext'];
    	$start_date = $_POST['sdate'];
    	$end_date = $_POST['edate'];
    $wpdb->query("UPDATE wp_hapnow SET the_text='$hap_now_text', the_link='$link_now_text', start = '$start_date', end = '$end_date'  WHERE wp_hapnow.id =1 ") ;
    
    		} else {
    			//Normal page display
    
    		}
    
    	/* If your time GMT+2 then your offset is time()+7200 .. if your time is GMT-2 then your offset is time()-7200 and so on.  Multiply
    the number of hours for your offset by 3600 */
    	$offset = time()-18000;
    	$offset2 = time()-10800;
    
    		$hapnowtext = $wpdb->get_var("SELECT the_text FROM wp_hapnow");
    		$linktext = $wpdb->get_var("SELECT the_link FROM wp_hapnow");
    		$startdate = $wpdb->get_var("SELECT start FROM wp_hapnow");
    		$enddate = $wpdb->get_var("SELECT end FROM wp_hapnow");
    		$curtime = gmdate("Y-m-d H:i:s", $offset);
    		$proj_endtime = gmdate("Y-m-d H:i:s", $offset2); 	
    
    	?>
    
    <div class="wrap">
    			<?php    echo "<h2>" . __( 'D-Spot Happening Now Controller', 'oscimp_trdom' ) . "</h2>"; ?>
    
    			<form name="happening_now_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>&updated=true">
    				<input type="hidden" name="oscimp_hidden" value="Y">
    				<?php    echo "<h4>" . __( 'Happening Now Settings', 'oscimp_trdom' ) . "</h4>"; ?>
    				<p><?php _e("Current Settings: " ); ?><br />Start Time: <?php echo $startdate ?> <br /> End Time: <?php echo $enddate ?></p>
    				<p><?php _e("Text for Display: " ); ?><br /><textarea name="haptext"  rows="2" cols="70"><?php echo $hapnowtext; ?></textarea></p>
    				<p><?php _e("Link for headline:(with http) " ); ?><br /><textarea name="linktext"  rows="1" cols="70"><?php echo $linktext; ?></textarea></p>
    				<p><?php _e("Start Time" ); ?>  <input type="text" name="sdate" size="25" value="<?php echo $curtime; ?>"></p>
    				<p><?php _e("End Time" ); ?>    <input type="text" name="edate" size="25" value="<?php echo $proj_endtime; ?>"></p>
    
    				<p class="submit">
    				<input type="submit" name="Submit" value="<?php _e('Update Options', 'oscimp_trdom' ) ?>" />
    				</p>
    			</form>
    		</div>

    Thread Starter dandeibert

    (@dandeibert)

    I think the issue may be with running this on 2.7 on IIS7.

    At the WordPress Admin page, when I enter my API and Secret key’s, the form submits to and then stays on the general options page.. the info in the DB does not get updated.

    Any thoughts?

Viewing 3 replies - 1 through 3 (of 3 total)