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 13172 Apr 23, 2002, 3:49 AM
Thread Re: [balita] Welcome message
ptegler 12874 Apr 23, 2002, 6:17 AM
Post Re: [ptegler] Welcome message
balita 12725 Apr 23, 2002, 9:41 AM
Thread Re: [balita] Welcome message
Franco 12758 Apr 23, 2002, 7:39 AM
Post Re: [Franco] Welcome message
Paul 12731 Apr 23, 2002, 7:55 AM
Thread Re: [Franco] Welcome message
Paul 12759 Apr 23, 2002, 8:18 AM
Thread Re: [Paul] Welcome message
Franco 12799 Apr 23, 2002, 8:20 AM
Post Re: [Franco] Welcome message
Paul 12716 Apr 23, 2002, 9:18 AM
Thread Re: [Franco] Welcome message
Paul 12807 Apr 23, 2002, 10:30 AM
Thread Re: [Paul] Welcome message
Franco 12683 Apr 23, 2002, 10:50 AM
Thread Re: [Franco] Welcome message
Paul 12763 Apr 23, 2002, 10:54 AM
Thread Re: [Paul] Welcome message
Franco 12756 Apr 23, 2002, 11:09 AM
Post Re: [Franco] Welcome message
hoefti 12496 Nov 18, 2004, 11:32 AM
Thread Re: [Paul] Welcome message
SeanP 12584 Dec 5, 2005, 1:52 PM
Thread Re: [SeanP] Welcome message
Franco 12494 Dec 8, 2005, 7:31 PM
Thread Re: [Franco] Welcome message
SeanP 12405 Dec 8, 2005, 8:11 PM
Thread Re: [SeanP] Welcome message
eupos 12396 Dec 9, 2005, 12:17 AM
Thread Re: [eupos] Welcome message
Andy 12493 Dec 9, 2005, 12:31 AM
Thread Re: [Andy] Welcome message
SeanP 12536 Dec 12, 2005, 7:43 AM
Post Re: [SeanP] Welcome message
eupos 12510 Dec 12, 2005, 8:18 AM
Thread Re: [Andy] Welcome message
SeanP 12334 Dec 13, 2005, 8:47 AM
Thread Re: [SeanP] Welcome message
eupos 12394 Dec 14, 2005, 12:37 AM
Thread Re: [eupos] Welcome message
SeanP 12437 Dec 14, 2005, 6:17 AM
Thread Re: [SeanP] Welcome message
eupos 12413 Dec 14, 2005, 7:20 AM
Post Re: [eupos] Welcome message
SeanP 2928 Dec 14, 2005, 2:51 PM
Thread Re: [eupos] Welcome message
hoefti 2744 Feb 26, 2007, 1:59 PM
Post Re: [hoefti] Welcome message
eupos 2718 Feb 28, 2007, 3:31 AM
Post Re: [eupos] Welcome message
SeanP 12427 Dec 9, 2005, 7:33 AM