MyBB Community Forums

Full Version: Usergroup-Based Profile Fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good evening!

I've decided to try my hand and dabble with creating a small project for MyBB's plugin system. I have some amount of experience in PHP, but I'm far from calling myself an expert, so I'm trying to figure out the best way of going about this.

I'm not sure if this is the right area for guidance, but I'll explain the idea below.

Project:
Small in scope, basically adding a 'usergroup' setting to each custom profile field, allowing the toggle of each field for which group they belong to.

In a sense these are conditional fields -- if the user belongs to X, Y, or Z (selected groups in setting), the user receives this field to fill out on their profile, and it is in turn displayed.


Pseudoprocess:

I'm assuming the easiest way to go about this would be using PluginLibrary, as many do. 

Checking if a user is part of a group through is_member(), matched up to field settings.

This is the part where I'm a bit unsure, namely on which hook to call. 

Would I check on (for each field):
admin_config_profile_fields_add (and edit) to generate the group settings combobox?

Or is there a more appropriate way of going about doing this? 

My sincere apologies if this is vague or difficult to understand -- I am not asking for a full solution. Just a nudge in the right direction, if anyone would be willing. Gotta learn somehow, right?

If anyone is willing to help guide me in the right direction it would be duly appreciated.

Sincere thanks, in advance. If you have any questions in regards to this, I'd be more than happy to try to help accomodate.
I think that is the point of the two group settings added in 1.8 (Visible/Editable by), though I recall it had a bug which was being discussed on about how to be fixed. So you may be better contributing to the discussion and perhaps help us code the fix/solution we come up with.

If you still want to code this you should take a look at where those settings work and find the nearest hooks.