phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Mod/Admin-forums not shown in the forum-dropdown?

Goto page Previous  1, 2
 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Nov 04, 2009 8:15 am 
Post subject: Re: Mod/Admin-forums not shown in the forum-dropdown?

My moderators are organized in a group. So, if the group has mod-rights for several forums then all mods see those forums.

Thank you for trying!

Code:
function make_jumpbox($action, $match_forum_id = 0)
{
   $list = array();
   return make_jumpbox_ref($action, $match_forum_id, $list);
}

function make_jumpbox_ref($action, $match_forum_id, &$forums_list)
{
   global $template, $userdata, $lang, $db, $phpEx, $SID;

//   $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);

   $sql = "SELECT c.cat_id, c.cat_title, c.cat_order
      FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
      WHERE f.cat_id = c.cat_id
      GROUP BY c.cat_id, c.cat_title, c.cat_order
      ORDER BY c.cat_order";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql);
   }

   $category_rows = array();
   while ( $row = $db->sql_fetchrow($result) )
   {
      $category_rows[] = $row;
   }

   if ( $total_categories = count($category_rows) )
   {
      $sql = "SELECT *
         FROM " . FORUMS_TABLE . "
         ORDER BY cat_id, forum_order";
      if ( !($result = $db->sql_query($sql)) )
      {
         message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
      }

      $boxstring = '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $lang['Select_forum'] . '</option>';

      $forum_rows = array();
      while ( $row = $db->sql_fetchrow($result) )
      {
         $forum_rows[] = $row;
         // Begin Simple Subforums MOD
         $forums_list[] = $row;
         // End Simple Subforums MOD
      }

      if ( $total_forums = count($forum_rows) )
      {
         for($i = 0; $i < $total_categories; $i++)
         {
            $boxstring_forums = '';
            for($j = 0; $j < $total_forums; $j++)
            {
               if ( !$forum_rows[$j]['forum_parent'] &&  $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
               {

//               if ( !$forum_rows[$j]['forum_parent'] &&  $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] )
//               {
                     // Begin Simple Subforums MOD
                     $id = $forum_rows[$j]['forum_id'];
                     // End Simple Subforums MOD
            // BEGIN MOD Alternative Description Language
       $selected = ( $forum_rows[$j]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : '';
            $result = select_language_forums(intval($forum_rows[$j]['forum_id']));
       $boxstring_forums .=  '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>';
            while( $row_lang = $db->sql_fetchrow($result) )
            {
              $boxstring_forums .= $row_lang['title'] . '</option>';
            }
       // END MOD Alternative Description Language

                  //
                  // Add an array to $nav_links for the Mozilla navigation bar.
                  // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array.
                  //
                  /* Removed block of code
                  $nav_links['chapter forum'][$forum_rows[$j]['forum_id']] = array (
                     'url' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id']),
                     'title' => $row_lang['title']
                  );
                  */
                  // Begin Simple Subforums MOD
                  for( $k = 0; $k < $total_forums; $k++ )
                  {
                     if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$k]['auth_view'] <= AUTH_REG )
                     {
//                     if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$k]['forum_id']]['auth_view'] )
//                     {
                        $selected = ( $forum_rows[$k]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : '';
                        $boxstring_forums .=  '<option value="' . $forum_rows[$k]['forum_id'] . '"' . $selected . '>-- ' . $forum_rows[$k]['forum_name'] . '</option>';

                        //
                        // Add an array to $nav_links for the Mozilla navigation bar.
                        // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array.
                        //
                        /* Removed block of code
                        $nav_links['chapter forum'][$forum_rows[$k]['forum_id']] = array (
                           'url' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$k]['forum_id']),
                           'title' => $forum_rows[$k]['forum_name']
                        );
                        */
                     }
                  }
                  // End Simple Subforums MOD

               }
            }

            if ( $boxstring_forums != '' )
            {
               $boxstring .= '<option value="-1">&nbsp;</option>';
               $boxstring .= '<option value="-1">' . $category_rows[$i]['cat_title'] . '</option>';
               $boxstring .= '<option value="-1">----------------</option>';
               $boxstring .= $boxstring_forums;
            }
         }
      }

      $boxstring .= '</select>';
   }
   else
   {
      $boxstring .= '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"></select>';
   }

   // Let the jumpbox work again in sites having additional session id checks.
   //   if ( !empty($SID) )
   //   {
         $boxstring .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
   //   }

   $template->set_filenames(array(
      'jumpbox' => 'jumpbox.tpl')
   );
   $template->assign_vars(array(
      'L_GO' => $lang['Go'],
      'L_JUMP_TO' => $lang['Jump_to'],
      'L_SELECT_FORUM' => $lang['Select_forum'],

      'S_JUMPBOX_SELECT' => $boxstring,
      'S_JUMPBOX_ACTION' => append_sid($action))
   );
   $template->assign_var_from_handle('JUMPBOX', 'jumpbox');

   return;
}
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Wed Nov 04, 2009 8:55 am 
Post subject: Re: Mod/Admin-forums not shown in the forum-dropdown?

Code:
FIND:
               if ( !$forum_rows[$j]['forum_parent'] &&  $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
               {

REPLACE WITH:
               if ( !$forum_rows[$j]['forum_parent'] &&  $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && (
                  $forum_rows[$j]['auth_view'] == AUTH_ALL
                  || ( $forum_rows[$j]['auth_view'] <= AUTH_REG && $userdata['session_logged_in'] )
                  || ( $forum_rows[$j]['auth_view'] <= AUTH_MOD && $userdata['user_level'] == MOD )
                  || ( $userdata['user_level'] == ADMIN )
                  ) )
               {

FIND:
                     if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$k]['auth_view'] <= AUTH_REG )
                     {

REPLACE WITH:
                     if ( $forum_rows[$k]['forum_parent'] == $id &&  $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && (
                        $forum_rows[$k]['auth_view'] == AUTH_ALL
                        || ( $forum_rows[$k]['auth_view'] <= AUTH_REG && $userdata['session_logged_in'] )
                        || ( $forum_rows[$k]['auth_view'] <= AUTH_MOD && $userdata['user_level'] == MOD )
                        || ( $userdata['user_level'] == ADMIN )
                        ) )
                     {



Full code (I reintended the code for easier readibility, it is incompatible with most mods by now anyway):
Code:

function make_jumpbox($action, $match_forum_id = 0)
{
   $list = array();
   return make_jumpbox_ref($action, $match_forum_id, $list);
}

function make_jumpbox_ref($action, $match_forum_id, &$forums_list)
{
   global $template, $userdata, $lang, $db, $phpEx, $SID;

//   $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);

   $sql = "SELECT c.cat_id, c.cat_title, c.cat_order
      FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
      WHERE f.cat_id = c.cat_id
      GROUP BY c.cat_id, c.cat_title, c.cat_order
      ORDER BY c.cat_order";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql);
   }

   $category_rows = array();
   while ( $row = $db->sql_fetchrow($result) )
   {
      $category_rows[] = $row;
   }

   if ( $total_categories = count($category_rows) )
   {
      $sql = "SELECT *
      FROM " . FORUMS_TABLE . "
      ORDER BY cat_id, forum_order";
      if ( !($result = $db->sql_query($sql)) )
      {
      message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
      }

      $boxstring = '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $lang['Select_forum'] . '</option>';

      $forum_rows = array();
      while ( $row = $db->sql_fetchrow($result) )
      {
         $forum_rows[] = $row;
// Begin Simple Subforums MOD
         $forums_list[] = $row;
// End Simple Subforums MOD
      }

      if ( $total_forums = count($forum_rows) )
      {
         for($i = 0; $i < $total_categories; $i++)
         {
            $boxstring_forums = '';
            for($j = 0; $j < $total_forums; $j++)
            {
               if ( !$forum_rows[$j]['forum_parent'] &&  $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && (
                  $forum_rows[$j]['auth_view'] == AUTH_ALL
                  || ( $forum_rows[$j]['auth_view'] <= AUTH_REG && $userdata['session_logged_in'] )
                  || ( $forum_rows[$j]['auth_view'] <= AUTH_MOD && $userdata['user_level'] == MOD )
                  || ( $userdata['user_level'] == ADMIN )
                  ) )
               {

//               if ( !$forum_rows[$j]['forum_parent'] &&  $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] )
//               {
// Begin Simple Subforums MOD
                  $id = $forum_rows[$j]['forum_id'];
// End Simple Subforums MOD
// BEGIN MOD Alternative Description Language
                  $selected = ( $forum_rows[$j]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : '';
                  $result = select_language_forums(intval($forum_rows[$j]['forum_id']));
                  $boxstring_forums .=  '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>';
                  while( $row_lang = $db->sql_fetchrow($result) )
                  {
                     $boxstring_forums .= $row_lang['title'] . '</option>';
                  }
// END MOD Alternative Description Language

                  //
                  // Add an array to $nav_links for the Mozilla navigation bar.
                  // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array.
                  //
                  /* Removed block of code
                  $nav_links['chapter forum'][$forum_rows[$j]['forum_id']] = array (
                  'url' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id']),
                  'title' => $row_lang['title']
                  );
                  */
// Begin Simple Subforums MOD
                  for( $k = 0; $k < $total_forums; $k++ )
                  {
                     if ( $forum_rows[$k]['forum_parent'] == $id &&  $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && (
                        $forum_rows[$k]['auth_view'] == AUTH_ALL
                        || ( $forum_rows[$k]['auth_view'] <= AUTH_REG && $userdata['session_logged_in'] )
                        || ( $forum_rows[$k]['auth_view'] <= AUTH_MOD && $userdata['user_level'] == MOD )
                        || ( $userdata['user_level'] == ADMIN )
                        ) )
                     {
//                     if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$k]['auth_view'] <= AUTH_REG )
//                     if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$k]['forum_id']]['auth_view'] )
//                     {
                        $selected = ( $forum_rows[$k]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : '';
                        $boxstring_forums .=  '<option value="' . $forum_rows[$k]['forum_id'] . '"' . $selected . '>-- ' . $forum_rows[$k]['forum_name'] . '</option>';
      
                        //
                        // Add an array to $nav_links for the Mozilla navigation bar.
                        // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array.
                        //
                        /* Removed block of code
                        $nav_links['chapter forum'][$forum_rows[$k]['forum_id']] = array (
                           'url' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$k]['forum_id']),
                           'title' => $forum_rows[$k]['forum_name']
                        );
                        */
                     }
                  }
// End Simple Subforums MOD

               }
            }
   
            if ( $boxstring_forums != '' )
            {
               $boxstring .= '<option value="-1">&nbsp;</option>';
               $boxstring .= '<option value="-1">' . $category_rows[$i]['cat_title'] . '</option>';
               $boxstring .= '<option value="-1">----------------</option>';
               $boxstring .= $boxstring_forums;
            }
         }
      }

      $boxstring .= '</select>';
   }
   else
   {
      $boxstring .= '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"></select>';
   }

   // Let the jumpbox work again in sites having additional session id checks.
   //   if ( !empty($SID) )
   //   {
      $boxstring .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
   //   }

   $template->set_filenames(array(
      'jumpbox' => 'jumpbox.tpl')
   );
   $template->assign_vars(array(
      'L_GO' => $lang['Go'],
      'L_JUMP_TO' => $lang['Jump_to'],
      'L_SELECT_FORUM' => $lang['Select_forum'],

      'S_JUMPBOX_SELECT' => $boxstring,
      'S_JUMPBOX_ACTION' => append_sid($action))
   );
   $template->assign_var_from_handle('JUMPBOX', 'jumpbox');

   return;
}

_________________
Comboa Twitter
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Nov 04, 2009 9:01 am 
Post subject: Re: Mod/Admin-forums not shown in the forum-dropdown?

Result:
Quote:
Parse error: syntax error, unexpected '[' in /var/www/vhosts/***.net/httpdocs/includes/functions.php on line 261
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Wed Nov 04, 2009 9:21 am 
Post subject: Re: Mod/Admin-forums not shown in the forum-dropdown?

Ah, typo: add $ before both of the two userdata['session_logged_in'] icon_smile.gif

Also fixed the code post.

_________________
Comboa Twitter
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Nov 04, 2009 9:31 am 
Post subject: Re: Mod/Admin-forums not shown in the forum-dropdown?

VERY cool! Thanks a lot!
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Wed Nov 04, 2009 5:42 pm 
Post subject: Re: Mod/Admin-forums not shown in the forum-dropdown?

Holger wrote:
So, how do I get it back in?

Open includes/functions.php

FIND
Code:

function make_jumpbox($action, $match_forum_id = 0)
{
   global $template, $userdata, $lang, $db, $nav_links, $phpEx, $SID;

//   $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);


REPLACE WITH
Code:

function make_jumpbox($action, $match_forum_id = 0)
{
   global $template, $userdata, $lang, $db, $nav_links, $phpEx, $SID;

   $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);


FIND
Code:

               if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
               {

//               if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] )
//               {


REPLACE WITH
Code:

               if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] )
               {

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield ILMac 512K BlogMac GUI
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 2 of 2 All times are GMT
Goto page Previous  1, 2
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0333 seconds using 15 queries. (SQL 0.0024 Parse 0.0009 Other 0.0300)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo