Hi,
I'm hoping someone can shed some light on this. I've got a special FACustom.pm file with a subroutine that's supposed to calculate the number of posts in an Announcements forum since the last time the user was seen at that forum. This count is also supposed to max out at the last 30 days, so nothing older than that should be counted.
Right now something is seriously messed up, since when I call it in the template I'm getting the following error message:
Error: Unable to load module: GForum::FACustom. Reason:
Error: No subroutine 'GForum::FACustom::getUserNewAnnouncements' in 'GForum/FACustom.pm',
Error: No subroutine 'GForum::FACustom::getUserNewAnnouncements' in 'GForum.pm'
use vars qw/@EXPORT_OK/;
use GForum qw/$DB $USER $CFG/;
sub getUserNewAnnouncements {
if ($USER) {
my $cutoff = shift;
if(!$cutoff) {
$cutoff = time() - (3600*24*30);
}
my $user_id = $USER->{user_id};
my $forum_id = 11; #this is the id of the announcements forum
my $last_in_forum = $DB->table('UserNew')->select('usernew_last' => { user_id_fk => $user_id, forum_id_fk => $forum_id})->fetchrow_hashref->{usernew_last};
if(!$last_in_forum || $last_in_forum < $cutoff) {
my $cond = GT::SQL::Condition->new(
forum_id_fk => '=' => $forum_id,
post_root_id => '=' => 0,
post_time => '>' => $cutoff
);
return $DB->table('Post')->count($cond);
} else {
my $cond = GT::SQL::Condition->new(
forum_id_fk => '=' => $forum_id,
post_root_id => '=' => 0,
post_time => '>' => $last_in_forum
);
return $DB->table('Post')->count($cond);
}
} else {
return 0;
}
}
1;
Thanks in advance for any suggestions.
Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
I'm hoping someone can shed some light on this. I've got a special FACustom.pm file with a subroutine that's supposed to calculate the number of posts in an Announcements forum since the last time the user was seen at that forum. This count is also supposed to max out at the last 30 days, so nothing older than that should be counted.
Right now something is seriously messed up, since when I call it in the template I'm getting the following error message:
Error: Unable to load module: GForum::FACustom. Reason:
Error: No subroutine 'GForum::FACustom::getUserNewAnnouncements' in 'GForum/FACustom.pm',
Error: No subroutine 'GForum::FACustom::getUserNewAnnouncements' in 'GForum.pm'
Code:
use strict; use vars qw/@EXPORT_OK/;
use GForum qw/$DB $USER $CFG/;
sub getUserNewAnnouncements {
if ($USER) {
my $cutoff = shift;
if(!$cutoff) {
$cutoff = time() - (3600*24*30);
}
my $user_id = $USER->{user_id};
my $forum_id = 11; #this is the id of the announcements forum
my $last_in_forum = $DB->table('UserNew')->select('usernew_last' => { user_id_fk => $user_id, forum_id_fk => $forum_id})->fetchrow_hashref->{usernew_last};
if(!$last_in_forum || $last_in_forum < $cutoff) {
my $cond = GT::SQL::Condition->new(
forum_id_fk => '=' => $forum_id,
post_root_id => '=' => 0,
post_time => '>' => $cutoff
);
return $DB->table('Post')->count($cond);
} else {
my $cond = GT::SQL::Condition->new(
forum_id_fk => '=' => $forum_id,
post_root_id => '=' => 0,
post_time => '>' => $last_in_forum
);
return $DB->table('Post')->count($cond);
}
} else {
return 0;
}
}
1;
Thanks in advance for any suggestions.
Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund