Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Re: [Andy] Welcome message

Quote Reply
Re: [Andy] Welcome message In reply to
The reason the plugin isn't working, is because it only works when the email validation is turned on. I don't use admin or email validation, so the plugin hook is not working. Does anyone know how to change the code to another plugin hook that would work no matter if validation is on or off?

Code:
# ==================================================================
# Plugins::GForum::Welcome - Auto Generated Program Module
#
# Plugins::GForum::Welcome
# Author : Paul Wilson
# Version : 1.0
# Updated : Wed Apr 24 00:14:39 2002
#
# ==================================================================
#

package Plugins::GForum::Welcome;
# ==================================================================

use strict;
use GT::Base;
use GForum::Plugins;
use GT::Plugins qw/STOP CONTINUE/;
use GForum qw/$IN $DB $CFG/;

# Inherit from base class for debug and error methods
@Plugins::GForum::Welcome::ISA = qw(GT::Base);

# Your code begins here! Good Luck!


# PLUGIN HOOKS
# ===================================================================


sub pm {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'user_validate'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#

my ($conf) = GForum::Plugins->get_plugin_user_cfg('Welcome');
my ($utab) = $DB->table('User');
my ($code) = $IN->param('validate'); $code =~ s/^(\d+)GT//;
my ($adm) = $utab->select( { user_username => $conf->{Sender} }, ['user_id','user_username'] )->fetchrow_hashref;
my ($user) = $utab->select( { user_val_code => $code }, ['user_id','user_username'] )->fetchrow_hashref;

if (! $adm->{user_id} or ! $user->{user_id}) {
GT::Plugins->action ( CONTINUE );
return;
}
else {
$DB->table('Message')->insert({ from_user_id_fk => $adm->{user_id},
msg_username => $adm->{user_username},
to_user_id_fk => $user->{user_id},
msg_subject => $conf->{Subject},
msg_style => 1,
msg_body => $conf->{Message},
msg_time => time(),
msg_status => 0,
msg_ip => $ENV{REMOTE_ADDR} });

GT::Plugins->action ( CONTINUE );
return;

}

}
# Always end with a 1.
1;
Subject Author Views Date
Thread Welcome message balita 13015 Apr 23, 2002, 3:49 AM
Thread Re: [balita] Welcome message
ptegler 12744 Apr 23, 2002, 6:17 AM
Post Re: [ptegler] Welcome message
balita 12594 Apr 23, 2002, 9:41 AM
Thread Re: [balita] Welcome message
Franco 12623 Apr 23, 2002, 7:39 AM
Post Re: [Franco] Welcome message
Paul 12600 Apr 23, 2002, 7:55 AM
Thread Re: [Franco] Welcome message
Paul 12629 Apr 23, 2002, 8:18 AM
Thread Re: [Paul] Welcome message
Franco 12669 Apr 23, 2002, 8:20 AM
Post Re: [Franco] Welcome message
Paul 12586 Apr 23, 2002, 9:18 AM
Thread Re: [Franco] Welcome message
Paul 12677 Apr 23, 2002, 10:30 AM
Thread Re: [Paul] Welcome message
Franco 12551 Apr 23, 2002, 10:50 AM
Thread Re: [Franco] Welcome message
Paul 12632 Apr 23, 2002, 10:54 AM
Thread Re: [Paul] Welcome message
Franco 12625 Apr 23, 2002, 11:09 AM
Post Re: [Franco] Welcome message
hoefti 12366 Nov 18, 2004, 11:32 AM
Thread Re: [Paul] Welcome message
SeanP 12454 Dec 5, 2005, 1:52 PM
Thread Re: [SeanP] Welcome message
Franco 12364 Dec 8, 2005, 7:31 PM
Thread Re: [Franco] Welcome message
SeanP 12275 Dec 8, 2005, 8:11 PM
Thread Re: [SeanP] Welcome message
eupos 12266 Dec 9, 2005, 12:17 AM
Thread Re: [eupos] Welcome message
Andy 12363 Dec 9, 2005, 12:31 AM
Thread Re: [Andy] Welcome message
SeanP 12400 Dec 12, 2005, 7:43 AM
Post Re: [SeanP] Welcome message
eupos 12375 Dec 12, 2005, 8:18 AM
Thread Re: [Andy] Welcome message
SeanP 12203 Dec 13, 2005, 8:47 AM
Thread Re: [SeanP] Welcome message
eupos 12264 Dec 14, 2005, 12:37 AM
Thread Re: [eupos] Welcome message
SeanP 12307 Dec 14, 2005, 6:17 AM
Thread Re: [SeanP] Welcome message
eupos 12283 Dec 14, 2005, 7:20 AM
Post Re: [eupos] Welcome message
SeanP 2893 Dec 14, 2005, 2:51 PM
Thread Re: [eupos] Welcome message
hoefti 2709 Feb 26, 2007, 1:59 PM
Post Re: [hoefti] Welcome message
eupos 2683 Feb 28, 2007, 3:31 AM
Post Re: [eupos] Welcome message
SeanP 12297 Dec 9, 2005, 7:33 AM