WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: doekia on March 31, 2008, 03:28:24 PM

Title: show_menu2 patch for multi-group (WB2.7rc2)
Post by: doekia on March 31, 2008, 03:28:24 PM
Hi,

Since the WB2.7RC2 supports - ich - multi-groups here is the patch required to have the show_menu2 to adopt the correct behaviour when a page is marked private for a group and the user group list matches:

Quote from: 'WB2.7RC2-show_menu2-include-php.patch'
--- /home/doekia/WebsiteBaker/wb2.7rc2/wb/modules/show_menu2/include.php    2007-09-06 22:15:28.000000000 +0200
+++ include.php    2008-03-31 15:04:39.000000000 +0200
@@ -485,8 +485,8 @@
         // get this once for performance. We really should be calling only need to
         // call $wb->get_group_id() but that outputs a warning notice if the
         // groupid isn't set in the session, so we check it first here.
-        $currGroup = array_key_exists('GROUP_ID', $_SESSION) ?
-            ','.$wb->get_group_id().',' : 'NOGROUP';
+        $currGroups = array_key_exists('GROUP_ID', $_SESSION) ?
+            $wb->get_groups_id() : array('NOGROUP');
         
         // we request all matching rows from the database for the menu that we
         // are about to create it is cheaper for us to get everything we need
@@ -506,7 +506,7 @@
                 // following limit to the SQL query above:
                 //  (visibility <> "private" OR $wb->get_group_id() IN viewing_groups)
                 if ($page['visibility'] == 'private'
-                    && false === strstr(",{$page['viewing_groups']},", $currGroup))
+                    && count(array_intersect($currGroups,explode(',',$page['viewing_groups']))) == 0 )
                 {
                     continue;
                 }


Hope this helps.
Title: Re: show_menu2 patch for multi-group (WB2.7rc2)
Post by: DGEC on March 31, 2008, 06:03:02 PM
Ah, I wonder if this - partially - explains my menus exploding.

Despite installing in a new setup, at least one of my production sites is messed up, including the menu. I'm not sure if the GENERIC template uses sm2, but regardless, a separate install shouldn't mess up existing ones.
Title: Re: show_menu2 patch for multi-group (WB2.7rc2)
Post by: doc on March 31, 2008, 06:07:12 PM
Hello DGEG,

as far as I know, the Generic templates uses its own menu sysmtem, not the ones implemented with WB (show_menu) or the external show_menu2(). Can you please switch to another template and check if yours sites still gets messed-up? For example simply switch all three sites to the WB template round and test again.

Regards Christian
Title: Re: show_menu2 patch for multi-group (WB2.7rc2)
Post by: bsp4750 on August 04, 2008, 12:16:49 AM
i also have a problem with private pages dosent get displayed when loggin in.
But how do i apply this pathc ??? hop someone can help.

/BSP4750


Never mind i figured it out (removed the lines marked - and insert the lines mark + , and reloaded the modules)
And it works =)