Adding enable_multiple_profiles to data abstract for settingsGeneral.
Updating the database version number to 1.1.30
Add check for enable_multiple_profile to be off before trying to reset
all other member profiles for the member to inactive.
Adding new rewrite rule for appending the member info id to the member
detail url's.
'use' => 'a'
),
+ // Enable Multiple Active Profiles
+ 'enable_multiple_profiles' => array(
+ 'field' => 'enable_multiple_profiles',
+ 'type' => 'checkbox',
+ 'use' => 'a'
+ ),
+
/*
* Member Info edit tab selection
*/
*/
define('GLM_MEMBERS_PLUGIN_VERSION', '2.9.14');
-define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.29');
+define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.30');
// Check if plugin version is not current in WordPress option and if needed updated it
if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) {
// If we do, then activate it
if($idTest != null) {
- $sql = "
- UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
- SET status = ".$this->config['status_numb']['Inactive']."
- WHERE member = $memberID
- AND status = ".$this->config['status_numb']['Active']."
- ;";
- $this->wpdb->query($sql);
+ if ( !$this->config['settings']['enable_multiple_profiles'] ) {
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ SET status = ".$this->config['status_numb']['Inactive']."
+ WHERE member = $memberID
+ AND status = ".$this->config['status_numb']['Active']."
+ ;";
+ $this->wpdb->query($sql);
+ }
$sql = "
UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
$memberUpdated = false;
$memberUpdateError = false;
$categories = false;
- $multipleProfileEnabeled = true;
+ $multipleProfileEnabeled = $this->config['settings']['enable_multiple_profiles'];
// Check for action option - Should be one of the values in the "switch" statement below
$option = false;
'1.1.26' => array('version' => '1.1.26', 'tables' => 18, 'date' => '03/08/17'),
'1.1.27' => array('version' => '1.1.27', 'tables' => 19, 'date' => '03/29/17'),
'1.1.28' => array('version' => '1.1.28', 'tables' => 19, 'date' => '04/04/17'),
- '1.1.29' => array('version' => '1.1.29', 'tables' => 19, 'date' => '04/10/17')
+ '1.1.29' => array('version' => '1.1.29', 'tables' => 19, 'date' => '04/10/17'),
+ '1.1.30' => array('version' => '1.1.30', 'tables' => 19, 'date' => '04/12/17')
);
-- Gaslight Media Members Database
--- File Created: 03/29/17
--- Database Version: 1.1.29
+-- File Created: 04/12/17
+-- Database Version: 1.1.30
-- Database Update From Previous Version Script
--
-- To permit each query below to be executed separately,
add_filter( 'rewrite_rules_array', function($rules) {
$newrules = array();
$newrules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)/([^/]*)$']='index.php?pagename=$matches[1]&memberslug=$matches[2]&profile=$matches[3]';
- $newrules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$']='index.php?pagename=$matches[1]&memberslug=$matches[2]';
+ if ( isset( $this->config['settings']['enable_multiple_profiles'] ) && $this->config['settings']['enable_multiple_profiles'] ) {
+ $newrules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$']='index.php?pagename=$matches[1]&memberslug=$matches[2]';
+ }
return $newrules + $rules;
});
add_filter( 'query_vars', function($vars) {
array_push($vars, 'memberslug');
- array_push($vars, 'profile');
+ if ( isset( $this->config['settings']['enable_multiple_profiles'] ) && $this->config['settings']['enable_multiple_profiles'] ) {
+ array_push($vars, 'profile');
+ }
return $vars;
});
add_action('wp_loaded', function() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
- if ( ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)/([^/]*)$'] ) ) {
+ if ( isset( $this->config['settings']['enable_multiple_profiles'] ) && $this->config['settings']['enable_multiple_profiles'] && ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)/([^/]*)$'] ) ) {
trigger_error('Doing rewrite flush - Member detail page', E_USER_NOTICE); // Logging that this is happening so we can track when that happens.
global $wp_rewrite;
$wp_rewrite->flush_rules();
<input type="checkbox" name="enable_counties"{if $genSettings.fieldData.enable_counties.value} checked="checked"{/if}>
</td>
</tr>
+ <tr>
+ <th>Enable Multiple Active Member Profiles:</th>
+ <td>
+ <input type="checkbox" name="enable_multiple_profiles"{if $genSettings.fieldData.enable_multiple_profiles.value} checked="checked"{/if}>
+ </td>
+ </tr>
<tr>
<th>Member Info Tabs Selection:</th>
<td>
</table>
</td>
</tr>
-
+
<tr><td colspan="2"><h2>Misc. Settings</h2></td></tr>
<tr>
<th {if $genSettings.fieldRequired.google_maps_api_key}class="glm-required"{/if}>Google Maps API Key:</th>