Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 10-14-2007, 07:27 AM
Murty's Avatar
Murty Murty is offline
 
Join Date: Dec 2005
Location: South Australia
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, well here is the code.

This is the .php file under /includes
PHP Code:
<?php

foreach (explode(',',$userdata->fetch_field('membergroupids')) as $pg_group)
{
    
$pg_groupids[$pg_group] = $pg_group;
}
foreach (
explode("\n",$vbulletin->options['profile_groups']) as $pg_triple)
{
    list(
$pg_field,$pg_groupid,$pg_yes) = split(';',trim($pg_triple));
    if (
$pg_field and $pg_groupid)
    {
        if (!
$pg_yes)
        {
            
$pg_yes 'Yes';
        }
        if (
$userdata->userfield[$pg_field] == $pg_yes)
        {
            if (!(
$pg_groupids[$pg_groupid]))
            {
                
$pg_groupids[$pg_groupid] = $pg_groupid;
            }
        }
        else
        {
            if (
$pg_groupids[$pg_groupid])
            {
                
$pg_groupids[$pg_groupid] = 0;
            }
        }
    }
}
foreach (
$pg_groupids as $pg_groupid => $pg_value)
{
    if (
$pg_value == 0)
    {
        continue;
    }
    if (
$pg_membergroups)
    {
        
$pg_membergroups .= ',' $pg_value;
    }
    else
    {
        
$pg_membergroups $pg_value;
    }
}
$userdata->set('membergroupids'$pg_membergroups);

?>
There are also some plugins and an admincp thing if you want them?
Reply With Quote
  #12  
Old 10-15-2007, 07:39 AM
Murty's Avatar
Murty Murty is offline
 
Join Date: Dec 2005
Location: South Australia
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I hate having to bump all the time, but i really need some help with this.
Thanks
Reply With Quote
  #13  
Old 10-15-2007, 04:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is sometimes hard to just jump in and 'read' someone else's code which is why you probably aren't getting a whole lot of help with this. Maybe explain what you are trying to do with that script and people can think about how they would go about it and then 'read' what the problems are with how you went about it.
Reply With Quote
  #14  
Old 10-15-2007, 11:36 PM
Murty's Avatar
Murty Murty is offline
 
Join Date: Dec 2005
Location: South Australia
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, fair enough.

Just to refresh peoples minds, my problem is that users are being removed from their usergroup randomly.

Well basically what this mod does is when a user registers, they select 'male' or 'female' (setup in 'user profile field manager'). Then depending whether they select 'male' or 'female' it puts them in the specified user group that I define.

There is an option in 'admincp' where i can define these settings.

This is what it looks like:
field5;9;Female
field5;10;Male

So 'field5' is the profile field; '9' or '10' are the usergroups; 'female' or 'male' are the options that the user can select at registration.

Note: the user can only select their gender AT registration, nowhere else.

There are also 2 plugins.
One has a hook in the 'register_addmember_process' location, with php code:
PHP Code:
require_once(DIR '/includes/profile_groups.php'); 
The other one has a hook in the 'profile_updateprofile' location, with the php code:
PHP Code:
require_once(DIR '/includes/profile_groups.php'); 

(That "/includes/profile_groups.php" is the code a couple posts above.)

I'm not 100% sure, but I'm not sure if there should be a plugin at the 'profile_updateprofile' location...
Reply With Quote
  #15  
Old 10-16-2007, 07:06 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That sounds like a logical explanation. If your members can only enter their gender at registration time, then there is no use to also run it when they update their profile. I can imagine that this automagically changes the usergroup.

But i guess this could be easy tested.
Reply With Quote
  #16  
Old 10-16-2007, 08:09 AM
Murty's Avatar
Murty Murty is offline
 
Join Date: Dec 2005
Location: South Australia
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well i've turned it off, ill see how it goes.
Thanks for your advice marco.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03973 seconds
  • Memory Usage 2,227KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete