comparison forum/Sources/Subs-Post.php @ 77:b31c38a09c41 website

Add justification text in registration
author Chris Cannam
date Sun, 07 Jul 2013 11:57:22 +0200
parents e3e11437ecea
children
comparison
equal deleted inserted replaced
76:e3e11437ecea 77:b31c38a09c41
3075 ); 3075 );
3076 } 3076 }
3077 } 3077 }
3078 3078
3079 // This simple function gets a list of all administrators and sends them an email to let them know a new member has joined. 3079 // This simple function gets a list of all administrators and sends them an email to let them know a new member has joined.
3080 function adminNotify($type, $memberID, $member_name = null) 3080 function adminNotify($type, $memberID, $member_name = null, $justify = null)
3081 { 3081 {
3082 global $txt, $modSettings, $language, $scripturl, $user_info, $context, $smcFunc; 3082 global $txt, $modSettings, $language, $scripturl, $user_info, $context, $smcFunc;
3083 3083
3084 // If the setting isn't enabled then just exit. 3084 // If the setting isn't enabled then just exit.
3085 if (empty($modSettings['notify_new_registration'])) 3085 if (empty($modSettings['notify_new_registration']))
3086 return; 3086 return;
3087 3087
3088 $member_email = null;
3089
3088 if ($member_name == null) 3090 if ($member_name == null)
3089 { 3091 {
3090 // Get the new user's name.... 3092 // Get the new user's name....
3091 $request = $smcFunc['db_query']('', ' 3093 $request = $smcFunc['db_query']('', '
3092 SELECT real_name 3094 SELECT real_name, email_address
3093 FROM {db_prefix}members 3095 FROM {db_prefix}members
3094 WHERE id_member = {int:id_member} 3096 WHERE id_member = {int:id_member}
3095 LIMIT 1', 3097 LIMIT 1',
3096 array( 3098 array(
3097 'id_member' => $memberID, 3099 'id_member' => $memberID,
3098 ) 3100 )
3099 ); 3101 );
3100 list ($member_name) = $smcFunc['db_fetch_row']($request); 3102 list ($member_name, $member_email) = $smcFunc['db_fetch_row']($request);
3101 $smcFunc['db_free_result']($request); 3103 $smcFunc['db_free_result']($request);
3102 } 3104 }
3103 3105
3104 $toNotify = array(); 3106 $toNotify = array();
3105 $groups = array(); 3107 $groups = array();
3140 ); 3142 );
3141 while ($row = $smcFunc['db_fetch_assoc']($request)) 3143 while ($row = $smcFunc['db_fetch_assoc']($request))
3142 { 3144 {
3143 $replacements = array( 3145 $replacements = array(
3144 'USERNAME' => $member_name, 3146 'USERNAME' => $member_name,
3147 'USEREMAIL' => $member_email,
3145 'PROFILELINK' => $scripturl . '?action=profile;u=' . $memberID 3148 'PROFILELINK' => $scripturl . '?action=profile;u=' . $memberID
3146 ); 3149 );
3147 $emailtype = 'admin_notify'; 3150 $emailtype = 'admin_notify';
3148 3151
3149 // If they need to be approved add more info... 3152 // If they need to be approved add more info...
3154 } 3157 }
3155 3158
3156 $emaildata = loadEmailTemplate($emailtype, $replacements, empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile']); 3159 $emaildata = loadEmailTemplate($emailtype, $replacements, empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile']);
3157 3160
3158 // And do the actual sending... 3161 // And do the actual sending...
3159 sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 0); 3162 sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'] . "\n\nJustification: $justify\n\n", null, null, false, 0);
3160 } 3163 }
3161 $smcFunc['db_free_result']($request); 3164 $smcFunc['db_free_result']($request);
3162 3165
3163 if (isset($current_language) && $current_language != $user_info['language']) 3166 if (isset($current_language) && $current_language != $user_info['language'])
3164 loadLanguage('Login'); 3167 loadLanguage('Login');