Quote:
No, I am referring to permissions. Users are members of both groups under the system you are running.
|
OK, now I definitely do understand. Member of both groups but "yes" over-rides "no" as in being a member of group giving permissions mean you have those even if another group does not.
Quote:
You are creating a profile field to check upon activation.
|
I understand now & I have managed to create profile fields which appear to work as I want (Completed at activation, not editable in the users profile by the user).
Quote:
At activated, you sort into your usergroups.
|
Not sure about where "activated" / "activation" is - presumeably once an admin has moderated a new user so they are allowed to post.
I'm going to have a look through the code now to see if I can find a hook at some point.
If so, I think what I need to do is create a plugin that takes the contents of the profile field & adds the corresponding groups to "membergroupids" as appropriate.
Am I on the right track now?
Thanks for all your help so far.
--------------- Added [DATE]1214513317[/DATE] at [TIME]1214513317[/TIME] ---------------
It seems that the best place to add the code to set "membergroupids" is in:
/admincp/user.php?do=domoderated
at about this point in the code:
$userdata->set('usergroupid', 2);
However I see no hooks that I can use for a plugin.
Should I just add the code to user.php or am I missing what you mean by "activation"?
I will have a look through the ACP to see if there are any "activation" options in there.
--------------- Added [DATE]1214533841[/DATE] at [TIME]1214533841[/TIME] ---------------
SOLUTION:
1) In ACP/User Profile Fields/Add New User Profile Field
Add the new field by completing the form.
2) In ACP/Plugins & Products/Add New Plugin
Add a new plugin. This is the code I used:
$tradegroup = $db->query_first('SELECT field7 FROM userfield WHERE userid=\''.$userinfo['userid'].'\'');
$groupnum = $db->query_first('SELECT usergroupid FROM usergroup WHERE title=\''.$tradegroup['field7'].'\'');
$userdata->set('membergroupids', $groupnum);
Change mentions of field7 to whatever the field number is that you set up in step 1.
The hook is: register_activate_process
--------------- Added [DATE]1214534002[/DATE] at [TIME]1214534002[/TIME] ---------------
NOTES:
In case someone has searched & found the above soloution, this is still not perfect:
1) The dropdown list from step 1 is not auto-populated with additional member groups that may be created in the future.
2) I don't think there will ever be entries in "membergroupids" but if there is then the above code will overwrite them rather than add to them.
--------------- Added [DATE]1214534136[/DATE] at [TIME]1214534136[/TIME] ---------------
Finally, thanks for all your help, pointers & explanations "Dismounted".
--------------- Added [DATE]1214534432[/DATE] at [TIME]1214534432[/TIME] ---------------
Spoke too soon, the hook is wrong, users can post before they are moderated.
I think I have now officially lost the will to live with this.
--------------- Added [DATE]1214535946[/DATE] at [TIME]1214535946[/TIME] ---------------
--------------- Added [DATE]1214536511[/DATE] at [TIME]1214536511[/TIME] ---------------
Changed the code slightly & added to admincp/user.php in do="domoderate":
$tradegroup = $db->query_first('SELECT field7 FROM userfield WHERE userid=\''.$user['userid'].'\'');
$groupnum = $db->query_first('SELECT usergroupid FROM usergroup WHERE title=\''.$tradegroup['field7'].'\'');
$userdata->set('membergroupids', $groupnum);
All working now, although this is not a good way of doing it as vbulletin upgrades may fail as I've edited the code directly rather than using a hook with plugin code.