Author Topic: [SOLVED] New user notice email only sent to Super Admin  (Read 2304 times)

onlinestorenut

  • Beginner
  • *
  • Posts: 22
    • Web Design
[SOLVED] New user notice email only sent to Super Admin
« on: January 13, 2011, 05:49:46 am »
Hi,

I have a Super Admin and normal Admin accounts, both set to Receive System Emails.
However, when a user registers via the normal VM registration process, only my Super Admin receives the new user notice email.

I originally thought it was something in Joomla (http://forum.joomla.org/viewtopic.php?f=431&t=503445&p=2373927#p2373927) but they're saying VM has it's own registration process.

I've tried to work this out myself and got as far as thinking it's something to so with a submitregistration() function and/or ps_userfield.php but I can't even find the submitregistration function or anything to do with emailing super admins in that PHP file. I'm now completely stuck.

Does anyone know which file in VM emails the Super Admins when a user registers? I need to change it so that it emails normal Admin as well.

Thanks,
Bob.

onlinestorenut

  • Beginner
  • *
  • Posts: 22
    • Web Design
Re: New user notice email only sent to Super Admin
« Reply #1 on: January 13, 2011, 23:57:32 pm »
Just wondering if anyone has an idea on this please?

Basically all I need is my Admins, as well as Super Admins, to be emailed when a user registers on my website via the VM registration process.

onlinestorenut

  • Beginner
  • *
  • Posts: 22
    • Web Design
Re: New user notice email only sent to Super Admin
« Reply #2 on: January 14, 2011, 02:52:48 am »
I finally found the solution (had to do a file search for all files containing the text 'super admin' then checked each one!!!).

The code which emails Super Admins is in PS_SHOPPER.PHP

PLEASE NOTE: This is a core HACK. You'll probably have to re-do when you upgrade VM.

Around line 828, there a bit of code which gets the Super Admins ID for the email notice.

Code: [Select]
// get superadministrators id
$admins = $acl->get_group_objects( 25, 'ARO' );
if( empty( $admins['users'] )) {
return;
}
foreach ( $admins['users'] AS $id ) {
$query = "SELECT email, sendEmail"
. "\n FROM #__users"
."\n WHERE id = $id"
;
$database->setQuery( $query );
$rows = $database->loadObjectList();

$row = $rows[0];

if ($row->sendEmail) {
vmMail($adminEmail2, $adminName2, $row->email, $subject2, $message2);
}
}

This isn't elegant at all but I copied that section directly below it and changed the

Code: [Select]
$admins = $acl->get_group_objects( 25, 'ARO' );
to

Code: [Select]
$admins = $acl->get_group_objects( 24, 'ARO' );(24 returns normal Admins)

Code: [Select]
So, I end up with;

// get superadministrators id
$admins = $acl->get_group_objects( 25, 'ARO' );
if( empty( $admins['users'] )) {
return;
}
foreach ( $admins['users'] AS $id ) {
$query = "SELECT email, sendEmail"
. "\n FROM #__users"
."\n WHERE id = $id"
;
$database->setQuery( $query );
$rows = $database->loadObjectList();

$row = $rows[0];

if ($row->sendEmail) {
vmMail($adminEmail2, $adminName2, $row->email, $subject2, $message2);
}
}

// get administrators id
$admins = $acl->get_group_objects( 24, 'ARO' );
if( empty( $admins['users'] )) {
return;
}
foreach ( $admins['users'] AS $id ) {
$query = "SELECT email, sendEmail"
. "\n FROM #__users"
."\n WHERE id = $id"
;
$database->setQuery( $query );
$rows = $database->loadObjectList();

$row = $rows[0];

if ($row->sendEmail) {
vmMail($adminEmail2, $adminName2, $row->email, $subject2, $message2);
}
}