From: Steve Sutton Date: Fri, 6 Oct 2017 18:03:46 +0000 (-0400) Subject: Add check for status when getting member data for detail pages. X-Git-Tag: v2.10.23^2~49 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=1a6e2eca68d1b4f081c32c984585b1bd0f928a8b;p=WP-Plugins%2Fglm-member-db.git Add check for status when getting member data for detail pages. If the member data doesn't exists then send 404. --- diff --git a/setup/frontHooks.php b/setup/frontHooks.php index b2481239..a41c5141 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -156,9 +156,28 @@ if (strpos(GLM_MEMBERS_PLUGIN_CURRENT_URL, $this->config['settings']['canonical_ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members T, ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info I WHERE T.member_slug = '".$GLOBALS['glmDetailSlug']."' - AND T.id = I.member", + AND T.id = I.member + AND I.status = " . $this->config['status_numb']['Active'], ARRAY_A ); + if ( ! $memberData ) { + // If the memberData is not found then create 404 + function glm_throw_404(){ + global $wp_query; + $wp_query->set_404(); + status_header( 404 ); + nocache_headers(); + add_filter('wp_title', function($title) { + return 'Error 404 - Not Found!'; + }, 99, 1); + $template404 = get_404_template(); + if ( $template404 ) { + require $template404; + } + exit; + } + add_action('wp', 'glm_throw_404'); + } $GLOBALS['glmMembName'] = $memberData['name']; $GLOBALS['glmMembIntro'] = $memberData['short_descr'];