Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2005, 03:32 PM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 01-25-2005, 03:49 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>';
}
?>
Reply With Quote
  #3  
Old 01-25-2005, 04:02 PM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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(); 
Reply With Quote
  #4  
Old 01-25-2005, 04:13 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
  #5  
Old 01-25-2005, 04:28 PM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you I figured it out and got it working
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 10:30 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.03913 seconds
  • Memory Usage 2,234KB
  • 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
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete