Skip to Content Skip to Menu

Registration Email Hack

  • Flagio
  • Flagio
  • OFFLINE
  • Posts: 12
  • Thanks: 0
  • Karma: 0
16 years 11 months ago #39772 by Flagio
Registration Email Hack was created by Flagio
I wanted to use a different email address for registrations then the default system email account. So that's why I changed some things in code.
Note: I'm no experienced programmer, so backup first please.
Oh I don't know if it makes a difference: in my setup users don't have to confirm their email address, and admins should aprove new accounts...

First create an extra field in Comprofiler Field Manager:
cb_registrationmail
- Type: Check box (single)
- Required?: No
- Show on Profile?: No
- User Read Only?: Yes
- Show at Registration?: No
- Published: Yes

I put this field in a hidden tab (unpublished). I don't want people to change this field.

Create a new user account with Super Administrator rights (I think otherwise it won't work). In phpMyAdmin I set this cb_registrationmail field to 1 in this new user account.

/administrator/components/com_comprofiler/comprofiler.class.php

after function sendToModerators add this new function:

[code:1] function sendToRegMail( $sub, $message ) {
global $database,$ueConfig;
$database->setQuery( "SELECT u.id FROM #__users u INNER JOIN #__comprofiler c ON u.id=c.id"
."\n WHERE u.gid IN (".implode(',',getParentGIDS($ueConfig))."«») AND u.block=0 AND c.confirmed=1 AND c.approved=1 AND c.cb_registrationmail=1" );
$mods = $database->loadObjectList();
foreach ($mods AS $mod) {
$this->sendFromSystem($mod->id, $sub, $message, false);
}

}[/code:1]

/components/com_comprofiler/comprofiler.php

from:

[code:1] $user[0]->password = $pwd_md5;
if($modSub!=null) {
if($ueConfig) {
$cbNotification->sendToModerators($modSub,$cbNotification->_replaceVariables($modMSG,$user[0]));
}
}[/code:1]

to:

[code:1] $user[0]->password = $pwd_md5;
if($modSub!=null) {
if($ueConfig) {
// $cbNotification->sendToModerators($modSub,$cbNotification->_replaceVariables($modMSG,$user[0]));
$cbNotification->sendToRegMail($modSub,$cbNotification->_replaceVariables($modMSG,$user[0]));
}
}[/code:1]

Now when someone registers the registration email with all details go to the email address of above newly created account. Could be several email addresses if you set the 'cb_registrationmail' field on multiple accounts to 1.

Success!

Please Log in or Create an account to join the conversation.

  • guilliam
  • guilliam
  • OFFLINE
  • Posts: 54
  • Thanks: 0
  • Karma: 9
16 years 10 months ago #40992 by guilliam
Replied by guilliam on topic Re:Registration Email Hack
thanks for sharing :)

- g

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum

Facebook Twitter LinkedIn