MyBB Community Forums

Full Version: Get field from user's records and insert into template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys.

I'm trying to insert a field from the users table (this field/column is added with my plugin), and I'd like to ouput the value of this field within a template. I'm not too sure how to go about this.

For example how if I had an extra column called 'telephone',
how can I show it directly under a users post count?
you could have just used a custom profile field for this?
I agree with brad, a profile field would be the best option for something like a user's telephone number.

If you're hell bent on using an extra column though, you should be able to show it in the postbit using {$post['telephone']}.
Cheers I'll look into it. Thank you Smile

Right custom fields won't really work in this case as far as I can see. I used the telephone as an example.

I'm actually trying to calculate a 'loyalty' factor calculated from a users post count+reputation+duration since joined. This is stored in a extra column in the user table.

I was thinking to just add a db query within the template but it seems php code is not meant to be run in a template?

Any ideas as to how I could proceed?
(2012-07-26, 01:11 PM)chrisssy Wrote: [ -> ]I was thinking to just add a db query within the template but it seems php code is not meant to be run in a template?

Any ideas as to how I could proceed?

Download the PHP in Templates / Complex Templates plugin: http://mybbhacks.zingaburga.com/showthread.php?tid=260