Jump to content


phpBB3 rank variable,


4 replies to this topic

#1 Homer

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 14 November 2007 - 07:01 PM

i have a site that calls on the phpBB3 user data to login , etc. I can make it echo "Hello you are an 1" or "Hello You are a 2" (1 being admin, 2 being manager)

BUT

how do you make it echo the rank of the user. like "Hello! You are an Administrator!

i could do it like
if($user->data['user_rank']  == '1')
{
echo 'You are an Administrator';
}
elseif($user->data['user_rank']  == '2')
{
echo 'You are a DJ';
}
etc...

but i was wondering if there was a variable for it, which would make it way easier.
something such as
$rank = $user->data['user_rank_title']

echo $rank;

any help is greatly appreciated :P

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 14 November 2007 - 08:20 PM

You would do that the same way you associate the user id to the username in the various tables like with the posts.

Look at some of the SQL queries within the code and you'll get the idea (p.s. there should be a ranks table some where in your database, you'll need to find it).

#3 Homer

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 12 March 2008 - 10:25 AM

i know its been a long time since i posted this, but i am now working on another project, and i need to know how to do this. i can make it show numbers, but not the title. I have no clue, ive looked through memberlist.php almost 50 times now and cannot figure out how to echo the title of the users rank. CAn you just tell me how?

Much thanks:)

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 12 March 2008 - 04:22 PM

Nope, it wouldn't be any fun that way. Technically speaking, i should have locked this back in November and referred you to the phpbb forums for support... but i didn't, so you're lucky...

Also, i don't have a copy of a phpBB3 database table to tell you exactly which one you need to look at. Pull up phpMyAdmin, their table names are fairly self-explainitory, you'll find it.

Edited by rc69, 12 March 2008 - 04:22 PM.


#5 tones

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 14 March 2008 - 11:02 AM

Ok its been a few days so i dont know if he's found it yet, but the table, provided you haven't changed the prefix is phpbb_ranks and the field for the description is rank_title.

That's as much as i'm going to divulge too, but as was suggested, look through the code and you will see how it is done. It's already done for you. If you look where it displays the posters details, it states the rank of the user under the name & avatar.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users