* Plugin Name: GLM Members Database
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 2.1.25
+ * Version: 2.1.26
* Author: Gaslight Media
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
*
*/
-define('GLM_MEMBERS_PLUGIN_VERSION', '2.1.25');
+define('GLM_MEMBERS_PLUGIN_VERSION', '2.1.26');
define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.11');
// Check if plugin version is not current in WordPress option and if needed updated it
*
* The code below checks if we're on a member detail page and if so returns the member slug so that
* can be added to the URL. The matching apply_filters is in the main plugin in setup/frontHooks.php.
+ *
+ * We're also going to set the page title to the member name in here while we're at it.
*/
-add_filter('glm_rel_canonical_slug', function($detailSlug) {
-
- // If another add-on already supplied the detail slug, then just return that.
- if ($detailSlug != false) {
- return $detailSlug;
- }
+if (strpos(GLM_MEMBERS_PLUGIN_CURRENT_URL, $this->config['settings']['canonical_member_page']) > 0) {
- // Check if the page is a member-detail page use the correct
- if (strpos(GLM_MEMBERS_PLUGIN_CURRENT_URL, $this->config['settings']['canonical_member_page']) > 0) {
+ // Parse out only the member slug from the current URL
+ $m = array();
+ preg_match('|.*/'.$this->config['settings']['canonical_member_page'].'/([^/]*).*|', GLM_MEMBERS_PLUGIN_CURRENT_URL, $m );
+ $GLOBALS['glmDetailSlug'] = $m[1];
- // Parse out only the member slug and use that
- $m = array();
- preg_match('|.*/'.$this->config['settings']['canonical_member_page'].'/([^/]*).*|', GLM_MEMBERS_PLUGIN_CURRENT_URL, $m );
- $detailSlug = $m[1];
+ // Return the current member slug to the glm_rel_canonical_slug filter for use in the canonical page link.
+ add_filter('glm_rel_canonical_slug', function($detailSlug) {
- }
+ // If another add-on already supplied the detail slug, then just return that.
+ if ($detailSlug != false) {
+ return $detailSlug;
+ }
+ return $GLOBALS['glmDetailSlug'];
- return $detailSlug;
-});
+ });
+ // Get the member name for use in the page title
+ global $wpdb;
+ $GLOBALS['glmMembName'] = $wpdb->get_var( "SELECT name FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members WHERE member_slug = '".$GLOBALS['glmDetailSlug']."'" );
+ // Set the page title to the member name
+ add_filter('wp_title', function() {
+ return $GLOBALS['glmMembName'];
+ });
+}
// Add memberslug query var
add_filter('query_vars', function($vars) {