Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla send a email to admin when new user signup
Hello friends,
Can anybody help me in this:
I want a mod with which a email is sent (by vanilla installation) to site admin when a new user signup ...BUT in vanilla registration, when it is set that user should be promoted to member role right after signup!
Anybody can suggest something??
Thanks alot for your help
Can anybody help me in this:
I want a mod with which a email is sent (by vanilla installation) to site admin when a new user signup ...BUT in vanilla registration, when it is set that user should be promoted to member role right after signup!
Anybody can suggest something??
Thanks alot for your help
0
This discussion has been closed.
Comments
function ForceAdminEmail($UserManager) { // Fool Vanilla into thinking that immediate access is not allowed $UserManager->Context->Configuration['ALLOW_IMMEDIATE_ACCESS'] = 0; } $Context->AddToDelegate('UserManager', 'PostRoleAssignment', 'ForceAdminEmail');
Thanks for the code, but its not working :-(
After installing, it again set the registration process.. user signup --> Admin approve it (AND no email to admin is sent) BUT i have set it user signup ---> he can login right away
After removing, everything is back to normal.. but anyways thanks for trying :-D
any other guess?!? ;-)
function ForceAdminEmail(&$UserManager) { $s = $UserManager->DelegateParameters['SqlBuilder']; $User = $UserManager->DelegateParameters['User']; // Following copied from people/UserManager.php and references to $this were changed to $UserManager $s->Clear(); $s->SetMainTable('User', 'u'); $s->AddJoin('Role', 'r', 'RoleID', 'u', 'RoleID', 'inner join'); $s->AddWhere('r', 'PERMISSION_RECEIVE_APPLICATION_NOTIFICATION', '', 1, '='); $s->AddWhere('u', 'SendNewApplicantNotifications', '', 1, '='); $s->AddSelect(array('Name', 'Email'), 'u'); $Administrators = $UserManager->Context->Database->Select($s, $UserManager->Name, 'CreateUser', 'An error occurred while retrieving administrator email addresses.', 0); // Fail silently if an error occurs while notifying administrators // Get the email body $File = $UserManager->Context->Configuration['LANGUAGES_PATH'] .$UserManager->Context->Configuration['LANGUAGE'] .'/email_applicant.txt'; $EmailBody = @file_get_contents($File); if ($EmailBody && $Administrators) { $EmailBody = str_replace( array( "{applicant_name}", "{applicant_email}", "{application_url}" ), array( $User->Name, $User->Email, ConcatenatePath( $UserManager->Context->Configuration['BASE_URL'], GetUrl($UserManager->Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction=Applicants') ) ), $EmailBody ); if ($UserManager->Context->Database->RowCount($Administrators) > 0) { $e = $UserManager->Context->ObjectFactory->NewContextObject($UserManager->Context, 'Email'); $e->HtmlOn = 0; $e->ErrorManager = &$UserManager->Context->ErrorManager; $e->WarningCollector = &$UserManager->Context->WarningCollector; $e->AddFrom($User->Email, $User->Name); $AdminEmail = ''; $AdminName = ''; while ($Row = $UserManager->Context->Database->GetRow($Administrators)) { $AdminEmail = ForceString($Row['Email'], ''); $AdminName = ForceString($Row['Name'], ''); if ($AdminEmail != '') $e->AddRecipient($AdminEmail, $AdminName); } $e->Subject = $UserManager->Context->GetDefinition("NewApplicant"); $e->Body = $EmailBody; $e->Send(0); } } }