PDA

View Full Version : User IDs to User Names


SFishy
05-24-2003, 01:58 AM
Doesn't seem anyone is interested in this... I'm hoping to spark an interest in someone who might find this useful information to have.

I have this little script that I downloaded here at vbulletin.org (see attached). It tells you what members are being ignored, and who they are being ignored by.

I don't even need to know the "ignored by" part, but it's an added bonus.

Two problems I have...

I'd like to get this info into a template and I don't even know how to start...

I'd like the userIDs (from the ignore lists) to actually be translated into the usernames.

Anyone want to help?

Thanks...

SFishy
05-24-2003, 01:59 AM
This is what the output looks like currently...

SFishy
05-25-2003, 01:49 AM
Hi all, just bumping this up...

Here's me trying to convince someone with the know-how: it would be really useful information to have to see who your users consider to be "trouble makers" ... to know who they are ignoring.

I tried to figure out how to get it into a template myself, or how to get the user IDs to convert over to usernames, and I couldn't do either -- I'm really a programming dummy!

*begging* anyone?

Boofo
05-25-2003, 01:53 AM
In that file, change this:

SELECT ignorelist, username

to this:

SELECT ignorelist, username, userid

SFishy
05-25-2003, 02:01 AM
Thanks Boofo... but that didn't work :(

Boofo
05-25-2003, 02:35 AM
What are you trying to do exactly?

SFishy
05-25-2003, 03:06 AM
Boofo,

Ignore.php spits out a list of users who have people on their ignore list. Their ignore list is shown as a series of userID numbers. If there's more than 1, they are separated by a space.

Look at the attached .gif above in my first reply...

Part 1. I was the userIDs translated into usernames.
Part 2. I was the whole thing in some kind of template.

filburt1
05-25-2003, 03:13 AM
// assuming the list is in $user['ignorelist']...
$ignorelist = explode(" ", $user['ignorelist']);
$usernames = array();
if (!empty($user['ignorelist']))
{
$result = $DB_site->query("SELECT userid, username FROM user WHERE userid IN (" . implode(", ", $ignorelist) . ")");
while ($bits = $DB_site->fetch_array($result)
{
$usernames[$bits[userid]] = $bits['username'];
}
}

Then $usernames[userid will equal that userid's username.

SFishy
05-25-2003, 05:08 AM
Filburt,

Thank you so much for the help...

Please pardon my php stupidity, but where exactly does your code go in the ignore.php script? I did try to figure it out, but couldn't get it to work.

noppid
05-26-2003, 06:01 PM
So I played with your idea, doctored the php and made a template.

Anyone can view this page. If the point is to humiliate those being ignored, we've succeeded. LOL

If this is supposed to be for admins, we need to change the template and relocate the php file.

Hope it helps.

noppid
05-26-2003, 06:07 PM
Name this template "ignored_members"

noppid
05-26-2003, 06:14 PM
This is with a user ignored.

noppid
05-26-2003, 06:15 PM
This is if no users are being ignored.

SFishy
05-27-2003, 02:13 PM
Noppid,

PERFECT!

The way the permissions are on my board, this is only viewable by admins and mods (my users cannot view "who's online") which is why I added the permissions code that I did -- so regular members and guest just get the "no permission" template).

Thanks so much!!!!

Feel free to release it as a hack if you want -- others might find it userful.

As for credits, I think Logician was the person who released the original ignore.php (though I'm not sure)

SFishy
05-27-2003, 02:30 PM
I'm attaching my modified .php -- this helps make it look more like tables in other templates on your site... (just more aesthetically pleasing)

SFishy
05-27-2003, 02:31 PM
And these is the modified .txt file (for the template "ignored_members") that also makes it look more pleasing.

SFishy
05-27-2003, 02:32 PM
Screen shot of how it looks...

noppid
05-27-2003, 08:24 PM
Nice job, glad it worked out.