WordPress.org

Ready to get started?Download WordPress

Forums

Quick Page/Post Redirect Plugin
[resolved] Undefined Index Errors (3 posts)

  1. Cara Peckens
    Member
    Posted 1 year ago #

    I love your plugin, but have some suggestions to remove undefined index errors. Great work!

    Modified ppr_settings_page function

    function ppr_settings_page() {
    		if(empty($_GET['update'])){} else {
    		if($_GET['update']=='3'){$this->updatemsg ='All Quick Redirects deleted from database.';}
    		if($_GET['update']=='2'){$this->updatemsg ='All Regular Redirects deleted from database.';}
    		if($_GET['update']=='4'){$this->updatemsg ='Quick Redirects Imported & Replaced.';}
    		if($_GET['update']=='5'){$this->updatemsg ='Quick Redirects Importer & Added to Existing Redirects.';}
    		}

    At line 1326, add conditionals to provide default values

    if (get_post_meta($post->ID,'_pprredirect_active',true)) {
    				$my_meta_data['_pprredirect_active'] 		= $_REQUEST['pprredirect_active'];
    				} else {  $my_meta_data['_pprredirect_active'] 		= ''; }
    
    			if (get_post_meta($post->ID,'_pprredirect_newwindow',true)) {
    				$my_meta_data['_pprredirect_newwindow'] 	= $_REQUEST['pprredirect_newwindow']; }
    				else { $my_meta_data['_pprredirect_newwindow'] 		= ''; }
    
    			if (get_post_meta($post->ID,'_pprredirect_relnofollow',true)) {
    				$my_meta_data['_pprredirect_relnofollow'] 	= $_REQUEST['pprredirect_relnofollow']; }
    				else { $my_meta_data['_pprredirect_relnofollow'] 		= ''; }
    
    			if (get_post_meta($post->ID,'_pprredirect_type',true)) {
    				$my_meta_data['_pprredirect_type'] 			= $_REQUEST['pprredirect_type']; }
    				else { $my_meta_data['_pprredirect_type'] 		= ''; }
    
    			if (get_post_meta($post->ID,'_pprredirect_rewritelink',true)) {
    				$my_meta_data['_pprredirect_rewritelink'] 	= $_REQUEST['pprredirect_rewritelink']; }
    				else { $my_meta_data['_pprredirect_rewritelink'] 		= ''; }
    
    			if (get_post_meta($post->ID,'_pprredirect_url',true)) {
    						$my_meta_data['_pprredirect_url']    		= $_REQUEST['pprredirect_url'];  }
    						else { $my_meta_data['_pprredirect_url'] 		= ''; }

    http://wordpress.org/extend/plugins/quick-pagepost-redirect-plugin/

  2. prophecy2040
    Member
    Plugin Author

    Posted 1 year ago #

    cpeckens
    Thanks for the input.

    Don

  3. prophecy2040
    Member
    Plugin Author

    Posted 1 year ago #

    @cpeckens -
    Your fixes are in the latest version (with some slight modifications).
    Thanks again for the help.
    Don

    Here is what we did:

    if(isset($_GET['update'])){
      if($_GET['update']=='3'){$this->updatemsg ='All Quick Redirects deleted from database.';}
      if($_GET['update']=='2'){$this->updatemsg ='All Regular Redirects deleted from database.';}
      if($_GET['update']=='4'){$this->updatemsg ='Quick Redirects Imported & Replaced.';}
      if($_GET['update']=='5'){$this->updatemsg ='Quick Redirects Imported & Added to Existing Redirects.';}
    }

    and the other part looks like this:

    // find & save the form data & put it into an array
    $my_meta_data['_pprredirect_active'] 		= isset($_REQUEST['pprredirect_active']) 		? $_REQUEST['pprredirect_active'] 	: '';
    $my_meta_data['_pprredirect_newwindow'] 	= isset($_REQUEST['pprredirect_newwindow']) 	? $_REQUEST['pprredirect_newwindow'] 	: '';
    $my_meta_data['_pprredirect_relnofollow'] 	= isset($_REQUEST['pprredirect_relnofollow']) 	? $_REQUEST['pprredirect_relnofollow'] 	: '';
    $my_meta_data['_pprredirect_type'] 			= isset($_REQUEST['pprredirect_type']) 			? $_REQUEST['pprredirect_type'] 		: '';
    $my_meta_data['_pprredirect_rewritelink'] 	= isset($_REQUEST['pprredirect_rewritelink']) 	? $_REQUEST['pprredirect_rewritelink'] 	: '';
    $my_meta_data['_pprredirect_url']    		= isset($_REQUEST['pprredirect_url']) 			? $_REQUEST['pprredirect_url'] 		: '';

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic