Support » Plugin: PublishPress Future: Schedule Changes to WordPress Posts » Undefined index error in post-expirator.php

  • Resolved James Robinson

    (@imaginarymedia)


    Hi,

    I’m still getting “Undefined index” errors. I’m running the latest version of the plugin with WP 3.5.1.

    This happens every time I attempt to update a page or post on the site. See below for full error message. I had read that this issue had been resolved.

    `Notice: Undefined index: expirationdate_month in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 407

    Notice: Undefined index: expirationdate_day in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 408

    Notice: Undefined index: expirationdate_year in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 409

    Notice: Undefined index: expirationdate_hour in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 410

    Notice: Undefined index: expirationdate_minute in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 411

    Notice: Undefined index: expirationdate_month in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 407

    Notice: Undefined index: expirationdate_day in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 408

    Notice: Undefined index: expirationdate_year in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 409

    Notice: Undefined index: expirationdate_hour in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 410

    Notice: Undefined index: expirationdate_minute in /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php on line 411

    Warning: Cannot modify header information – headers already sent by (output started at /home/eagcg/public_html/wp-content/plugins/post-expirator/post-expirator.php:407) in /home/eagcg/public_html/wp-includes/pluggable.php on line 876

    http://wordpress.org/extend/plugins/post-expirator/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Edit the file “post-expirator.php” and locate the function :
    function expirationdate_update_post_meta($id) {

    }

    then replace it by this one :

    function expirationdate_update_post_meta($id) {
    	if (!isset($_POST['expirationdate_formcheck']))
    		return false;
    
        $default = get_option('expirationdateDefaultDate',POSTEXPIRATOR_EXPIREDEFAULT);
    	if ($default == 'publish') {
    	        if(isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn'])){
     	         $month = $_POST['mm'];
            	 $day = $_POST['jj'];
    	         $year = $_POST['aa'];
            	 $hour = $_POST['hh'];
    	         $minute = $_POST['mn'];
                }
    	} else {
    	        if(isset($_POST['expirationdate_month']) && isset($_POST['expirationdate_day']) && isset($_POST['expirationdate_year']) && isset($_POST['expirationdate_hour']) && isset($_POST['expirationdate_minute'])){
    	         $month = $_POST['expirationdate_month'];
            	 $day = $_POST['expirationdate_day'];
    	         $year = $_POST['expirationdate_year'];
            	 $hour = $_POST['expirationdate_hour'];
    	         $minute = $_POST['expirationdate_minute'];
                }
    	}
    	$category = isset($_POST['expirationdate_category']) ? $_POST['expirationdate_category'] : 0;
    	if (isset($_POST['enable-expirationdate'])) {
    	        postExpiratorTimezoneSetup();
            	// Format Date
                if(isset($hour) && isset($minute) && isset($month) && isset($day) && isset($year))
            	 $ts = mktime($hour,$minute,0,$month,$day,$year);
                else
            	 $ts = time() + (24*60*60);//an error occured, so post will expires in 24 hours
    
            	// Update Post Meta
    		    delete_post_meta($id, '_expiration-date-category');
    		    delete_post_meta($id, 'expiration-date');
    	        update_post_meta($id, 'expiration-date', $ts);
    
            	$catEnabled = get_option('expirationdateCategory');
    	        if ((isset($category) && !empty($category)) && ($catEnabled === false || $catEnabled == 1)) {
    			if (!empty($category)) update_post_meta($id, '_expiration-date-category', $category);
    		}
    		update_post_meta($id, '_expiration-date-processed', 0);
    	} else {
    		delete_post_meta($id, 'expiration-date');
    		delete_post_meta($id, '_expiration-date-category');
    		delete_post_meta($id, '_expiration-date-processed');
    	}
    }

    This will be fixed in the next release.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined index error in post-expirator.php’ is closed to new replies.