*
* Also note that parameters will be in the context of the main admin controller constructor.
*/
+/**
+ * Filter will return true if the plugin is active.
+ */
+add_filter( 'glm-members-customfields-active', function( $active ){
+ return true;
+}, 10, 1 );
+/**
+ * Filter returns html from the management -> fields model.
+ */
+add_filter( 'glm-members-customfields-edit', function( $content, $uid ){
+ unset( $_REQUEST['glm_action'] );
+ $content = $this->controller( 'management', 'fields', array( 'uid' => $uid ), true );
+ return $content;
+}, 10, 3 );
+/**
+ * Filter returns the html for the form segment
+ */
+add_filter( 'glm-members-customfields-form', function( $content, $uid, $id ){
+ unset( $_REQUEST['glm_action'] );
+ $content = $this->controller( 'memberinfo', 'fields', array( 'uid' => $uid, 'memberId' => $id ), true );
+ return $content;
+}, 10, 3 );
+/**
+ * Filter Captured Data Success Status
+ *
+ * Returns Stored Data
+ */
+add_filter( 'glm-members-customfields-capture', function( $content, $uid, $id ){
+
+}, 10, 3 );
+/**
+ * Filter to Return Stored Data
+ */
+add_filter( 'glm-members-customfields-data', function( $content, $uid, $id ){
+
+}, 10, 3 );
add_filter( 'glm-member-db-member-info-custom-nav', function( $content ){
$out = '<a id="glm-member-info-custom-fields" data-show-table="glm-table-custom-fields" class="glm-member-info-tab nav-tab">Custom Fields</a>';
return $out;
-{include file='admin/management/header.html'}
+<!-- Add Custom Field Button and Dialog Box -->
+<div id="newFieldButton" class="button button-primary glm-right">Add a Custom Field</div>
+<div id="newFieldDialog" class="glm-dialog-box" title="Enter a New Custom Field">
+ <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="import">
+ <input type="hidden" name="option" value="customfields">
+ <input type="hidden" name="option2" value="addNew">
- <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
- <a id="glm-settings" data-show-table="glm-table-settings" class="glm-settings-tab nav-tab{if $option=='settings'} nav-tab-active{/if}">Custom Fields</a>
- </h2>
-
- <!-- Add Custom Field Button and Dialog Box -->
- <div id="newFieldButton" class="button button-primary glm-right">Add a Custom Field</div>
- <div id="newFieldDialog" class="glm-dialog-box" title="Enter a New Custom Field">
- <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="fields">
- <input type="hidden" name="option" value="addNew">
-
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Field Name:</th>
- <td>
- <input type="text" name="field_name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th class="glm-required">Field Type:</th>
- <td>
- <select name="field_type">
- {foreach $field_types as $val => $label}
- <option value="{$val}">{$label}</option>
- {/foreach}
- </select>
- </td>
- </tr>
- <tr>
- <th>Admin Searchable</th>
- <td>
- <input type="hidden" name="admin_search" value="0" />
- <input type="checkbox" name="admin_search" value="1" />
- (text or checkbox only)
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newFieldCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new Custom Field" class="button button-primary">
- </form>
- </div>
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Field Name:</th>
+ <td>
+ <input type="text" name="field_name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th class="glm-required">Field Type:</th>
+ <td>
+ <select name="field_type">
+ {foreach $field_types as $val => $label}
+ <option value="{$val}">{$label}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Admin Searchable</th>
+ <td>
+ <input type="hidden" name="admin_search" value="0" />
+ <input type="checkbox" name="admin_search" value="1" />
+ (text or checkbox only)
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newFieldCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new Custom Field" class="button button-primary">
+ </form>
+</div>
- <!-- Delete Field Button and Dialog Box -->
- <div id="deleteFieldDialog" class="glm-dialog-box" title="Delete Field">
- <center>
- <p>Are you sure you want to delete this field?</p>
- <p><div id="deleteFieldConfirm" class="button button-primary">Yes, delete this field</div></p>
- <p><div id="deleteFieldCancel" class="button button-primary">Cancel</div></p>
- </center>
- </div>
+<!-- Delete Field Button and Dialog Box -->
+<div id="deleteFieldDialog" class="glm-dialog-box" title="Delete Field">
+ <center>
+ <p>Are you sure you want to delete this field?</p>
+ <p><div id="deleteFieldConfirm" class="button button-primary">Yes, delete this field</div></p>
+ <p><div id="deleteFieldCancel" class="button button-primary">Cancel</div></p>
+ </center>
+</div>
- <!-- Edit Field Dialog Box -->
- <div id="editFieldDialog" class="glm-dialog-box" title="Edit this Field">
- <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="fields">
- <input type="hidden" name="option" value="update">
- <input id="editFieldID" type="hidden" name="id" value="">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Field Name:</th>
- <td>
- <input id="editFieldName" type="text" name="field_name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th class="glm-required">Field Type:</th>
- <td>
- <select id="editFieldType" name="field_type">
- {foreach $field_types as $val => $label}
- <option value="{$val}">{$label}</option>
- {/foreach}
- </select>
- </td>
- </tr>
- <tr>
- <th>Admin Searchable</th>
- <td>
- <input type="hidden" name="admin_search" value="0" />
- <input type="checkbox" id="editAdminSearch" name="admin_search" value="1" />
- (text or checkbox only)
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="editFieldCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this Field">
- </form>
- </div>
- <table id="glm-table-settings" class="glm-admin-table glm-settings-table{if $option!='settings'} glm-hidden{/if}">
- <tr>
- <td colspan="2">
- {if $settingsUpdated}<h2 class="glm-notice glm-flash-updated glm-right">Settings Updated</h2>{/if}
- {if $settingsUpdateError}<span class="glm-error glm-flash-updated glm-right">Settings Update Error</span>{/if}
- <h2>Custom Fields</h2>
- </td>
- </tr>
- </table>
- <table id="glm-table-settings" class="glm-admin-table glm-settings-table">
- <thead>
+<!-- Edit Field Dialog Box -->
+<div id="editFieldDialog" class="glm-dialog-box" title="Edit this Field">
+ <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="import">
+ <input type="hidden" name="option" value="customfields">
+ <input type="hidden" name="option2" value="update">
+ <input id="editFieldID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Field Name:</th>
+ <td>
+ <input id="editFieldName" type="text" name="field_name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th class="glm-required">Field Type:</th>
+ <td>
+ <select id="editFieldType" name="field_type">
+ {foreach $field_types as $val => $label}
+ <option value="{$val}">{$label}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
<tr>
- <th>ID</th>
- <th>Field</th>
- <th>Type</th>
- <th> </th>
+ <th>Admin Searchable</th>
+ <td>
+ <input type="hidden" name="admin_search" value="0" />
+ <input type="checkbox" id="editAdminSearch" name="admin_search" value="1" />
+ (text or checkbox only)
+ </td>
</tr>
- </thead>
- <tbody>
- {if $haveCustomFields}
- {assign var="i" value="0"}
- {foreach $custom_fields as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editFieldCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Field">
+ </form>
+</div>
+<table id="glm-table-settings" class="glm-admin-table glm-settings-table{if $option2!='settings'} glm-hidden{/if}">
+ <tr>
+ <td colspan="2">
+ {if $settingsUpdated}<h2 class="glm-notice glm-flash-updated glm-right">Settings Updated</h2>{/if}
+ {if $settingsUpdateError}<span class="glm-error glm-flash-updated glm-right">Settings Update Error</span>{/if}
+ <h2>Custom Fields</h2>
+ </td>
+ </tr>
+</table>
+<table id="glm-table-settings" class="glm-admin-table glm-settings-table">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Field</th>
+ <th>Type</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+ {if $haveCustomFields}
+ {assign var="i" value="0"}
+ {foreach $custom_fields as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
<td>{$t.id}</td>
<td>
<div>
</td>
</tr>
{/foreach}
- {else}
+ {else}
<tr class="alternate"><td colspan="2">(no custom fields listed)</td></tr>
- {/if}
- </tbody>
- </table>
- <!-- Tests -->
+ {/if}
+ </tbody>
+</table>
+<!-- Tests -->
<script type="text/javascript">
jQuery(document).ready(function($) {
});
$('#deleteFieldConfirm').click( function() {
$("#deleteFieldDialog").dialog("close");
- window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=fields&option=delete&id=" + id;
+ window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=import&option=customfields&option2=delete&id=" + id;
});
$('#deleteFieldCancel').click( function() {
$("#deleteFieldDialog").dialog("close");