Katipo
Search  
Site Blog
  About  
  Home
About Portfolio Solutions Client Area Contact Us
: : About Us
Awards
Jobs
Our People
What Is A ... ?
Working From Home
News
Photo Gallery
Katipo Blog


Joomla vetting new signups

A few sites that we have been working on wanted an extra step with the signup process on their website that requires an additional level of vetting by the site administrator when a new user submits the online form. To achieve this we made some minor changes to the core code.

The following change removes the activation link from the email issued to the user and sends them an email notification that their application has been received.
From the root of your Joomla site, go to /components/com_user/controller.php (approx line 367) and add:

// Email the user that they have been vetted
$mailfrom = $mainframe->getCfg(’mailfrom’);
$fromname = $mainframe->getCfg(’fromname’);
$email = $euser->email;
$siteURL = JURI::base();
$subject = “Vetting Accepted for [sitename]“;
$message2 = sprintf(JText::_(’REG_ACTIVATE_COMPLETE_USER’),$siteURL);
JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message2);
// *** END Email the user that they have been vetted

We also need to change…

if (JUserHelper::activateUser($activation))

to:

if ($euser = JUserHelper::activateUser($activation))

The next bit of code emails the account activation link and details through to the site administrator, who gets to decide if the application is successful.
From the root of your Joomla site, go to /components/com_user/controller.php (approx line 524) and change to:

// *** Added Site Admin activation link
if ( $useractivation == 1 ){
// $message = sprintf ( JText::_( ‘SEND_MSG_ACTIVATE’ ), $name, $sitename, $siteURL.”index.php?option=com_user&task=activate&activation=”.$user->get(’activation’), $siteURL, $username, $password);
$message = sprintf ( JText::_( ‘SEND_MSG_ACTIVATE’ ), $name, $sitename, $siteURL.”index.php?option=com_user&task=activate&activation=”.$user->get(’activation’));
$message2 = sprintf ( JText::_( ‘SEND_MSG_USER’ ), $name, $sitename, $siteURL, $username, $password);
} else {
$message = sprintf ( JText::_( ‘SEND_MSG’ ), $name, $sitename, $siteURL);
$message2 = ”;
}
// *** END Added Site Admin activation link

We then need to pass both user and admin notifications through to the script that generates and sends emails.
From the root of your Joomla site, go to /components/com_user/controller.php (approx line 548) Added:

// *** Added send User AND Admin notification
JUtility::sendMail($mailfrom, $fromname, $mailfrom, $subject, $message);
JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message2);
// JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message); // old line
// *** END Added send User AND Admin notification

Joomla now issues 2 emails when the signup form is submitted, rather than the usual one.

Some final changes are needed to the language files on the site, so that the email notifications make sense. Make the following changes. From the root of your Joomla site, go to

/language/en-GB/en-GB.com_user.ini (approx line 84) and change:

REG_ACTIVATE_COMPLETE=The Account has been successfully activated. The user has been sent an email and they now can log in.

/language/en-GB/en-GB.com_user.ini (approx line 85) and change:

REG_ACTIVATE_COMPLETE_USER=Congratulations, your application to join the [sitename] website has been approved.\n\nYou can now use the login details you entered when registered to log in at %s

/language/en-GB/en-GB.com_user.ini (approx line 92) and change:

REG_COMPLETE_ACTIVATE=Your account has been created and now is awaiting the vetting process – you should get an email containing your username and password. Once you are vetted you will use these to login.

/language/en-GB/en-GB.com_user.ini (approx line 120) and change:

SEND_MSG_ACTIVATE=The following person %s has registered at %s. Their account activation link is that needs to be copied into your browser:\n%s\n\nAfter activation they will be able to login.
SEND_MSG_USER=Hello %s,\n\nThank you for registering at %s. Your account is currently waiting to be vetted.\nYou will be notified by email once it is approved by an administrator.\nYou may then login to %s using the following username and password:\n\nUsername: %s\nPassword: %s

Finally, the User() helper function needs to be updated so that the activation confirmation email is sent to the user in question rather than the user currently logged into joomla (eg site administrator): To do that, go to:

/libraries/joomla/user/helper.php (line 72) Added:
// *** Added send confirmation to user not admin
// return true;
return $user;
// *** END Added send confirmation to user not admin

2 Responses to “Joomla vetting new signups”

  1. br3nda Says:

    now that you’ve edited core, how will you upgrade?? will you be merging in changes, resolving conflicts every time there’s a new release?
    or are you going to get these changes back into joomla upstream?

  2. bob Says:

    Hi br3nda,

    Yeah hacking the core is not the best idea but sometimes deadlines force ones hand. I will endeavour to get the concept of vetting back upstream into joomla but in a more ‘choose it as an option’ kind of way.

    So I am thinking of adding a whitepaper outlining why/how joomla would need vetting of signups as a process so that others can discuss their ideas as well.

Leave a Reply

You must be logged in to post a comment.


Katipo
Rachel Snowboarding