{font}>Groups
{font}>\n|;
my %group;
my $do = $IN->param('do');
if ($do eq 'modify_record' or $do eq 'add_record') {
my @selected = $IN->param('UserGroup.group_id_fk');
@group{@selected} = (1) x @selected;
}
else {
%group = defined $user_id ? (map { ($_ => 1) } $self->get_all_groups($user_id)) : ();
}
my $sth = $DB->table('Grouping')->select('group_id', 'group_name');
while (my $group = $sth->fetchrow_arrayref) {
my ($gid, $gname) = @$group;
next if $gid == $CFG->{id_group_guest}
or $gid == $CFG->{id_group_not_validated}
or $gid == $CFG->{id_group_registered}
or $gid == $CFG->{id_group_moderator};
$return .= "_start_html({ title => "Delete Records" });
print $self->_header("Delete Records", "Search to delete records. ");
print $self->_footer;
}
%DISPLAY = (
user_username => sub {
my ($self, $col, $rec) = @_;
my $disp_name = $col->{form_display} || 'Username';
my $return = qq|
{font}>$disp_name
{font}>$rec->{user_username}|;
if ($CFG->{admin_show_user_login}) {
require GForum::Authenticate;
if (GForum::Authenticate::auth(enabled_user => $rec)) {
$return .= qq|\n(| . GForum::language('BECOME_USER') . qq| )|;
}
}
$return .= " ";
$return;
},
user_password => sub {
my ($self, $col, $rec) = @_;
my $disp_name = $col->{form_display} || 'Password';
return "{font}>$disp_name \n{font}><" .
(defined $rec->{user_password} ? "encrypted" : "none") .
" > ";
},
user_temp_pass => sub {
my ($self, $col, $rec) = @_;
my $disp_name = $col->{form_display} || 'Temp. Password';
return "{font}>$disp_name \n{font}><" .
(defined $rec->{user_temp_pass} ? "encrypted" : "none") .
" > ";
},
user_registered => sub {
my ($self, $col, $rec) = @_;
require GT::Date;
my $disp_name = $col->{form_display} || 'Registered';
return "{font}>$disp_name \n{font}>" . GForum::date($rec->{user_registered}, 1) . " \n";
},
user_last_logon => sub {
my ($self, $col, $rec) = @_;
require GT::Date;
my $disp_name = $col->{form_display} || 'Last Logon';
return "{font}>$disp_name \n{font}>" . ($rec->{user_last_logon} ? GForum::date($rec->{user_last_logon}, 1) : "never logged on ") . " \n";
},
user_last_seen => sub {
my ($self, $col, $rec) = @_;
require GT::Date;
my $disp_name = $col->{form_display} || 'Last seen';
return "{font}>$disp_name \n{font}>" . ($rec->{user_last_seen} ? GForum::date($rec->{user_last_seen}, 1) : "never logged on ") . " \n";
},
user_payment_expiry => sub {
my ($self, $col, $rec) = @_;
require GT::Date;
my $disp_name = $col->{form_display} || 'Signup Payment Expiry';
return "{font}>$disp_name \n{font}>" . ($rec->{user_payment_expiry} > 0 ? GForum::date($rec->{user_payment_expiry}, 1) : $rec->{user_payment_expiry} ? 'No payment received' : 'Unlimited') . " \n";
},
user_title => sub {
my ($self, $col, $rec) = @_;
my $disp_name = $col->{form_display} || 'Title';
if (defined $rec->{user_title} and length $rec->{user_title}) {
return "{font}>$disp_name \n{font}>$rec->{user_title} \n";
}
else {
my $title;
for (sort { $a <=> $b } keys %{$CFG->{user_post_title}}) {
$rec->{user_posts} >= $_ and $title = $CFG->{user_post_title}->{$_}, next;
last;
}
$title = "Unknown" unless defined $title;
return "{font}>$disp_name \n{font}>$title (Autogenerated from # of posts) \n";
}
},
user_hidden_cats => sub { "" }
);
%FORM = (
user_signature => sub {
my ($self, $col, $rec) = @_;
my $disp_name = $col->{form_display} || 'Signature';
my $output = "{font}>$disp_name \n{font}>";
$output .= " \n";
$output;
},
user_registered => sub {
my ($self, $col, $rec) = @_;
my $todo = $self->{input}->{todo} || $self->{input}->{do} || '';
my $output = "";
unless ($self->{db}->{last_hits} or $todo =~ /add_/) {
my $disp_name = $col->{form_display} || 'Date Registered';
$output .= "{font}>$disp_name \n{font}>";
my $form_size = $col->{form_size} || 30;
require GT::Date;
my $value = (defined $rec->{user_registered} and length $rec->{user_registered}) ? GForum::date($rec->{user_registered}, 1) : "";
$output .= qq| \n|;
unless ($self->{db}->{last_hits}) {
$output .= qq|{font}>On or After Before |;
}
}
$output;
},
user_payment_expiry => sub {
my ($self, $col, $rec) = @_;
my $output = "";
my $disp_name = $col->{form_display} || 'Payment Expiry';
$output .= "{font}>$disp_name \n{font}>";
my $form_size = $col->{form_size} || 30;
require GT::Date;
my $value = ($rec->{user_payment_expiry} && $rec->{user_payment_expiry} > 0) ? GForum::date($rec->{user_payment_expiry}, 1) : "";
$output .= qq| |;
$output .= qq| {user_payment_expiry};
$output .= qq|> Unlimited \n|;
my $todo = $self->{input}->{todo} || $self->{input}->{do} || '';
unless ($self->{db}->{last_hits} or $todo =~ /add_/) {
$output .= qq|{font}>On or After Before |;
}
$output;
},
user_do_after_post => sub {
my ($self, $col, $rec) = @_;
my $disp_name = $col->{form_display} || 'After post action';
my $text_field =
my $output = qq|
{font}>$disp_name \n{font}>|;
$output .= $self->text({
def => $col,
name => 'user_do_after_post',
($rec->{user_do_after_post} ? (value => $rec->{user_do_after_post}) : ())
});
$output .= "";
for (@{$CFG->{admin_do_after_post_options}}) { # This isn't directly settable, but a plugin could alter it
$output .= qq| $_ |;
}
$output .= " ";
$output;
},
user_last_logon => sub {
my ($self, $col, $rec) = @_;
my $todo = $self->{input}->{todo} || $self->{input}->{do} || '';
my $output = "";
unless ($self->{db}->{last_hits} or $todo =~ /add_/) {
my $disp_name = $col->{form_display} || 'Last Logon';
$output .= "{font}>$disp_name \n{font}>";
my $form_size = $col->{form_size} || 30;
require GT::Date;
my $value = (defined $rec->{user_last_logon} and length $rec->{user_last_logon}) ? GForum::date($rec->{user_last_logon}, 1) : "";
$output .= qq| \n|;
unless ($self->{db}->{last_hits}) {
$output .= qq|{font}>On or After Before |;
}
}
$output;
}
);
# Returns a list of all the groups the passed in user is a member of.
sub get_all_groups {
my $self = shift;
defined(my $user_id = shift) or $self->error('BADARGS', 'FATAL', 'No user ID passed to get_all_groups()!');
my $sth = $DB->table('UserGroup')->select({ user_id_fk => $user_id }, 'group_id_fk');
return map $_->[0], @{$sth->fetchall_arrayref};
}
1;