Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 02-12-2010, 06:48 PM
DaPro DaPro is offline
 
Join Date: Jan 2003
Location: CT, USA
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
if ($vbulletin->userinfo[field6] == 'Yes' AND $vbulletin->userinfo['usergroupid'] == '2')
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user    
        SET usergroupid = 10 
        WHERE userid = 
{$vbulletin->userinfo['userid']}
    "
);
}
elseif (
$vbulletin->userinfo[field6] == 'No' AND $vbulletin->userinfo['usergroupid'] == '10')
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user    
        SET usergroupid = 2 
        WHERE userid = 
{$vbulletin->userinfo['userid']}
    "
);

I was going to try this...

But isn't that what the AND's are for in my if statements? I figured those would make sure that ONLY users who are already in the usergroup '2' can have their usergroup changed. And then if they set it to no then it would remove them and revert them to '2' only if they are already in the usergroup '10'. Does that make sense?
Reply With Quote
  #12  
Old 02-12-2010, 06:52 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DaPro View Post
PHP Code:
if ($vbulletin->userinfo[field6] == 'Yes' AND $vbulletin->userinfo['usergroupid'] == '2')
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user    
        SET usergroupid = 10 
        WHERE userid = 
{$vbulletin->userinfo['userid']}
    "
);
}
elseif (
$vbulletin->userinfo[field6] == 'No' AND $vbulletin->userinfo['usergroupid'] == '10')
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user    
        SET usergroupid = 2 
        WHERE userid = 
{$vbulletin->userinfo['userid']}
    "
);

I was going to try this...

But isn't that what the AND's are for in my if statements? I figured those would make sure that ONLY users who are already in the usergroup '2' can have their usergroup changed. And then if they set it to no then it would remove them and revert them to '2' only if they are already in the usergroup '10'. Does that make sense?
yes, that code will do exactly what you want, but as i say, you will run the risk to overwrite your and your staff main membergroup permissions, so, you must do it with secondary usergroups, and since secondary usergroups are a series of numbers, it requires another mysql structure, which is what im trying to figure out without adding extra queries
Reply With Quote
  #13  
Old 02-12-2010, 07:00 PM
DaPro DaPro is offline
 
Join Date: Jan 2003
Location: CT, USA
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by White_Snake View Post
yes, that code will do exactly what you want, but as i say, you will run the risk to overwrite your and your staff main membergroup permissions, so, you must do it with secondary usergroups, and since secondary usergroups are a series of numbers, it requires another mysql structure, which is what im trying to figure out without adding extra queries
I still don't see how that could happen and that code didn't work, it doesn't like something listed in it. Is there a debugger I could see if any errors are happening?
Reply With Quote
  #14  
Old 02-12-2010, 07:07 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DaPro View Post
I still don't see how that could happen and that code didn't work, it doesn't like something listed in it. Is there a debugger I could see if any errors are happening?
i will explain you how could it happen, and about the debug, you can turn on the debug mode just in the same way it can be turned on for vbulletin 3



your code is overwritting that part, the primary usergroup instead of just adding a new option into the aditional usergroup
Reply With Quote
  #15  
Old 02-12-2010, 07:10 PM
DaPro DaPro is offline
 
Join Date: Jan 2003
Location: CT, USA
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Haha, I know what it's overwriting, I am not dumb. But what I am saying is THIS

PHP Code:
 AND $vbulletin->userinfo['usergroupid'] == '2' 
Should stop it, because I am not using any additional usergroups, only primary usergroups for admins, staff, mods, etc. Everyone has their own PRIMARY usergroup.
Reply With Quote
  #16  
Old 02-12-2010, 07:17 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DaPro View Post
Haha, I know what it's overwriting, I am not dumb. But what I am saying is THIS

PHP Code:
 AND $vbulletin->userinfo['usergroupid'] == '2' 
Should stop it, because I am not using any additional usergroups, only primary usergroups for admins, staff, mods, etc. Everyone has their own PRIMARY usergroup.
okay, lets see then, the last piece of code you posted should work, and i just spotted a error on your mysql query:

PHP Code:
$vbulletin->db->query_write(
        UPDATE " 
TABLE_PREFIX "user     
        SET usergroupid = 10  
        WHERE userid = 
{$vbulletin->userinfo['userid']} 
    "
); 
should be:

PHP Code:
$vbulletin->db->query_write(
        UPDATE " 
TABLE_PREFIX "user     
        SET usergroupid = 10  
        WHERE userid = " 
$vbulletin->userinfo['userid']. "
    "
); 
same for the other below, hope this helps
Reply With Quote
  #17  
Old 02-12-2010, 07:32 PM
DaPro DaPro is offline
 
Join Date: Jan 2003
Location: CT, USA
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This crap is still not working, man I give up.
Reply With Quote
  #18  
Old 02-12-2010, 07:47 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$vbulletin->db->query_write(
        UPDATE " 
TABLE_PREFIX "user     
        SET usergroupid = '10'  
        WHERE userid = " 
$vbulletin->userinfo['userid']. "
    "
); 
now try it that way, with the 10 in between the lines

as well try to add
PHP Code:
global $vbulletin
at the begining of the script, sometimes hooks answers in very unexpected forms, or try it in another plugin such as MEMBERINFO which should display any user profile, just for the sake to see if there is something wrong with the plugin location it happend to me once :P
Reply With Quote
  #19  
Old 02-12-2010, 09:51 PM
DaPro DaPro is offline
 
Join Date: Jan 2003
Location: CT, USA
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That didn't help either, and I don't know how to set it to MEMBERINFO in the hook?

I decided to just scrap this, because I just realize it's not going to fully do what I want.

--------------- Added [DATE]1266074015[/DATE] at [TIME]1266074015[/TIME] ---------------

Okay, so I actually found this script someone made that works as a cronjob when set as a scheduled task. It worked, BUT people were having access issues once they logged in or did anything, it immediately reverted them back to the registered user usergroup.

Any idea as to why from any advanced coders on here?

PHP Code:
error_reporting(E_ALL & ~E_NOTICE);
if (!
is_object($vbulletin->db))
{
    exit;
}

$tmpA $vbulletin->db->query_read("
SELECT user.userid,user.usergroupid,user.username 
FROM `user`,`userfield` AS field 
WHERE user.usergroupid = 2 
AND user.userid=field.userid 
AND field.field6='Yes'
"
);

while (
$tmpU $vbulletin->db->fetch_array($tmpA))
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user
        SET usergroupid = 10 
        WHERE userid = " 
$tmpU['userid']);
}




$tmpA $vbulletin->db->query_read("
SELECT user.userid,user.usergroupid,user.username 
FROM `user`,`userfield` AS field 
WHERE user.usergroupid = 10 
AND user.userid=field.userid 
AND field.field6='No'
"
);

while (
$tmpU $vbulletin->db->fetch_array($tmpA))
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user
        SET usergroupid = 2
        WHERE userid = " 
$tmpU['userid']);

Reply With Quote
  #20  
Old 02-14-2010, 03:47 PM
DaPro DaPro is offline
 
Join Date: Jan 2003
Location: CT, USA
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would anyone mind helping me out?
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 02:59 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.04584 seconds
  • Memory Usage 2,306KB
  • 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
  • (9)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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