From b6982fc4c04b42a75a49925142cf24439405fb0e Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 16 Sep 2016 11:42:31 -0400 Subject: [PATCH] Fix error for undefined Check with isset. --- functions.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/functions.php b/functions.php index 7a5e16d..bec1c0e 100644 --- a/functions.php +++ b/functions.php @@ -116,10 +116,10 @@ function glm_site_scripts() /* Woocommerce */ -function get_product_category_by_id($cat_id) +function get_product_category_by_id($cat_id) { $category = get_term_by('id', $cat_id, 'product_cat', 'OBJECT'); -return $category; +return $category; } add_filter( 'woocommerce_variation_option_name', 'display_price_in_variation_option_name' ); @@ -307,7 +307,7 @@ if ( ! function_exists( 'is_tree' ) ) { } add_action('thematic_searchloop', 'mytheme_search_loop'); // End of the Contextual/Highlight Search functions -// +// //function get_menu_parent_ID($menu_name){ // if(!isset($menu_name)){ @@ -362,17 +362,17 @@ if (!function_exists('is_in_tree')) { /** * Function Name: front_end_login_fail. * Added for: GLM Member DB front-end login failure custom redirection. - * Description: This redirects the failed login to the custom login page + * Description: This redirects the failed login to the custom login page * instead of default login page with a modified url **/ add_action( 'wp_login_failed', 'front_end_login_fail' ); function front_end_login_fail( $username ) { // Getting URL of the login page - $referrer = $_SERVER['HTTP_REFERER']; + $referrer = $_SERVER['HTTP_REFERER']; // if there's a valid referrer, and it's not the default log-in screen if( !empty( $referrer ) && !strstr( $referrer,'wp-login' ) && !strstr( $referrer,'wp-admin' ) ) { - echo get_permalink( get_option('glm_members_database_option_members_only_id') ) . "?login=failed"; - wp_redirect( get_permalink( get_option('glm_members_database_option_members_only_id') ) . "?login=failed" ); + echo get_permalink( get_option('glm_members_database_option_members_only_id') ) . "?login=failed"; + wp_redirect( get_permalink( get_option('glm_members_database_option_members_only_id') ) . "?login=failed" ); exit; } } @@ -380,16 +380,16 @@ function front_end_login_fail( $username ) { /** * Function Name: front_end_blank_credentials. * Added for: GLM Member DB front-end login failure custom redirection. - * Description: This redirects to the custom login page if user name or + * Description: This redirects to the custom login page if user name or * password is empty with a modified url **/ add_action( 'authenticate', 'front_end_blank_credentials', 1, 3); function front_end_blank_credentials( $login, $username, $password ) { // Getting URL of the login page - $referrer = $_SERVER['HTTP_REFERER']; + $referrer = ( isset( $_SERVER['HTTP_REFERER'] ) && $_SERVER['HTTP_REFERER'] ) ? : ''; // if there's a valid referrer, and it's not the default log-in screen - if( !empty( $referrer ) && !strstr( $referrer,'wp-login' ) && !strstr( $referrer,'wp-admin' ) ) { + if( !empty( $referrer ) && !strstr( $referrer,'wp-login' ) && !strstr( $referrer,'wp-admin' ) ) { if( $username == "" || $password == "" ){ wp_redirect( get_permalink( get_option('glm_members_database_option_members_only_id') ) . "?login=empty" ); exit; -- 2.17.1