collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 755
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Adding group requests to ?  (Read 5384 times)

0 Members and 1 Guest are viewing this topic.

Offline ianus

  • Semi Newbie
  • *
  • Posts: 21
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Adding group requests to ?
« on: May 04, 2009, 09:24:02 AM »
 Greetings! 

I think, this might be the best board to ask, but the description may be a little bit complicated. 
Actually I?m running a SMF 1.1.4 with an installed TP. Obviously I have to update and like to switch to SP.
(This decision isn?t because of pros & cons of one/or the other portal!) 

Question Intro:
I used to have a custom menu directly under the header-logo. The necessary changes to the SMF index.template (call the .js files for the menu, ?) are made already. 

The menu itself is stored in a separate .php file and the include (menufile) is also done in the index.template.  Until this point, everything is fine.
You can see an working example at a temporary testboard (SP already running): http://www.resmedia.info/forum/index.php   

Question Intro Part 2:
Inside of the menufile I use some request to make sure that some links are shown only to some usergroups.  If you have a look at the menu, you will see the word ?Gruppen?. If a member of a special group is logged in, he will see some more links. If a admin is logged in, he will see an additional link.  Additionally I display links to the login / register page. If a user is logged in, it will show links to the profil page, unred topic, etc instead. 

If you want to see how this is working: (The actual TP page) http://www.firopolis.de/forum/index.php (use testuser as name an pass)

Question Outro: As you can see, the menu is working in general, but it seems that some functions need some additional entries if I want to use them with SP. 

The codepart A: 
At the very top of the menu I have this:
Code: [Select]
global $context, $settings, $options, $txt, $user_info, $scripturl, $modSettings, $memberContext; 
This is the part which should show the login / register links and switch to the user (admin) menu if someone is logged:
Code: [Select]
//Display this menu entry only if user is logged in and point to "Bewohner" Menu below
if ($context['user']['is_logged'])
{echo'
<li><a  rel="Bewohner"> ', $txt['hello_member_ndt'], ' ', $context['user']['name'] , '</a></li>
';
}
//else display links to login / register
else
echo'
<li><a href="http://www.resmedia.info/forum/index.php?action=login">Einloggen</a></li>
<li><a style="color: rgb(204, 0, 0) "text-decoration:blink" ;"href="http://www.resmedia.info/forum/index.php?action=register">Bewohner werden</a></li>
';
//Display this menu entry only if user is admin
if ($context['user']['is_admin'])
{
echo'
<li><a href="http://www.resmedia.info/forum/index.php?action=admin">Admin</a></li>
';
}
 
For some reason I?m able to log in, but after that the menu isn?t changing the display. 

Question A: Ideas to resolve this? 

The codepart B: This link should show an drop-down if a user is member of a special group. 
Code: [Select]
<!--Top Drop Down SG-M -->
<ul id="Gruppen" class="ddsubmenustyle">
';
/* SG-M Start */
      $allowed_groups = array(1, 11);
      $can_see = FALSE;
      foreach ($allowed_groups as $allowed)
  (233)   if (in_array($allowed, $user_info['groups']))
         {
            $can_see = TRUE;
            break;
         }
         
      if ($can_see)
      {
         echo '
<li><a href="http://www.resmedia.info/forum/index.php/?">SG-M</a>
<ul>
<li><a href="http://www.resmedia.info/forum/index.php/?">Ratsversammlung</a></li>
<li><a href="http://www.resmedia.info/forum/index.php/?">Ginnungagap & Juliateilchen</a></li>
<li><a href="http://www.resmedia.info/forum/index.php/?">Taverna</a></li>
</ul>
</li>
';
      }
      else
      {
         //message or section to show if they are not allowed.
         echo '
<li> <a >Keine Gruppenzugehörigkeit</a></li>
';
      }
/* SG-M Ende */
';
</ul>


(I have deleted the links, because I want to keep them private) I have added the (233) only in this example, to make clear which row the error message is pointing to. 

Question B: What is the error in this code?     

Hopefully I have explained clear enough and maybe somebody can give me a hint on how to fix the code. Thanks in advance.


(edit: damm I hate this WYSIWYG thing)
« Last Edit: May 04, 2009, 03:55:46 PM by ianus »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Adding group requests to …
« Reply #1 on: May 04, 2009, 12:03:28 PM »
Where do you add "The codepart B:" codes? Are you sure that the function, you add this in has the $user_info variable in globals?
And slowly, you come to realize... It's all as it should be...

Offline ianus

  • Semi Newbie
  • *
  • Posts: 21
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Re: Adding group requests to ?
« Reply #2 on: May 04, 2009, 01:49:14 PM »
Greetings and thanks for your reply!

The Codepart B is also in the menu.php file.

I think, it's easier to understand if you can see the whole code.

Code: [Select]
global $context, $settings, $options, $txt, $user_info, $scripturl, $modSettings, $memberContext;
echo'
<!-- First Links @ Top Menu -->
<div id="ddtopmenubar" class="solidblockmenu">
<ul>
<li><a href="http://www.firopolis.de/forum/index.php">Portal</a></li>
<li><a href="http://www.firopolis.de/forum/index.php?action=forum" rel="Foren">Foren</a></li>
<li><a rel="Gruppen">Gruppen</a></li>
';
// Login / Register links or the user drop down
if ($context['user']['is_logged'])
{
echo'
<li><a  rel="Bewohner"> ', $txt['hello_member_ndt'], ' ', $context['user']['name'] , '</a></li>
';
}
else
{
echo'
<li><a href="http://www.firopolis.de/forum/index.php?action=login">Einloggen</a></li>
<li><a style="color: rgb(204, 0, 0)" ;"href="http://www.firopolis.de/forum/index.php?action=register">Bewohner werden</a></li>
';
}
if ($context['user']['is_admin'])
{
echo'
<li><a href="http://www.firopolis.de/forum/index.php?action=admin">Admin</a></li>
';
}

/* More Top-Links if necessary*/
echo'
<!-- <li><a >Link Name</a></li>-->
<!-- <li><a  rel="Name 5">Link Name</a></li>-->
</ul>
</div>

// This is where the Drop downs for the Top Menu links are written
// Simple <li> </li> s

<!-- Drop down for the Portal Top-->
//no need for it

<!-- Drop down for the Foren Top-->
<ul id="Foren" class="ddsubmenustyle">
//deleted for this example
</ul>

<!--Drop down for the Groups-->
<ul id="Gruppen" class="ddsubmenustyle">
';
/* SG-M Start */
      $allowed_groups = array(1, 11);
      $can_see = FALSE;
      foreach ($allowed_groups as $allowed)
         if (in_array($allowed, $user_info['groups']))
         {
            $can_see = TRUE;
            break;
         }
         
      if ($can_see)
      {
         echo '
<li><a href="http://www.firopolis.de/forum/index.php/board,88.0.html">SG-M</a>
<ul>
<li><a href="http://www.firopolis.de/forum/index.php/board,92.0.html">Ratsversammlung</a></li>
<li><a href="http://www.firopolis.de/forum/index.php/board,93.0.html">Ginnungagap & Juliateilchen</a></li>
<li><a href="http://www.firopolis.de/forum/index.php/board,94.0.html">Taverna</a></li>
</ul>
</li>
';
      }
      else
      {
         //message or section to show if they are not allowed.
         echo '
<li> <a >Keine Gruppenzugehörigkeit</a></li>
';
      }
/* SG-M Ende */
';
</ul>

';
/*echo'
<!--Top Drop Down Menu 4 -->
<ul id="Name 4" class="ddsubmenustyle">

</ul>*/
/*echo'
<!--Top Drop Down Menu 5 -->
<ul id="Name 5" class="ddsubmenustyle">

</ul>*/

I have deleted most of the links to keep this short.
The necessary js files are called in the index.template itself.


Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Adding group requests to ?
« Reply #3 on: May 04, 2009, 01:54:58 PM »
It should be working. At least, it shouldn't be giving any errors, unless something is modifying $user_info['groups']. Would make this change and copy here what you see:

Code: (Find) [Select]
echo'
<!-- First Links @ Top Menu -->

Code: (Replace) [Select]
var_dump($user_info['groups']);
echo'
<!-- First Links @ Top Menu -->
And slowly, you come to realize... It's all as it should be...

Offline ianus

  • Semi Newbie
  • *
  • Posts: 21
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Re: Adding group requests to …
« Reply #4 on: May 04, 2009, 02:01:11 PM »
Hello!

As mentioned, it is working (SMF +TP)
http://www.firopolis.de/forum/index.php

For the switch to SP, I try the "old" code to make sure that it is working under the new Portal also.

I have replaced the line you have send me and thr result is
"NULL"
Here it is: http://www.resmedia.info/forum/index.php

Mmh, at least interesting.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Adding group requests to ?
« Reply #5 on: May 04, 2009, 02:12:05 PM »
Well, there seems to be something that un-sets the $user_info['groups'] index. Do you have any other custom codes like this?
And slowly, you come to realize... It's all as it should be...

Offline ianus

  • Semi Newbie
  • *
  • Posts: 21
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Re: Adding group requests to ?
« Reply #6 on: May 04, 2009, 02:26:30 PM »
Not in this enviroment.
I don't use any custom block-codes.
I have only deleted some parts of the SMF header code in the index.template and changed some colors in the css file.

At the moment I have put in the template_menu(); into the index.template again and the links to the admin menu is shown.

I think, I will run a new setup of SMF and SP again.

It is possible that the navigation folder must be under
domain/SMF/navigation/portalmenu.php
and not under
domain/navigation/portalmenu.php
?
« Last Edit: May 04, 2009, 02:29:57 PM by ianus »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Adding group requests to ?
« Reply #7 on: May 04, 2009, 02:33:52 PM »
If the directory was not correct, you wouldn't have seen anything at all. However, what do you have in that file? All the codes you posted above? Or do you include it in somewhere?
And slowly, you come to realize... It's all as it should be...

Offline ianus

  • Semi Newbie
  • *
  • Posts: 21
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Re: Adding group requests to ?
« Reply #8 on: May 04, 2009, 02:43:12 PM »
In the index.template I call the CSS and js files.
Code: [Select]
<!-- Hole Menu css -->
<link rel="stylesheet" type="text/css" href="http://www.resmedia.info/navigation/ddlevelsfiles/ddlevelsmenu-base.css" />
<link rel="stylesheet" type="text/css" href="http://www.resmedia.info/navigation/ddlevelsfiles/ddlevelsmenu-topbar.css" />
<link rel="stylesheet" type="text/css" href="http://www.resmedia.info/navigation/ddlevelsfiles/ddlevelsmenu-sidebar.css" />
<!-- Hole Menu js -->
<script type="text/javascript" src="http://www.resmedia.info/navigation/ddlevelsfiles/ddlevelsmenu.js">

/***********************************************
* All Levels Navigational Menu- (c) Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>
<script type="text/javascript">
ddlevelsmenu.setup("ddtopmenubar", "topbar") //ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
</script>

</head>
And include the navigation file some rows later
Code: [Select]
<body>
<div id="addbackground"/>
<div id="borderartone"/>
<div id="borderarttwo"/>';
echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' : '', '>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="" height="32">';

/*if (empty($settings['header_logo_url']))
echo '
<span style="font-family: Verdana, sans-serif; font-size: 140%; ">', $context['forum_name'], '</span>';
else*/
echo '
<img src="', $settings['images_url'], '/LogoVersion50.png" width="600" style="float: left;" alt="" />';

/*echo '
</td>
<td align="right" class="catbg">
<img src="', $settings['images_url'], '/smflogo.gif" style="margin: 2px;" alt="" />
</td>
</tr>
</table>';*/
echo '
</tr><tr> </td>
<td align="left" valign="center" class="catbg">
'; include ("http://www.resmedia.info/navigation/portal_top.php"); echo'
</td>
</tr>
</table>';


/* // display user name

That it.
Everything else is in the menu file (the code I have posted above).

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Adding group requests to ?
« Reply #9 on: May 04, 2009, 02:49:04 PM »
Instead of URL here:

include ("http://www.resmedia.info/navigation/portal_top.php");

You should use the directory, something like this:

include ("home/www/navigation/portal_top.php");

Also, I think you should include SSI.php in your portal_top.php file. Otherwise, you won't have SMF variables in that file.
And slowly, you come to realize... It's all as it should be...

Offline ianus

  • Semi Newbie
  • *
  • Posts: 21
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Re: Adding group requests to ?
« Reply #10 on: May 04, 2009, 03:55:21 PM »
Very interesting.

The different include (path) solves the problem.
For a php moron like me, this is a miracle but know I have learned something that will be helpfull for other include (things).

I have to send you a very big "Thank You!" for your time and kind helpfulness. It's really appreciated.