$smarty->template->setTemplateDir( $viewPath );
// Add standard parameters
- require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
+ require GLM_MEMBERS_PLUGIN_SETUP_PATH . '/standardTemplateParams.php';
$viewFile = 'admin/notifications/memberEmail.html';
- $memberList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-members-list";
+ $memberList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-member';
$smarty->templateAssign( 'message', $message );
- // $smarty->templateAssign( 'name', $event['fieldData']['name'] );
+ $smarty->templateAssign( 'name', $profile['reference_name'] );
$smarty->templateAssign( 'pendingMembers', $memberList );
// Generate output from model data and view
$smarty->template->setTemplateDir( $viewPath );
// Add standard parameters
- require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
+ require GLM_MEMBERS_PLUGIN_SETUP_PATH . '/standardTemplateParams.php';
$viewFile = 'admin/notifications/ownerEmail.html';
$smarty->templateAssign( 'notify_message', $notify_message);
$customFieldResults = false;
$multipleProfileEnabeled = $this->config['settings']['enable_multiple_profiles'];
$cloneType = 'CLONED';
+ $active_info = false;
// Check for action option - Should be one of the values in the "switch" statement below
$option = false;
case 'submit':
// Get the old status for this entry
- $old_entry = $this->getEntry( $this->memberInfoID );
- // echo '<pre>$old_entry: ' . print_r( $old_entry, true ) . '</pre>';
+ // Used after verifying data was saved
+ $old_entry = $this->getEntry( $this->memberInfoID );
$old_status = $old_entry['status']['value'];
- // echo '<pre>$old_status: ' . print_r( $old_status, true ) . '</pre>';
$new_status = isset( $_REQUEST['status'] ) ? $_REQUEST['status'] : null;
- // echo '<pre>$new_status: ' . print_r( $new_status, true ) . '</pre>';
- // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
-
- // echo '<pre>$this->config: ' . print_r( $this->config, true ) . '</pre>';
- // If a moderated user is going from Draft to Pending then send the admin notification
- if ( $lockedToMember && apply_filters( 'glm_user_is_moderated', $lockedToMember ) ) {
- $draft = $this->config['status_numb']['Draft'];
- // echo '<pre>$draft: ' . print_r( $draft, true ) . '</pre>';
- $pending = $this->config['status_numb']['Pending'];
- // echo '<pre>$pending: ' . print_r( $pending, true ) . '</pre>';
- if ( $new_status == $pending && $old_status == $draft ) {
- // TODO: Code to send admin notification here
- $Notifications = new GlmMembersAdmin_member_notification( $this->wpdb, $this->config );
- $settings = $this->config['email_notifications'];
- // Get the profile reference name
- $profile = array();
- $profile['reference_name'] = filter_var( $_REQUEST['reference_name'], FILTER_SANITIZE_STRING );
- $Notifications->sendAdminNotice( $this->memberID, $profile );
- echo '<pre>$settings: ' . print_r( $settings, true ) . '</pre>';
- }
- }
-
// Check for new cities being submitted
$this->checkNewCities();
$this->memberInfo = $this->updateEntry($this->memberInfoID, 'id', true);
if ($this->memberInfo['status']) {
+ // Status shortnames
+ $draft = $this->config['status_numb']['Draft'];
+ $pending = $this->config['status_numb']['Pending'];
+ $active = $this->config['status_numb']['Active'];
+
+ // Send out a notice to the member if going from
+ // Pending to Active status
+ if ( $new_status == $active && $old_status == $pending ) {
+ $Notifications = new GlmMembersAdmin_member_notification( $this->wpdb, $this->config );
+ // Get the profile reference name
+ $profile = array(
+ 'reference_name' => filter_var( $_REQUEST['reference_name'], FILTER_SANITIZE_STRING ),
+ );
+ $Notifications->sendMemberNotice( $this->memberID, $profile );
+ }
+
+ // If a moderated user is going from Draft to Pending then send the admin notification
+ if ( $lockedToMember && apply_filters( 'glm_user_is_moderated', $lockedToMember ) ) {
+ if ( $new_status == $pending && $old_status == $draft ) {
+ // Send admin notification
+ $Notifications = new GlmMembersAdmin_member_notification( $this->wpdb, $this->config );
+ // Get the profile reference name
+ $profile = array(
+ 'reference_name' => filter_var( $_REQUEST['reference_name'], FILTER_SANITIZE_STRING ),
+ );
+ $Notifications->sendAdminNotice( $this->memberID, $profile );
+ }
+ }
+
$customFieldResults = apply_filters( 'glm-member-db-save-custom-fields', $this->memberInfoID );
- if(is_array($customFieldResults)){
- $memberUpdated = false;
+ if ( is_array( $customFieldResults ) ) {
+ $memberUpdated = false;
$memberUpdateError = true;
} else {
- $memberUpdated = true;
+ $memberUpdated = true;
$memberUpdateError = false;
}
default:
// Edit the existing member
- $this->memberInfo = $this->editEntry($this->memberInfoID);
+ $this->memberInfo = $this->editEntry( $this->memberInfoID );
+
+ // Is this a pending member info record?
+ $pending = $this->config['status_numb']['Pending'];
+ if ( $this->memberInfo['fieldData']['status']['value'] == $pending ) {
+ // If pending then see if there's an Active record.
+ $active_info = $this->getActiveInfoIdForMember( $this->memberID );
+ if ( $active_info ) {
+ // We have a winner
+ }
+ }
break;
'time' => time(),
'slug' => GLM_MEMBERS_PLUGIN_SLUG,
'customFieldResults' => $customFieldResults,
- 'lockedToMember' => $lockedToMember
+ 'lockedToMember' => $lockedToMember,
+ 'active_info' => $active_info,
);
// Return status, suggested view, and data to controller