MyBB Community Forums

Full Version: I want to show the OP's reputation in a thread list column
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just installed the latest MyBB, fresh install with no other plugins.

I'm trying to create a new column in the thread list view.

I added a new <td> and added this -> {$user['reputation']}

But the column ends up showing a blank space.

I knew it wasnt gonna be that easy.

Could some kind soul help me out?
Hi Welcome,
I think (hope) this will work:
{$mybb->user['reputation']} 

Does it work?


Edit:
Added {}
This works:
{$mybb->user['reputation']}

Edit#2:
If you are using the PHP in Templates / Complex Templates mod then it works without the extra {}
Thank you so much that worked!

But the reputation number doesn't link to the the user's reputation report. Is there a fix for that?

Btw im upping your rep Big Grin

(2011-11-20, 05:23 AM)seeker Wrote: [ -> ]Hi Welcome,
I think (hope) this will work:
{$mybb->user['reputation']} 

Does it work?


Edit:
Added {}
This works:
{$mybb->user['reputation']}

Edit#2:
If you are using the PHP in Templates / Complex Templates mod then it works without the extra {}

(2011-11-20, 05:47 AM)fudgepuppy Wrote: [ -> ]Thank you so much that worked!
....

Sure, you are welcome :o)

(2011-11-20, 05:47 AM)fudgepuppy Wrote: [ -> ]...
But the reputation number doesn't link to the the user's reputation report. Is there a fix for that?
........

Option 1 = Find the exact spot in the (default) templates where the rep code does link to the reputation report.

Option 2 = "Figure it out"
(for example)

End result ==
We need a target URL like this
http://domain.com/reputation.php?uid=17052
and the link text is your variable "{$mybb->user['reputation']}"

so in the template:
<a href="reputation.php?uid={$mybb->user['uid']}">{$mybb->user['reputation']}</a>
^^^
Something similar to that should work (not 100% checked for "little errors"), and you can add "link title" (whatever), if you want too.
Should work....
Have fun Smile

{$mybb->user['reputation']} will just give the logged in users reputation, not the posters reputation.
(2011-11-20, 06:24 AM)AJS Wrote: [ -> ]{$mybb->user['reputation']} will just give the logged in users reputation, not the posters reputation.

I just tested it and you're absolutely right!

Would you happen to have a solution for this?

Thanks a bunchSmile
Spent a lot of time in it and figured out it'd need a complex edit or a plugin most probably because one has to built the reputation by fetching thread poster's reputation from his profile link. table mybb_threads only has thread poster name column, not his rep, so one has to build rep in accordingly selecting the OP's profile link from threads table and selecting from reputation table.
(2011-11-20, 07:11 AM)crazy4cs Wrote: [ -> ]Spent a lot of time in it and figured out it'd need a complex edit or a plugin most probably because one has to built the reputation by fetching thread poster's reputation from his profile link. table mybb_threads only has thread poster name column, not his rep, so one has to build rep in accordingly selecting the OP's profile link from threads table and selecting from reputation table.

Awww that majorly sucks. Oh well Sleepy
FYI: mybb_threads table also has the user id, so your profile link (URL) can still be built (similar to) the way I showed.

For the reputation value:
Can you add a column to the threads table that is a "view" of the reputation column from the users table?
^^^
  • A MySQL view can be of a whole table, or various columns, but can you place a column view into an existing table?