MyBB Community Forums

Full Version: Creating a new user column and displaying it?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to learn more than anything and was wondering how would a new column be created in the mybb_users table, which could then be displayed somewhere in the forum?

e.g. 

New variable = postnum + threadnum + uid (the arithmetic addition)

display new variable in template x


Interested & grateful for any responses.

Cheers
Doing that would be overcomplicated since you'd have to update the column on nearly every mod tool usage etc. You can simply select these 3 fields from the users table and use math.
$q = $db->simple_select('users', 'postnum,threadnum,uid');
while($u = $db->fetch_array($q))
    $newvar[$u['uid']] = $u['uid'] + $u['postnum'] + $u['threadnum'];

echo $newvar[1]; // val for user 1
Very helpful Destroy - thanks!

Where would the best place to put this code be?
(2015-02-02, 04:55 AM)Andre R. Wrote: [ -> ]Very helpful Destroy - thanks!

Where would the best place to put this code be?

The proper way to do what you want to do is make a plugin that would do it. However, like destroy said, there's no need as everything you want displayed is already available in MyBB.

Ideally, you'd put that code on whatever page you want it to display on, enclosed in <?php ?> tags. If you were more specific in where you wanted to display the info it would be easier to help you out.