i hacked the code but would rather have made an addon.


Well-known member
1/2 because I wanted it & 1/2 because I wanted to learn how to do it, I hacked the code to add a usergroup description field. so far it's only seen in the AdminCP on the add/edit usergroup page & the usergroup list page. if you're wondering why, it's so I could decide how to set the permissions.


to do it I did the following
- edited "user_group_edit" admin template to add "description" field
- edited "user_group_list" admin template to add "description" to usergroup snippet
- phrase "description" was already in the vocab so I didn't have to add that
- edited ControllerAdmin\UserGroup.php in 2 spots to read & save description field
- edited DataWriter\UserGroup.php in 1 spot to list description as a valid field
- used phpmyadmin to add the "description" field to the "xf_user_group" table

my question is, would it have been possible to do this as an addon instead of a code hack? if so, could someone point me in the right direction? the code hacks are attached as screenshots. for obvious reasons I'd rather not hack code & edit templates but I have to learn to crawl before I can walk so getting the damn thing to work was step 1. it took me long enough to figure out the valid field thing.

anyway, thanks in advance for the help


Jake Bunce

XenForo moderator
Staff member
Neither of those templates have any hooks so you wouldn't have been able to add that field without replacing those templates or hacking away at the HTML using one of the template code events. Short answer... those template changes are not easily done with an addon.

The two file edits can be replaced with code event listeners for "load_class_controller" and "load_class_datawriter". You would create extended classes for both of those files you edited.

The database field would need to be added in the install code of the addon.