vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   PLEASE HELP!! How do you access the $_FORUMOPTIONS['showonforumjump'] (https://vborg.vbsupport.ru/showthread.php?t=75093)

dwh 01-25-2005 03:32 PM

PLEASE HELP!! How do you access the $_FORUMOPTIONS['showonforumjump']
 
I'm trying to write some code that pulls up only the forum that the current user can use, NOT including the forums the current user is not allowed to view and NOT including the forums that are not
PHP Code:

$_FORUMOPTIONS['showonforumjump'

.

I was doing great by copying the routine from the /archive/global.php subroutine for getting foruminfo. The only problem is there was nothing about 'showonforumjump'. So I went to the functions.php subroutine and all it says there is
PHP Code:

!($forumcache["$forumid"]['options'] & $_FORUMOPTIONS['showonforumjump']) 

If I try to copy that into my new subroutine, it doesn't work at all. If I print it out, all it says is 65536, regardless which forum, even forums marked as not showonforumjump.

There must be some way to access this. That's why I keep saying the permission system in vb is very good, but how the hell does it work?

Thank you in advance for any help you can offer.

Andreas 01-25-2005 03:49 PM

Hmm, does work for me:

PHP Code:

<?php
require_once('./global.php');
foreach (
$forumcache AS $forumid => $forum) {
  echo 
intval(!($forumcache[$forumid]['options'] & $_FORUMOPTIONS['showonforumjump'])) . '<br>';
}
?>


dwh 01-25-2005 04:02 PM

Here's my code. It all prints out the same permission even for forums I know are not showonforumjump. What did I do wrong?

PHP Code:

    // function to list forums 
       
function print_my_forum_list($parentid = -1)
       {
         global 
$DB_site$session$vboptions$bbuserinfo$iforumcache$_FORUMOPTIONS$myforumbits;
           if (!
is_array($iforumcache))
           {
               
$forums $DB_site->query("
                 SELECT forumid, title, link, parentid, displayorder,
              (options & 
$_FORUMOPTIONS[cancontainthreads]) AS cancontainthreads
                 FROM " 
TABLE_PREFIX "forum AS forum
                 WHERE displayorder <> 0 AND
                   password = '' AND
                 (options & 
$_FORUMOPTIONS[active])
                   ORDER BY displayorder
               "
);
               
$iforumcache = array();
               while (
$forum $DB_site->fetch_array($forums))
               {
          
$iforumcache["$forum[parentid]"]["$forum[displayorder]"]["$forum[forumid]"] = $forum;
               }
               unset(
$forum);
               
$DB_site->free_result($forums);
           }
           if (
is_array($iforumcache["$parentid"]))
           {
               foreach(
$iforumcache["$parentid"] AS $x)
               {
                 foreach(
$x AS $forumid => $forum)
                   {
                  if (!(
$bbuserinfo['forumpermissions']["$forumid"] & CANVIEW) AND $vboptions['hideprivateforums'])
                       {
                         continue;
                       }
                       else
                       {
                      if (
$forum['link'] !== '')
                         {
                       continue;
                         }
                      else if (
$forum['cancontainthreads'])
                         {
                       
$myforumbits.="<br>$forumid - $forum[title] - ";
                       
//TEST print out permissions for showonforumjump
                       
echo "<br>$forumid - $forum[title] - <b>".$_FORUMOPTIONS['showonforumjump']."</b>";
                         }
                   
print_my_forum_list($forumid);
                       }
                   }
               }
           }
       }
       
print_my_forum_list(); 


Andreas 01-25-2005 04:13 PM

PHP Code:

echo "<br>$forumid - $forum[title] - <b>".$_FORUMOPTIONS['showonforumjump']."</b>"

Well, $_FORUMOPTIONS['showonforumjump'] is 65536 so you shouldn't be surprised if it does display 65536 ;)

I think you want this:
PHP Code:

echo "<br>$forumid - $forum[title] - <b>"intval($forum['options'] & $_FORUMOPTIONS['showonforumjump']) ."</b>"

But for this to work, $iforumcache must have options - which currently doesn't seem to be (it is not included in the query).
So either include it their, or directly check the bit in the query (like as it is done with cancontainthreads)

dwh 01-25-2005 04:28 PM

Thank you I figured it out and got it working :)


All times are GMT. The time now is 12:45 AM.

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.02262 seconds
  • Memory Usage 1,752KB
  • 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
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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