vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   help needed with forumpermission custom coding! (https://vborg.vbsupport.ru/showthread.php?t=45279)

marocnl 11-01-2002 11:46 AM

help needed with forumpermission custom coding!
 
Hello Guys,

Can somebody help me with the following problem:

What i try to do is:

i want to exclude some forums for the visitors ( i know there is a simple way in the admin panel, but for specific reasons i have to do it this way) here is what i wrote:

PHP Code:

// Added by NL-X to shield from invisible forums (see config.php)
global $visibleForums;
$nlxQuery=$DB_site->query("select forumid, 0 as canview, 0 as canpostnew from forum where forumid not in (" $visibleForums ")");
while (
$nlxRow=$DB_site->fetch_array($nlxQuery)) {
  
$ipermcache["$nlxRow[forumid]"]=$nlxQuery;
  echo 
$nlxRow[forumid] . "<br>";
}
// End adding by NL-X 

i put this in the forums/index.php right after:

PHP Code:

//Forum perms
$forumperms=$DB_site->query("SELECT forumid,canview,canpostnew FROM forumpermission WHERE usergroupid='$bbuserinfo[usergroupid]'");
while (
$forumperm=$DB_site->fetch_array($forumperms)) {
  
$ipermcache["$forumperm[forumid]"] = $forumperm;


In config.php is added this:

PHP Code:

// Added by NL-X to make other forums invisible. (To be able to use more vb's with one database, and have each vb have its own visible forums.)
// which forums should be visible, seperated by comma's. (Don't forget to add new forums here to make them active!) Do not leave empty. 
$visibleForums "4";
// End adding by NL-X
?> 

So the only forum that i should see when i go to the forumhome is the forum with id=4

But someway somehow i see all forums and they are all accessible.

Can someone help me out here?

Thanx in advance

P.S.: I need this as soon as possible

Logician 11-01-2002 11:59 AM

Why dont you just apply some conditionals to the line?

PHP Code:

$ipermcache["$forumperm[forumid]"] = $forumperm

eg.

PHP Code:

if ($bbuserinfo[usergroupid]==AND $forumperm[forumid]==Y)
{
// your custom permissions here..
}
else
{
$ipermcache["$forumperm[forumid]"] = $forumperm;


BTW. IMO this hack looks pointless. You can really do it inside Admin CP just like you have mentioned. Besides this method will only make sure the forum is not visible in the home page, but users will still be able to access them via Jump Menu, User CP or Search page..

Unless this is what you want in the first place..


All times are GMT. The time now is 09:20 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.01012 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete