Adding additional field to xf_users.. do i need to extend the model?

Rob

Well-known member
Hi,

I am adding an additional field to the xf_users table. Do I need to extend the xenforo user model and if so, do you have any idea how?

So far, i have my addon adding a new field to the user table (bookreviews_count)... this is working, so far so good. My mod will update and decrement this field as bookreviews are added and deleted. I want to show this additional field bookreviews_count on postbits, but don't know how to show it. im assuming i need to extend the user model or something first?

Sorry, this probably sounds quite basic but I'm just starting with OO php and xenforo.

Thanks,

Rob
 
You might not need to extend anything. The entire user record is already selected for posts. You can probably just call on the variable in the template. For example, use this in message_user_info:

Code:
{$user.bookreviews_count}

And of course you can use any template hook from that template to add user info without editing the template which is what you should do for an addon.
 
Hi, that's useful. Are there an examples anywhere of how to inject info into the bit below the avatar in posts?
 
Top Bottom