Gossamer Forum
Quote Reply
User_Edit_Profile (Andy)
Hello,

I'm using Andy's User_Edit_Profile Plugin. Does anyone know how to modify this
Plugin to send the Admin an email if a user profile is changed.

Or better yet, a setup like modify has, email and validation of changes.

Andy, any Idea!
Quote Reply
Re: [rascal] User_Edit_Profile (Andy) In reply to
Mmm... thats not really very simple :/ It would require a comparison of each field, which then gets logged into a database. The email option would be easier, as it would just require a few lines of code, and one template.

However, I'm **really** busy at the moment, so probably won't get this done today. Shoot me a PM tomorrow if I still havn't taken a look. I will try =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] User_Edit_Profile (Andy) In reply to
Thanks alot Andy, just getting an email with the changes would be fine.
Quote Reply
Re: [rascal] User_Edit_Profile (Andy) In reply to
Hi,

Sorry about the delay. This change should work :)

In profile.cgi, find;

Code:
$DB->table('Users')->update( $add, { Username => $user } ) || &error_msg($GT::SQL::error);

..and change to;

Code:
$DB->table('Users')->update( $add, { Username => $user } ) || &error_msg($GT::SQL::error);

email_changes($add,$user); # MOD!!!!

... and then at the very end of the script, add the following subroutine;

Code:
sub email_changes {

my ($hash_add,$user) = @_;

my $message = "Changes were made to $user's profile. They are as follows: \n\n" . Dumper($add);
my $to = $CFG->{db_admin_email};
my $name = "Admin";

my $subject = $CFG->{site_title} . " User Profile Change...";

require GT::Mail;
$GT::Mail::error ||= ''; # Silence -w
GT::Mail->send (
smtp => $CFG->{db_smtp_server},
sendmail => $CFG->{db_mail_path},
from => $CFG->{db_admin_email},
subject => $subject,
to => $to,
msg => $message,
debug => $Links::DEBUG,
type => 'text/html'
) or Links::fatal ("Unable to send mail: $GT::Mail::error");
}

That *should* do it :) Please note, this isn't tested... so may not work right away. I'm hoping it will though <G>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] User_Edit_Profile (Andy) In reply to
It's not working Andy,

" Internal Server Error"

Premature end of script headers
Global symbol "$add" requires explicit package name at profile.cgi line 131
Execution of profile.cgi aborted due to compilation errors
Quote Reply
Re: [rascal] User_Edit_Profile (Andy) In reply to
Sorry, change;

my ($hash_add,$user) = @_;

to;

my ($add,$user) = @_;

Should work then :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] User_Edit_Profile (Andy) In reply to
CoolThank you Andy, it works now.

Would it be possible to also have the username sent in the email?

That would give it the finishing touch!
Quote Reply
Re: [rascal] User_Edit_Profile (Andy) In reply to
Glad it works :)

To include the username, just change;

Code:
my $subject = $CFG->{site_title} . " User Profile Change...";

to...

Code:
my $subject = $CFG->{site_title} . " User Profile Change for $user";

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] User_Edit_Profile (Andy) In reply to
Cool Worked Great,

I may be contacting you, if I decide to import some dmoz links into my database. I may purchase your dmoz plugin to do the job.


Thanks for all your help!