From: Steve Sutton Date: Tue, 17 Oct 2017 16:05:18 +0000 (-0400) Subject: Updating the custom field management tab to be under the member management. X-Git-Tag: v1.0.4^2~40 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=621a5b86ce2a2ccded1398728cc5f885fb8eef3a;p=WP-Plugins%2Fglm-member-db-fields.git Updating the custom field management tab to be under the member management. Adding new filters for: active, edit, form, capture, and data. --- diff --git a/models/admin/management/fields.php b/models/admin/management/fields.php index 9d943cd..2ce537a 100644 --- a/models/admin/management/fields.php +++ b/models/admin/management/fields.php @@ -117,15 +117,14 @@ class GlmMembersAdmin_management_fields extends GlmDataFieldsCustomFields */ public function modelAction($actionData = false) { - $option = false; $settings_updated = false; $settings_update_error = false; $custom_fields = false; $haveCustomFields = false; - if (isset($_REQUEST['option'])) { - $option = $_REQUEST['option']; + if (isset($_REQUEST['option2'])) { + $option = $_REQUEST['option2']; } // Check if a field ID is supplied @@ -187,7 +186,7 @@ class GlmMembersAdmin_management_fields extends GlmDataFieldsCustomFields // Compile template data $template_data = array( - 'option' => $option, + 'option2' => $option, 'settingsUpdated' => $settings_updated, 'settingsUpdateError' => $settings_update_error, 'custom_fields' => $custom_fields, diff --git a/setup/adminHooks.php b/setup/adminHooks.php index c020b98..1b83e06 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -25,6 +25,42 @@ * * 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 = 'Custom Fields'; return $out; diff --git a/setup/adminTabs.php b/setup/adminTabs.php index 1a1447e..d77793a 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -34,21 +34,21 @@ */ // If user can manage all members if (current_user_can('glm_members_members')) { - add_filter('glm-member-db-add-tab-for-management', - function($addOnTabs) { - $newTabs = array( - array( - 'text' => 'Custom Fields', - 'menu' => 'fields', - 'action' => 'fields', - 'option' => 'list' - ), - - ); - $addOnTabs = array_merge($addOnTabs, $newTabs); - return $addOnTabs; - } - ); + // add_filter('glm-member-db-add-tab-for-management', + // function($addOnTabs) { + // $newTabs = array( + // array( + // 'text' => 'Custom Fields', + // 'menu' => 'fields', + // 'action' => 'fields', + // 'option' => 'list' + // ), + // + // ); + // $addOnTabs = array_merge($addOnTabs, $newTabs); + // return $addOnTabs; + // } + // ); } if (current_user_can('glm_members_management')) { add_filter('glm-member-db-add-tab-for-import', diff --git a/setup/validActions.php b/setup/validActions.php index 086f431..3c2be84 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -65,6 +65,9 @@ $glmMembersFieldsAddOnValidActions = array( 'ajax' => array( 'filterSearch' => GLM_MEMBERS_FIELDS_PLUGIN_SLUG, ), + 'fields' => array( + 'fields' => GLM_MEMBERS_FIELDS_PLUGIN_SLUG, + ), 'management' => array( 'fields' => GLM_MEMBERS_FIELDS_PLUGIN_SLUG, ), diff --git a/views/admin/management/fields.html b/views/admin/management/fields.html index 831bc91..a386da1 100644 --- a/views/admin/management/fields.html +++ b/views/admin/management/fields.html @@ -1,121 +1,117 @@ -{include file='admin/management/header.html'} + +
Add a Custom Field
+
+
+ + + - - - -
Add a Custom Field
-
- - - - - - - - - - - - - - - - - -
Field Name: - -
Field Type: - -
Admin Searchable - - - (text or checkbox only) -
-

* Required

- Cancel - - -
+ + + + + + + + + + + + + +
Field Name: + +
Field Type: + +
Admin Searchable + + + (text or checkbox only) +
+

* Required

+ Cancel + + +
- -
-
-

Are you sure you want to delete this field?

-

Yes, delete this field

-

Cancel

-
-
+ +
+
+

Are you sure you want to delete this field?

+

Yes, delete this field

+

Cancel

+
+
- -
-
- - - - - - - - - - - - - - - - -
Field Name: - -
Field Type: - -
Admin Searchable - - - (text or checkbox only) -
-

* Required

- Cancel - -
-
- - - - -
- {if $settingsUpdated}

Settings Updated

{/if} - {if $settingsUpdateError}Settings Update Error{/if} -

Custom Fields

-
- - + +
+
+ + + + +
+ + + + + + + + - - - - + + - - - {if $haveCustomFields} - {assign var="i" value="0"} - {foreach $custom_fields as $t} - {if $i++ is odd by 1} - - {else} - - {/if} +
Field Name: + +
Field Type: + +
IDFieldType Admin Searchable + + + (text or checkbox only) +
+

* Required

+ Cancel + + + + + + + +
+ {if $settingsUpdated}

Settings Updated

{/if} + {if $settingsUpdateError}Settings Update Error{/if} +

Custom Fields

+
+ + + + + + + + + + + {if $haveCustomFields} + {assign var="i" value="0"} + {foreach $custom_fields as $t} + {if $i++ is odd by 1} + + {else} + + {/if} {/foreach} - {else} + {else} - {/if} - -
IDFieldType 
{$t.id}
@@ -130,12 +126,12 @@
(no custom fields listed)
- + {/if} + + +