1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Development Discussions' started by Rob, Apr 29, 2012.

  1. Rob

    Rob Well-Known Member


    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.


  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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:

    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.
  3. Rob

    Rob Well-Known Member

    Hi, that's useful. Are there an examples anywhere of how to inject info into the bit below the avatar in posts?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

Share This Page