apathy
Well-known member
Hey guys, I've recently started making my first proper addon for Xenforo. It's basically adding a new route /account/username-settings where people can change the appearance of their username.
My initial approach was just to extend the User entity with some new columns added to xf_user, and this worked perfectly fine. I realized however that I had dozens of columns I want to add, so making a new table would probably be the way to go - I called it xf_ap_username_styles.
When I was extending the User entity, I had no issue getting values from the DB to display in templates because I could use $xf.visitor.color or something, so long as I added the columns to my Listener then Xenforo would have no issue interacting with them.
Since making my own table however, I'm having trouble creating the variables. Here is the output of dump($xf.visitor) and dump($style). Due to the structure of this output, I thought perhaps $style.Username.color would work, but it didn't. $style.color is a no-go as well.
I'd really love any help here. These are some relevant files:
Entity\Username.php
Pub\Controller\Username.php
Repository\Styles.php
My initial approach was just to extend the User entity with some new columns added to xf_user, and this worked perfectly fine. I realized however that I had dozens of columns I want to add, so making a new table would probably be the way to go - I called it xf_ap_username_styles.
When I was extending the User entity, I had no issue getting values from the DB to display in templates because I could use $xf.visitor.color or something, so long as I added the columns to my Listener then Xenforo would have no issue interacting with them.
Since making my own table however, I'm having trouble creating the variables. Here is the output of dump($xf.visitor) and dump($style). Due to the structure of this output, I thought perhaps $style.Username.color would work, but it didn't. $style.color is a no-go as well.
I'd really love any help here. These are some relevant files:
Entity\Username.php
Pub\Controller\Username.php
Repository\Styles.php