* If not found use the member info record email.
* If nothing in either one then return.
*/
- public function sendMemberNotice( $memberId, $event )
+ public function sendMemberNotice( $memberId, $profile )
{
$member = $this->getEntry( $memberId );
// find notify_to
$memberInfoData = new GlmDataMemberInfo( $this->wpdb, $this->config );
$memberInfo = $memberInfoData->getActiveInfoForMember( $memberId );
// get settings
- $settings = $this->config['settings'];
+ $settings = $this->config['email_notifications'];
$notify_from = $settings['from_email'];
+ $message = $settings['approved_message'];
// Setup the Smarty Engine
$smarty = new smartyTemplateSupport();
- $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views';
+ $viewPath = GLM_MEMBERS_PLUGIN_PATH . '/views';
$smarty->template->setTemplateDir( $viewPath );
// Add standard parameters
require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
- $viewFile = 'admin/events/memberEmail.html';
+ $viewFile = 'admin/notifications/memberEmail.html';
- $eventList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-list&glm_action=list";
- $smarty->templateAssign( 'location', 'Member Events' );
- $smarty->templateAssign( 'name', $event['fieldData']['name'] );
- $smarty->templateAssign( 'pendingEvents', $eventList );
+ $memberList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-members-list";
+ $smarty->templateAssign( 'message', $message );
+ // $smarty->templateAssign( 'name', $event['fieldData']['name'] );
+ $smarty->templateAssign( 'pendingMembers', $memberList );
// Generate output from model data and view
$htmlMessage = $smarty->template->fetch( $viewFile );
*
* Sending email notice to the Admin user setting form Event Management.
*/
- public function sendAdminNotice( $memberId, $event )
+ public function sendAdminNotice( $memberId, $profile )
{
$member = $this->getEntry( $memberId );
- $settings = $this->config['settings'];
+ $settings = $this->config['email_notifications'];
$notify_to = $settings['to_email'];
$notify_from = $settings['from_email'];
- $notify_message = $settings['email_notification'];
+ $notify_message = $settings['notification_message'];
if ( !$notify_to ) {
return false;
}
// Setup the Smarty Engine
$smarty = new smartyTemplateSupport();
- $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views';
+ $viewPath = GLM_MEMBERS_PLUGIN_PATH . '/views';
$smarty->template->setTemplateDir( $viewPath );
// Add standard parameters
require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
- $viewFile = 'admin/events/ownerEmail.html';
+ $viewFile = 'admin/notifications/ownerEmail.html';
- $eventList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-index";
$smarty->templateAssign( 'notify_message', $notify_message);
- $smarty->templateAssign( 'location', 'Member Events' );
$smarty->templateAssign( 'member', $member );
- $smarty->templateAssign( 'name', $event['fieldData']['name'] );
- $smarty->templateAssign( 'pendingEvents', $eventList );
+ $smarty->templateAssign( 'name', $profile['reference_name'] );
// Generate output from model data and view
$htmlMessage = $smarty->template->fetch( $viewFile );
add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) );
// Set the Reply-To to use Admin Contact E-Mail
- $replyTo = ( $event['fieldData']['admin_email'] ) ? $event['fieldData']['admin_email']: $notify_from;
- $subject = 'Event Form Submission';
+ $replyTo = $notify_from;//( $event['fieldData']['admin_email'] ) ? $event['fieldData']['admin_email']: $notify_from;
+ $subject = $this->config['terms']['term_member_cap'] . ' Update Request';
$message = $htmlMessage;
$header[] = 'From:' . $notify_from;
$header[] = 'Reply-To:' . $replyTo;
// if we have the database setup already (activated) - Read in Settings and Terms from database
if ($glmMembersDatabaseDbVersion) {
+ // Setup for settings
$settings = $wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "settings_general WHERE id = 1;", ARRAY_A);
unset($settings['id']);
$config['settings'] = $settings;
+
+ // Setup for terms
$terms = $wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "settings_terms WHERE id = 1;", ARRAY_A);
unset($terms['id']);
$config['terms'] = $terms;
+ // Setup for email_notifications
+ $email_notifications = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "email_notifications WHERE id = 1", ARRAY_A );
+ unset($email_notifications['id']);
+ $config['email_notifications'] = $email_notifications;
+
// Add Debug defines - These can't go into the defines.php file - Guess why.
define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', $settings['admin_debug']);
define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', $settings['admin_debug_verbose']);
status[30] = 'Draft'
status[90] = 'Archived'
-status_numb['Active'] = 10
-status_numb['Pending'] = 20
+status_numb['Active'] = 10
+status_numb['Pending'] = 20
+status_numb['Draft'] = 30
status_numb['Inactive'] = 30
status_numb['Archived'] = 90
* @version 0.1
*/
-// Load Members data abstract
-require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php';
+// Load Members data abstracts
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMembers.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMemberInfo.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataCategories.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataCategoryMemberInfo.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataCities.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataImages.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataFiles.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataAmenities.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/glmMemberInfoClone.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/helper/notification.php';
/**
* This class performs the work for the default action of the "Members" menu
}
// Get member base data
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php';
$Members = new GlmDataMembers($this->wpdb, $this->config);
$this->memberData = $Members->getEntry($this->memberID);
$this->fields['logo']['i_prefix'] = 'memb_'.$this->memberID.'_';
* These will be sorted so sub-categories fall under their
* respective category.
*/
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php';
$Categories = new GlmDataCategories($this->wpdb, $this->config);
$categories = $Categories->getListSortedParentChild();
$categories2 = $Categories->getListSortedParentChild(false);
// Process submission of a member information record update
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>';
+ $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->updateAmenities();
// Load Image data class
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php';
$Images = new GlmDataImages($this->wpdb, $this->config);
// Load File data class
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataFiles.php';
$Files = new GlmDataFiles( $this->wpdb, $this->config );
// Update image gallery titles, descriptions, and image positions then return current image gallery
} else {
}
-// print_r($customFieldResults);
+
+ // Clear out shortcode cache for members
glmClearShortcodeCache();
break;
case 'clone':
// Load Member Info Clone Class
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmMemberInfoClone.php';
$CloneMemberInfo = new GlmMemberInfoClone($this->wpdb, $this->config);
$oldId = $this->memberInfoID;
}
// Get list of Available Member Amenities to use for picklists
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php';
$Amenities = new GlmDataAmenities($this->wpdb, $this->config);
$this->amenities = $Amenities->getList("T.ref_type = ".$this->config['ref_type_numb']['MemberInfo']);
if ($this->memberInfoID) {
// Also, if this is not a create, get any image gallery images
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php';
$Images = new GlmDataImages($this->wpdb, $this->config);
$this->imageGallery = $Images->getGallery($this->config['ref_type_numb']['MemberInfo'], $this->memberInfoID);
$this->haveImageGallery = ($this->imageGallery != false);
// Also, if this is not a create, get any files
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataFiles.php';
$Files = new GlmDataFiles( $this->wpdb, $this->config );
$this->files = $Files->getFiles( $this->config['ref_type_numb']['MemberInfo'], $this->memberInfoID );
$this->haveFiles = ($this->files != false);
$cName = trim(filter_var($_REQUEST['newCityName']));
// Try to add the city
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php';
$Cities = new GlmDataCities($this->wpdb, $this->config);
$cID = $Cities->addCity($cName);
$cName = trim(filter_var($_REQUEST['newMailingCityName']));
// Try to add the mailing_city
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php';
$Cities = new GlmDataCities($this->wpdb, $this->config);
$cID = $Cities->addCity($cName);
{
// Instatiate the dataCategories class
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php';
$Categories = new GlmDataCategories($this->wpdb, $this->config);
// Instatiate categoryMemberInfo class
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php';
$CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config);
// Get any selected categories
{
// Instantiate Amenities data class
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php';
$Amenities = new GlmDataAmenities($this->wpdb, $this->config);
$selectedAmenities = array();
<a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}">{$m.name}</a>
</td>
<td style="width: 120px;">
+ {if $m.active_id}
<a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$m.id}&memberInfo={$m.active_id}" class="button button-secondary glm-button-small glm-admin-edit-active-profile" style="margin: 0 .2em 0 .2em;">Edit Active Profile</a>
+ {/if}
</td>
<td style="width: 120px;">
<a href="{$siteBaseUrl}{$settings.canonical_member_page}/{$m.member_slug}/" target="_blank">View Profile</a>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ </head>
+ <body>
+ <h1 id="title"> {$terms.term_member_cap} Approval Notification</h1>
+
+ {if $message}
+ <div style="width: 500px">
+ <p> {$message} </p>
+ </div>
+ {/if}
+
+ <table cellspacing="0" cellpadding="0" width="500" style="background: lightgrey;border:1px solid #ccc;border-collapse:collapse;">
+ <tr>
+ <td style="font-weight:bold;width:200px;padding:5px;border:1px solid #ccc;">{$terms.term_member_cap} Name:</td>
+ <td style="width:200px;padding:5px;border:1px solid #ccc;">{$name}</td>
+ </tr>
+ </table>
+
+ <div id="emailFooter">
+ <p style="margin-bottom: 0px;">A {$terms.term_member_cap} has been approved.</p>
+ <p style="margin-top: 0px;">To view it, please go to the <a style="color: rgb(5, 104, 179);" href="{$pendingMembers}"> {$terms.term_member} </a> page in your admin.</p>
+ </div>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ </head>
+ <body>
+ <h1 id="title"> {$terms.term_member_cap} Submission Notification</h1>
+
+ {if $notify_message}
+ <div style="width: 500px">
+ <p> {$notify_message} </p>
+ </div>
+ {/if}
+
+ <table cellspacing="0" cellpadding="0" width="500" style="background: lightgrey;border:1px solid #ccc;border-collapse:collapse;">
+ <tr>
+ <td style="font-weight:bold;width:200px;padding:5px;border:1px solid #ccc;">Member Name:</td>
+ <td style="width:200px;padding:5px;border:1px solid #ccc;">{$member.name}</td>
+ </tr>
+ <tr>
+ <td style="font-weight:bold;width:200px;padding:5px;border:1px solid #ccc;">Profile Name:</td>
+ <td style="width:200px;padding:5px;border:1px solid #ccc;">{$name}</td>
+ </tr>
+ </table>
+
+ <div id="emailFooter">
+ <p style="margin-top: 0px;"></p>
+ </div>
+ </body>
+</html>