You can use the script below, change the paths according to your setup. Users with guest status will have zero posts (consistent with how GForum handles guest posts)
Code:
#!/path/to/perl
use strict;
use lib '/path/to/gforum/admin';
use GForum qw/$DB/;
GForum::init('/path/to/gforum/admin');
my $user_t = $DB->table ('User');
my $post_t = $DB->table ('Post');
my $sth = $user_t->select;
while (my $user = $sth->fetchrow_hashref) {
my $post_num = $post_t->count( { user_id_fk => $user->{user_id} } );
if ($user->{user_status} == 0) {
$user_t->update ( { user_posts => 0 } , { user_id => $user->{user_id} });
}
else {
$user_t->update ( { user_posts => $post_num } , { user_id => $user->{user_id} });
}
}
If you don't trust the script, or you want to be sure that the right thing goes on, place a print command instead of the updates, then you can see what is happening.
Ivan
-----
Iyengar Yoga Resources /
GT Plugins