Notice: Undefined index: primary in domain_mapping.php on line 374
-
Notice: Undefined index: primary in /var/www/html/metro_aux/wp-content/mu-plugins/domain_mapping.php on line 374
Notice: Undefined index: primary in /var/www/html/metro_aux/wp-content/mu-plugins/domain_mapping.php on line 377
sorry running in PHP strict mode 🙂
had a dig into the code and here is patch
--- a/wp-content/mu-plugins/domain_mapping.php +++ b/wp-content/mu-plugins/domain_mapping.php @@ -371,10 +371,12 @@ function dm_handle_actions() { case "add": do_action('dm_handle_actions_add', $domain); if( null == $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain = '$domain'" ) && null == $wpdb->get_row( "SELECT blog_id FROM {$wpdb->dmtable} WHERE domain = '$domain'" ) ) { - if ( $_POST[ 'primary' ] ) { + $primary = 0; + if ( array_key_exists( 'primary', $_POST ) ) { $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active = 0 WHERE blog_id = %d", $wpdb->blogid ) ); + $primary = 1; } - $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtable} ( <code>id</code> , <code>blog_id</code> , <code>domain</code> , <code>active</code> ) VALUES ( NULL, %d, %s, %d )", $wpdb->blogid, $domain, $_POST[ 'primary' ] ) ); + $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtable} ( <code>id</code> , <code>blog_id</code> , <code>domain</code> , <code>active</code> ) VALUES ( NULL, %d, %s, %d )", $wpdb->blogid, $domain, $primary) ); wp_redirect( add_query_arg( array( 'updated' => 'add' ), $url ) ); exit; } else {
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Notice: Undefined index: primary in domain_mapping.php on line 374’ is closed to new replies.