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;