Adds members attribute to the shortcode.
}
#reset-shortcode{
background: #DE5D60;
-
+
}
.shortcode-button:hover{
cursor: pointer;
.shortcode-confirmation.confirmed{
top: -50px;
z-index: 1;
-
+
}
.delete-shortcode-tile{
margin-left: 10px;
width:50%;*/
display: block;
}
-#categoryTitle > span, #groupsTitle > span, #regionsTitle > span {
+#categoryTitle > span, #memberTitle > span, #groupsTitle > span, #regionsTitle > span {
font-weight: bold;
}
-#categoryTitle, #shortcodesTitle, #groupsTitle, #regionsTitle {
+#categoryTitle, #memberTitle, #shortcodesTitle, #groupsTitle, #regionsTitle {
font-weight: bold;
font-size: 16px;
/* border-bottom: 2px #ddd solid; */
$(".shortcode-tile-container").empty();
shortcodeAttributes = {
categories : {list:[], isList: true},
+ members : {list:[], isList: true},
regions : {list:[], isList: true},
groups : {list:[], isList: true},
views : {list:[], isList: false},
generateShortCodeAttribute(shortcodeData);
}
setupAttributes();
+ var cache = {};
+ var memberNames = [
+ { label: 'Steve', value: 1 },
+ { label: 'George', value: 2 },
+ { label: 'Dave', value: 3 },
+ { label: 'Banner', value: 4 }
+ ];
+ $('#shortcode-members').autocomplete({
+ minLength: 2,
+ source: function( request, response ){
+ var term = request.term;
+ if ( term in cache ) {
+ response( cache[ term ] );
+ return;
+ }
+
+ $.getJSON( memberNameJsonUrl, request, function( data, status, xhr ){
+ cache[ term ] = data;
+ response( data );
+ } );
+ },
+ select: function( event, ui ){
+ var id = $(this).val();
+ var type = 'members';
+ let record = {id: ui.item.value, name: ui.item.label, type: 'members'};
+ $('#shortcode-members').val('');
+ shortcodeAttributes['members'].list.push(record);
+ updateShortcode({list: shortcodeAttributes[type].list, type: type, isList: shortcodeAttributes[type].isList});
+ },
+ close: function( event, ui ) {
+ $('#shortcode-members').val('');
+ }
+ });
$(document).on("change", ".shortcode-selection",function(){
var id = $(this).val();
var name = $(this).find("option:selected").text();
- var type = $(this).find("option:selected").data("type");
+ var type = $(this).find("option:selected").data("type");
let record = {id: id, name: name, type: type};
if(shortcodeAttributes[type].list.length == 0 || !checkDuplicates(record, shortcodeAttributes[type].list) && shortcodeAttributes[type].isList ){
shortcodeAttributes[type].list.push(record);
tile.remove();
updateShortcode({list: shortcodeAttributes[type].list, type: type});
});
-});
\ No newline at end of file
+});
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Members List JSON Export by AJAX
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+
+/**
+ *
+ * This class exports the currently selected members list
+ * to a printable HTML file, to a CSV file, or otherwise.
+ */
+class GlmMembersAdmin_ajax_memberNameJson
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /**
+ * Constructor
+ *
+ * This constructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ( $wpdb, $config )
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ public function modelAction( $actionData = false ) {
+
+ // Create json export of active members.
+ $members = array();
+
+ $whereParts = array( 'true' );
+
+ $whereParts[] = " (
+ SELECT access
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
+ WHERE id = T.member
+ ) IN (
+ " . $this->config['access_numb']['NoAccess'] . ",
+ " . $this->config['access_numb']['Moderated'] . ",
+ " . $this->config['access_numb']['Full'] . "
+ )
+ AND T.status = " . $this->config['status_numb']['Active'];
+
+ $where = implode( ' AND ', $whereParts );
+
+ $members = $this->wpdb->get_results(
+ "SELECT T.member as value,T.member_name as name,T.member_name as label
+ FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info T
+ WHERE true
+ AND $where",
+ ARRAY_A
+ );
+
+ header( 'Content-Type: application/json' );
+ echo json_encode( $members );
+ }
+
+}
'membersListJson' => 'glm-member-db',
'verifyLatLon' => 'glm-member-db',
'memberCountCheck' => 'glm-member-db',
+ 'memberNameJson' => 'glm-member-db',
),
'dashboard' => array(
'index' => 'glm-member-db',
+<script>
+ var memberNameJsonUrl = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberNameJson';
+</script>
<div id="shortcode_container" class="{$shortcode_count}" style="overflow: auto">
<input id="shortcode-copy" type="text" style="display: none;">
<div id="shortcode-preview"></div>
<option data-type="regions" value="{$region.id}"> {$region.name}</option>
{/foreach}
</select>
- <div id="reset-shortcode" class="right shortcode-button" type="button">
+ <input type="text" id="shortcode-members" class="shortcode-input" placeholder="Search Members" data-type="members" />
+ <div id="reset-shortcode" class="right shortcode-button" type="button">
Reset Shortcode
<div id="shortcode-reset-confirmation" class="shortcode-confirmation">Shortcode Reset</div>
</div>
- <div id="copy-to-clipboard" class="right shortcode-button" type="button">
- Copy To Clipboard
+ <div id="copy-to-clipboard" class="right shortcode-button" type="button">
+ Copy To Clipboard
<div id="shortcode-copy-confirmation" class="shortcode-confirmation">Shortcode Copied</div>
</div>
-
+
</div>
<div id="activeCategories" class="glm-dynSelect-box scCategories" style="height: auto; overflow: auto;">
<div id="categoryTitle" class="shortcode-tile-title">Categories</div>
<div id="categories-container" class="shortcode-tile-container"></div>
</div>
+ <div id="activeMembers" class="glm-dynSelect-box scMembers" style="height: auto; overflow: auto;">
+ <div id="memberTitle" class="shortcode-tile-title">Members</div>
+ <div id="members-container" class="shortcode-tile-container"></div>
+ </div>
<div id="activeGroups" class="glm-group-dynSelect-box scGroups" style="height: auto; overflow: auto;">
<div id="groupsTitle" class="shortcode-tile-title">Amenity Groups</div>
<div id="groups-container" class="shortcode-tile-container"></div>
.glma-category-child::before{
content: "-";
}
-</style>
\ No newline at end of file
+</style>