Previous Thread
Next Thread
Print Thread
Rate Thread
#128184 08/06/2001 10:23 PM
Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Well, I am back again. I have a problem. I have gotten alot of help to get it to open the file and read everything, then print. But now we are stuck. We were trying to get it to replace the member number with the public name or login.

This is the vars_mods.cgi file:
Code
code:


This is the code used to try and get it to show:
Code
code:


But we get this error:

No member profile found for member number: '' (called by ubb_team.cgi, line 46)

[ August 06, 2001: Message edited by: Tech-Ni-Kal ]

Sponsored Links
Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Well we got it to work, except it doesn't get the member profile. It won't take out the second quotation.

No member profile found for member number: '00000001"' (called by ubb_team.cgi, line 46)


Updated code:
Code
code:

[ August 06, 2001: Message edited by: Tech-Ni-Kal ]

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
I suggest you to use cp_vars_mods.pl's code + @forums = &OpenForumsFile; in the beginning instead of your code.

[ August 07, 2001: Message edited by: LK ]

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Quote
quote:
Don't you mean cp_vars_mods.pl? tipsy

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Hey, can anybody help me fix that code? The stuff LK said to use doesn't work..

Sponsored Links
Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
code:
Code

my @mods = &OpenFileAsArray("$vars_config{CGIPath}/vars_mods.cgi");
foreach (@mods) {
@unums = $_ =~ /d{8}/g;
foreach $num (@unums) {
$mod{$num} = "mod";
}
}

foreach $key (keys %mod) {
## do stuff to $key here
}




in the bottom loop $key will be the member number of each moderator (no dupes).

[ August 07, 2001: Message edited by: jordo ]

[ August 07, 2001: Message edited by: jordo ]

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
OMG ARE YOU THE MAN!!! Now, is there a way to figure out how many forums they mod and which ones they are?

Also, I can't get it to pull profile fields for each member just the first one.

[ August 07, 2001: Message edited by: Tech-Ni-Kal ]

Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
change:
code:
Code

$mod{$num} = "mod";


to
code:
Code

$mod{$num} = $mod{$num} + 1;



then the value in the mod hash will be the number of forums they moderate. for keeping track of which forums, you could add a 2nd hash reference below the $mod{$num} one, something like:
code:
Code

$forum_num++;
$the_forum_they_mod{$num} .= "$forum_num||";



then youll get a hash with usernumbers as keys and the values like "1||4||5" being the forums they mod...but make sure you sort your mods array first, as its not sorted to begin with.

Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
where are you pulling the profiles at? they should be pulled where it says ## do stuff to $key here
something like:

code:
Code

foreach $key (keys %mod) {
print &OpenProfile($key);
}


Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
quote:
Originally posted by Tech-Ni-Kal:

This is how I was doing it earlier...
code:
Code


my @user_profile = &OpenProfile($moderators[$i]);
chomp ($user_profile[15]);
chomp ($user_profile[7]);
$Posts .= "Posts: $user_profile[7]";
if ($user_profile[15]) {
$Name .= "$user_profile[15] rulez earth";
} else {
$Name .= "$user_profile[0] rulez earth";
}


}







Two questions, one how would I show on the script what forums they moderate?

Two:
you wrote:
but make sure you sort your mods array first, as its not sorted to begin with.


I don't quite understand which part to sort...

Sponsored Links
Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Well, I got it sorted so I could get everything from each member's profile! tipsy

Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
try this, should be straighforward smile

code:
Code

my @mods = &OpenFileAsArray("$vars_config{CGIPath}/vars_mods.cgi");
my $count = 1;
foreach (@mods) {
@unums = $_ =~ /d{8}/g;
foreach $num (@unums) {
$mod_f_count{$num} = $mod_f_count{$num} + 1;
$mod_which_f{$num} = "$count||$mod_which_f{$num}";
$mod{$num} = [ $mod_f_count{$num}, $mod_which_f{$num} ];
}
$count++;
}

foreach $key ( keys %mod ) {
$Number_of_forums_modded = $mod{$key}[0];
$Which_forums_modded = $mod{$key}[1];
$Usernumber = $key;
}



ive never done much with 2d data structures in perl, so im not sure how well this will work, but it should.

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Hmm, it just shows, 1 and 1. I can't explain it much better.

This is how it looks:

code:
Code

my @mods = &OpenFileAsArray("$vars_config{CGIPath}/vars_mods.cgi");
my $count = 1;
foreach (@mods) {
@unums = $_ =~ /d{8}/g;
foreach $num (@unums) {
$mod_f_count{$num} = $mod_f_count{$num} + 1;
$mod_which_f{$num} = "$count||$mod_which_f{$num}";
$mod{$num} = [ $mod_f_count{$num}, $mod_which_f{$num} ];
}
$count++;
}

foreach $key (keys %mod) {
my @user_profile = &OpenProfile($key);
foreach $key (keys %mod) {
&OpenProfile($key);
}
foreach $key ( keys %mod ) {
$Number_of_forums_modded = $mod{$key}[0];
$Which_forums_modded = $mod{$key}[1];
$Usernumber = $key;
}
chop ($user_profile[15]);
chop ($user_profile[0]);
chop ($user_profile[7]);
chop ($user_profile[10]);
$DateReg .= "$user_profile[10]
";
if ($user_profile[7] eq '') {
$Posts .= "0
";
} else {
$Posts .= "$user_profile[7]
";
}

if ($user_profile[15]) {
$Name .= "<a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=get_profile;u=$key">$user_profile[15]</a>
";
} else {
$Name .= "<a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=get_profile;u=$key">$user_profile[0]</a>
";
}




Thanks man!

Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
try this:

code:
Code

my @mods = &OpenFileAsArray("$vars_config{CGIPath}/vars_mods.cgi");
my $count = 1;
foreach (@mods) {
@unums = $_ =~ /d{8}/g;
foreach $num (@unums) {
$mod_f_count{$num} = $mod_f_count{$num} + 1;
$mod_which_f{$num} = "$count&#0124;&#0124;$mod_which_f{$num}";
$mod{$num} = [ $mod_f_count{$num}, $mod_which_f{$num} ];
}
$count++;
}

foreach $key (keys %mod) {
my @user_profile = &OpenProfile($key);
$Number_of_forums_modded = qq~$mod{$key}[0]
~;
$Which_forums_modded .= qq~$mod{$key}[1]
~;
$Usernumber = $key;
chop ($user_profile[15]);
chop ($user_profile[0]);
chop ($user_profile[7]);
chop ($user_profile[10]);
$DateReg .= "$user_profile[10]
";
if ($user_profile[7] eq '') {
$Posts .= "0
";
} else {
$Posts .= "$user_profile[7]
";
}

if ($user_profile[15]) {
$Name .= qq~<a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=get_profile;u=$key">$user_profile[15]</a>
~;
} else {
$Name .= qq~<a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=get_profile;u=$key">$user_profile[0]</a>
~;
}

}

print qq~<table><tr><td>$Name</td><td>$Posts</td><td>$Which_forums_modded</td><td>$Number_of_forums_modded</td></tr>< /table>~;


Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Hmm, the counting of the forums worked the first time then I put the variable in another variable and it just showed the forums for each member and then counted as 1 then I tried moving it back and it still didn't work. The weird part is it worked. I will probably figure it out before you read this but if I don't.

By the way, thanks alot!!

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Two more things. "Sorry to be a bother" I have spent the better part of my day trying to rename the forums. Is there any way to do it? Or maybe just point me in which file to look in?

And is there any way to get a border around the names and such. But since they are one variable with
's it's a bit harder. I have had people try and help with no luck. There is a way to do it if i could make it so it would be like

Rob , 1,2,7,8 , 600 posts, 4 forums moderated instead of Rob || Tbone || Travis, 1,2,3,4 || 1 || 3, 400 posts || 2 posts || 5 posts... and so on. The way now it the last way described and you can't put borders around it. Is there a way to seperate the variables like that?

[edit= rewrote something]

[ August 08, 2001: Message edited by: Tech-Ni-Kal ]

[ August 09, 2001: Message edited by: Tech-Ni-Kal ]

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Yet another thing doesn't work. And I know I am becoming a pest... Instead of counting how many forums each moderator mods. It just displays the highest one and only post that.

Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
code:
Code

my @mods = &OpenFileAsArray("$vars_config{CGIPath}/vars_mods.cgi");
my $count = 1;
foreach (@mods) {
@unums = $_ =~ /d{8}/g;
foreach $num (@unums) {
$mod_f_count{$num} = $mod_f_count{$num} + 1;
$mod_which_f{$num} = "$count&#0124;&#0124;$mod_which_f{$num}";
$mod{$num} = [ $mod_f_count{$num}, $mod_which_f{$num} ];
}
$count++;
}
foreach $key (keys %mod) {
my @user_profile = &OpenProfile($key);
$Usernumber = $key;
chop ($user_profile[15]);
chop ($user_profile[0]);
chop ($user_profile[7]);
chop ($user_profile[10]);
$DateReg = "$user_profile[10]";
if ($user_profile[7] eq '') {
$Posts = "0";
} else {
$Posts = "$user_profile[7]";
}
if ($user_profile[15]) {
$Name = qq~<a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=get_profile;u=$key">$user_profile[15]</a>~;
} else {
$Name = qq~<a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=get_profile;u=$key">$user_profile[0]</a>~;
}
$mod_info_row .= qq~<tr><td>$Name</td><td>$Posts</td><td>$mod{$key}[1]</td><td>$mod{$key}[0]</td></tr>~;
}



[ August 09, 2001: Message edited by: jordo ]

Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
lmoa, cut and paste that in a text editor any you should be able to read it, or turn your IE fontsize wayyyy up.

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
I declare jordo....


THE KING!!!


Thanks man!!

Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Even though you can't divide it up to mess with a little or take it out of the sub.... IT WORKS GREAT!!! laugh


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)