View Single Post
  #1  
Old 06-26-2008, 07:11 PM
testboard testboard is offline
 
Join Date: Nov 2007
Location: Hampshire, United Kingdom
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01233 seconds
  • Memory Usage 1,793KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete