Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by merk merk is offline
Developer Last Online: Mar 2012 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 09-18-2001 Last Update: Never Installs: 9
 
No support by the author.

Purpose: I run many many forums(120+ including subcatagories) so i needed a more efficient way of controlling access masks(there is an infinite combination of usergroups if i was to use that method.)

So set about creating a better system.

For an example, view the attachment. (default setting=green, yes=red, no=blue).

Installation:

First, you need to open up adminfunctions.php in the /admin/ directory and add (just before the ?>)

PHP Code:
// ###################### Start makeoptioncode #######################
function makeoptioncode ($value="",$description$selected=""$color="green") {
// similar to makeinputcode, only for a text area

  
echo "\n<OPTION value=\"$value\" $selected style=\"color:$color\">$description</option>";

Then go into user.php in the /admin/ directory
Go to ~~ 358 and find
PHP Code:
// ###################### Start Edit Access #######################

/*if ($action=="editaccess") { 
Delete everything from that point to
PHP Code:
  doformfooter("Save Changes");

(Thats just the edit access bit, nothing else!)

Then, put where that was
PHP Code:
// ###################### Start accessmasks function #######################
function accessmasks($parentid=-1) {
  global 
$DB_site$userid$forumid;
  
$forums=$DB_site->query("SELECT forumid,title,displayorder FROM forum WHERE parentid=$parentid ORDER BY displayorder");
  while (
$forum=$DB_site->fetch_array($forums)) {
  
$accesslist=$DB_site->query_first("SELECT * FROM access WHERE userid='$userid' AND forumid='$forum[forumid]'");
    if ( 
is_array($accesslist) )
    {if (
$accesslist['accessmask']==0)
      {
$sel 0$tempcolour="blue";}
      elseif (
$accesslist['accessmask']==1)
      {
$sel 1$tempcolour="red";}
      else {
$sel = -1$tempcolour="green";}}
    else
    {
$sel = -1$tempcolour="green";}
    echo 
"<li><div style=\"color:$tempcolour\"><b>$forum[title]</b>";
    echo 
" > > > <SELECT name=\"accessupdate[".$forum['forumid']."]\" style=\"font-size: 7pt; background-color: #dfdfdf; font-family: Arial, Tahoma;\" maxlength=\"20\">";
    
makeoptioncode(1,"Yes",iif($sel==1,"selected",""),"red");
    
makeoptioncode(0,"No",iif($sel==0,"selected",""),"blue");
    
makeoptioncode(-1,"Default",iif($sel==-1,"selected",""),"green");
    echo 
"</select></div>\n\n";
    echo 
"<input type=\"hidden\" name=\"oldcache[".$forum['forumid']."]\" value=\"$sel\">";
    echo 
"<ul>";
    
accessmasks($forum[forumid]);
    echo 
"</ul>\n";
    echo 
"</li>\n";
  }}

// ###################### Start modify #######################
if ($action=="editaccess") {
  
$user=$DB_site->query_first("SELECT username FROM user WHERE userid='$userid'");
  
doformheader("user","updateaccess",0,0);
  
makehiddencode("userid","$userid");
  echo 
"<div align=center><h3>User Forum Access for <i>$user[username]</i></h3></div>";
  echo 
"<tr class='firstalt'><td colspan=2><p>Here you may edit forum access on a user-by-user basis.
  <BR>Selecting \"yes\" will allow this user access to the forum. Selecting \"no\" will deny this user access to the forum. Any changes made to this user's account will override the default permission settings in their usergroup.
  <br><br>Selecting \"default\" will revert this user to the default permissions settings for their usergroup.
  <BR><br>(Please note that the permission inheritance system still works here)
  <br><br>(Ensure that you have access masks enabled before attempting to use these!)</p></td></tr>\n"
;
  echo 
"<br>";
  echo 
"<ul>\n";
  
accessmasks(-1);
  echo 
"</ul>\n";
  
doformfooter("Save Changes");

Thats it!

PS. Devlopers / Moderators - i wasnt sure if i copied and
pasted too much code in the above, well actually i rewrote most
of it, but based on your principles in the modify forums section. If
its too much, please feel free to delete it, but because i didnt
know...!


Demo Screenshot attached

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 09-29-2001, 03:06 AM
kchii
Guest
 
Posts: n/a
Default

I must be missing something... I'm running 2.0.3, and I edited the code as instructed. When I selected Modify Forums, it looks the same as always.
Reply With Quote
  #23  
Old 09-29-2001, 03:19 AM
DarkReaper DarkReaper is offline
 
Join Date: Oct 2001
Posts: 429
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It changes it in /forums/mod. It allows your mods to add certain users to the access list of their forums.
Reply With Quote
  #24  
Old 10-02-2001, 07:20 PM
YourHostSucks
Guest
 
Posts: n/a
Default

Nice look man, Bravo* I like.

Simple couple sec's of editing, and works like a charm..

Thanks!
Reply With Quote
  #25  
Old 05-29-2002, 09:59 AM
Jawelin Jawelin is offline
 
Join Date: Nov 2001
Posts: 557
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very nice hack. I've been using it since you released.... !!

Now I noticed a small 'bug' or problem: there's some conflict about representing red or green light (i.e. retrieving the real permission) to child forum when inheritance is active both to usergroup permissions and access mask.

I definetively think that's due to a strange cache affecting getforumpermission() function (see HERE about).

The scenario is following:
i have a category and subforums; when a usergroup has default access granted to the category but not to the children, and the single user access masks grants that user (within usergroup) the permission to the category, that user is shown as having permission to access the children forum too.
Instead, VB says NO! : I mean, inheritance (both group or mask level) has lower priority than the child forum permission (both group or mask level).
At same level of inheritance, instead, access mask is stronger than usergroup permission...

Hope I explained well enough. That's the problem, but I can't manage to solve it when showing an user whatever able or not to see a given forum...

Thank you for support.

Bye
Reply With Quote
  #26  
Old 06-13-2002, 06:15 AM
Minots's Avatar
Minots Minots is offline
 
Join Date: Jan 2002
Location: Germany
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

THX a lot.
Works fine 4 me. :]
Reply With Quote
  #27  
Old 07-02-2002, 07:50 PM
*AKA*Geo*A* *AKA*Geo*A* is offline
 
Join Date: Dec 2001
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there any way to get this to work in the moderators control panel????
Reply With Quote
  #28  
Old 11-08-2002, 09:46 AM
Alpine_Z Alpine_Z is offline
 
Join Date: Sep 2002
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a great hack, I like it - thanks for sharing
Reply With Quote
  #29  
Old 11-12-2002, 01:12 PM
gggforums gggforums is offline
 
Join Date: Nov 2002
Location: Central Florida
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works great in a virgin install of 2.2.8 - thanks for being my first hack, and a successful one at that!
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 12:57 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04434 seconds
  • Memory Usage 2,307KB
  • Queries Executed 25 (?)
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
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (7)postbit_onlinestatus
  • (9)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