Allow users to join select groups themselves


Hi all,

My depraved users are clamoring for a NSFW subforum which I am ok with giving them, but I'd like to make it opt-in. Meaning, visitors (and google) don't ever have to see the madness down there. Ideally, a simple addon that allows me to select which usergroups I want to make publicly joinable and then adds an option into their preferences.

Anyone a bad enough dood to knock this out? :D


OK, I started working on this myself to see what I could do.. Making the option show up in the User Preferences was easy enough.. but I'm not sure how to extend the DataWriter to update the user's groups.

For example, I know that I can extend the User Datawriter to add other options like so:
protected function _getFields()
    // Get the original fieldset from the parent class (XenForo_DataWriter_User)
    $fields = parent::_getFields();

    // Add your own field
    $fields['xf_user_option']['enable_ext_social_includes'] = array('type' => self::TYPE_UINT, 'default' => 0);

    return $fields;
And then I can extend ControllerPublic_Account to add that setting into the list to be saved.. but that wouldn't be helpful in this scenario. And yes, I barely know what I'm doing ;)

edit - going to ask a mod to move this to the dev questions section!