Add check for status when getting member data for detail pages.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 6 Oct 2017 18:03:46 +0000 (14:03 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 9 Oct 2017 12:48:11 +0000 (08:48 -0400)
If the member data doesn't exists then send 404.
Update version number for this hotfix/2.10.13

index.php
readme.txt
setup/frontHooks.php

index 53b4eb8..d9bd04d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Database
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 2.10.12
+ * Version: 2.10.13
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersDatabase
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 2.10.12
+ * @version 2.10.13
  */
 
 // Check that we're being called by WordPress.
@@ -44,7 +44,7 @@ if (!defined('ABSPATH')) {
  *
  */
 
-define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.12');
+define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.13');
 define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.32');
 
 // Check if plugin version is not current in WordPress option and if needed updated it
index 2744906..e1d667a 100644 (file)
@@ -66,6 +66,12 @@ There is of course much more to this.
 (none)
 
 == Changelog ==
+= 2.10.13 =
+Hotfix for member 404 pages.
+
+= 2.10.12 =
+Update for member photos. Using fancybox.
+
 = 2.10.11 =
 * New Admin search filter for member types.
 * New option in member export (check/uncheck all) for the field selection.
index b248123..a41c514 100644 (file)
@@ -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'];