// Only run these tests for insert and update
if ($this->postProcess && isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
if ($r['primary_contact']) {
- $this->wpdb->query("UPDATE ".$this->table." SET primary_contact = false where id != ".$r['id'].";");
+ $this->wpdb->query("UPDATE ".$this->table." SET primary_contact = false where primary_contact = true AND ref_type = ".$r['ref_type']['value']." AND ref_dest = ".$r['ref_dest']." AND id != ".$r['id'].";");
}
}
return $r;
}
-
+
/*
* Get Alpha list of first characters in member name
public function getAlphaList($where = '', $selected = '')
{
-
+
$sql = "
SELECT DISTINCT LEFT(T.lname, 1) AS alpha
FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX. "contacts T
$where
ORDER BY alpha
;";
-
+
$alphaData = $this->wpdb->get_results($sql, ARRAY_A);
-
+
// Set selected
foreach ($alphaData as $k=>$v) {
$alphaData[$k]['default'] = ($v['alpha'] == $selected);
return $alphaData;
}
-
-
+
+
/*
* Get the contact's "Permissions" (contact_role)
*
* Plugin Name: GLM Members Database Contacts
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 1.0.19
+ * Version: 1.0.20
* Author: Gaslight Media
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
* @package glmMembersDatabaseContacts
* @author Gaslight Media <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.19
+ * @version 1.0.20
*/
/*
* version when there's a change in the database!! Use the
* version nunmber of that release for the DB version.
*/
-define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.19');
+define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.20');
define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.3');
// This is the minimum version of the GLM Members DB plugin require for this plugin.