View Single Post
  #118  
Old 01-17-2006, 05:07 PM
WAR WAR is offline
 
Join Date: Jan 2004
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Logician
Edit wt_wt.php, find:

PHP Code:
print_membergroup_row("Disallowed Usergroups <br><font size='1'>Mark usergroups who can <b>NOT</b> display this page</font>"'webtemplate[banusergroupids]'2""); 
replace it as:
PHP Code:
  $usergroups $vbulletin->db->query_read("SELECT usergroupid,title FROM " TABLE_PREFIX "usergroup ORDER BY title");
  while (
$usergroup $vbulletin->db->fetch_array($usergroups))
  {
             
$usergrps_with_space .= $usergroup[usergroupid]." ";
  }
   
$webtemplatebanusergroups[membergroupids] = convert_WTfield_to_usergroup_array($usergrps_with_space);
  

  
print_membergroup_row("Disallowed Usergroups <br><font size='1'>Mark usergroups who can <b>NOT</b> display this page</font>"'webtemplate[banusergroupids]'2,  $webtemplatebanusergroups); 


Run this query and see if it will help:
PHP Code:
ALTER TABLE `wt35_webtemplateCHANGE `banusergroups` `banusergroupsMEDIUMTEXT NOT NULL ,
CHANGE `logvisitors` `logvisitorsMEDIUMTEXT NOT NULL ,
CHANGE `editors` `editorsMEDIUMTEXT NOT NULL 
Logician,

Thanks for the quick reply and the fix. It worked as far as it was designed, but unfortunately my original request was flawed.

I have 12 "Primary" usergroups. All members belong to at least one of these groups. I also have a couple hundred "Secondary" usergroups, most members belong to several of these each. Using the "Opt-out" paradigm you have here, it is impossible for me to allow access to secondary usergroups without also granting access to entire primary usergroups

Example: If a user is a member of primary group 1 and secondary group A, If I try and block access to Primary Group 1 and allow access to Secondary Group A then the user will still not be allowed access because the way you have it written all users that are in primary group 1 are denied access.

So I re-wrote your permissions function in your include file to switch the whole system to an "Opt-in" paradigm so that it better matches how vbulletin usually treats permissions. Can you take a look at this and let me know if it looks ok? I have tested it out and it seems to work fine. The only thing I needed to disable was the "Restrict individual users" function that you had, other wise granting access to a user with userid = 20 also grants access to the usergroup with usergroupid = 20.

PHP Code:
function WT_UsergroupPermission($userinfo$return10 1$usergroupname '')
{
    global 
$WT;  

    
$permitted 0;

    
$WT['banusergroups'] = trim($WT['banusergroups']);

    if (
$WT['banusergroups'])
    {
        
$WT_banusergroups explode(" "$WT['banusergroups']);
        
        if (
WTis_member_of($userinfo$WT_banusergroups)) 
        {
            
$permitted 1;
        } 
        else 
        {
            
$permitted 0;
        }
        
    
/*    if ($userinfo[userid] > 0 AND in_array('('.$userinfo[userid].')', $WT_banusergroups)) 
        {
            $permitted = 0;
        } */
    
}


    
    if (
$WT['draft'] == AND !WTis_member_of($userinfo, array("6"))) //draft webtemplate
    
{
        
$permitted 0;
    }

    if (
$return10//return 1 or 0
    
{
        return 
$permitted;
    }
    else 
//return usergroup name with color (permitten green, banned red)
    
{
        if (
$permitted
        {
            return 
'<font color="#006600">'.$usergroupname.'</font>';
        }
        else 
        {
            return 
'<font color="#C40000">'.$usergroupname.'</font>';
        }
    }


Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01112 seconds
  • Memory Usage 1,810KB
  • 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
  • (4)bbcode_php
  • (1)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