From: Steve Sutton Date: Fri, 12 Apr 2019 20:52:16 +0000 (-0400) Subject: Notes for groups X-Git-Tag: v2.12.2^2~14^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=382b65b832761ff441fa1b9133fb224bddcc0465;p=WP-Plugins%2Fglm-member-db.git Notes for groups Docs for the group functions for resetting the fields array. Not completely working correctly. --- diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index 85b62807..a4ee145e 100755 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -75,6 +75,8 @@ class GlmDataSettingsGeneral extends GlmDataAbstract */ public $fields = false; + public $groupSelect = false; + /** * Constructor * diff --git a/lib/GlmDataAbstract/DataAbstract.php b/lib/GlmDataAbstract/DataAbstract.php index 00162c4a..f931a5f8 100755 --- a/lib/GlmDataAbstract/DataAbstract.php +++ b/lib/GlmDataAbstract/DataAbstract.php @@ -3724,6 +3724,7 @@ $forEdit = true; */ public function updateEntry($id, $idField = 'id', $store = true, $fieldPrefix = '') { + $this->selectGroupFields(); // Store any input field prefix $this->fieldPrefix = $fieldPrefix; @@ -3795,6 +3796,7 @@ $forEdit = true; } + $this->restoreFields(); return $r; } @@ -4210,6 +4212,7 @@ $forEdit = true; public function selectGroupFields() { if ( $this->groupSelect && is_array( $this->groupSelect ) && !empty( $this->groupSelect ) ) { + // Clean the array of fields $this->saveFields = $this->fields; $this->fields = false; @@ -4219,10 +4222,10 @@ $forEdit = true; foreach ( $this->groupSelect as $groupSelected ) { // Find the group if ( isset( $this->groups[$groupSelected] ) && $this->groups[$groupSelected] ) { - trigger_error( print_r( $this->groups[$groupSelected], true ), E_USER_NOTICE ); + // trigger_error( print_r( $this->groups[$groupSelected], true ), E_USER_NOTICE ); if ( isset( $this->groups[$groupSelected]['fields'] ) && is_array( $this->groups[$groupSelected]['fields'] ) ) { foreach ( $this->groups[$groupSelected]['fields'] as $fieldKey => $field ) { - trigger_error( print_r( $field, true ), E_USER_NOTICE ); + // trigger_error( print_r( $field, true ), E_USER_NOTICE ); $this->fields[] = $this->saveFields[$field['name']]; } } @@ -4234,6 +4237,6 @@ $forEdit = true; public function restoreFields() { $this->fields = $this->saveFields; - $this->saveFields = false; + // $this->saveFields = false; } }