1
balsimar
Group permission check in theme.html?
  • 2006/6/16 18:36

  • balsimar

  • Just popping in

  • Posts: 13

  • Since: 2005/11/30


Hi!

I'm working on modifing a theme (obscene_v3) to fit my needs. This theme includes a top nav bar, which is perfect. However, I want to add a permissions check for the nav elements.

Here is the current code in the theme:
<td><table id="obNav" cellspacing="0">
          <
tr>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/">HOME</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/wiwimod/">INFORMATION BOOTH</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/wowroster/" >ROSTER</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/minidkp/">DKP</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/minibanker/">BANK</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/xoopsgallery/">GALLERY</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/newbb/">FORUMS</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/miniraids/">RAIDS</a></td>
            <
td class="obNavWidth" ><a href="<{$xoops_url}>/modules/liaise/">GUILD APPLICATION</a></td>
          </
tr>
      </
table></td>


Basically, I want to hide things like the RAIDS link from Anonymous and registered users. and only show the "GUILD APPLICATION" link to registered users.

Obviously, I could do this with PHP using the group data from userinfo, however I can't seem to break out into php code to do any work. (The theme just prints the code, rather than process it)

Is there any way I can do what I want to do?

2
JMorris
Re: Group permission check in theme.html?
  • 2006/6/16 21:21

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Wrap your PHP code in the following tags

<{php}>
echo 
"Hello World!";
<{/
php}>


There are also built in Smarty variables that will present data based on groups (well, somewhat).

<{if $xoops_isadmin}>
<!--Do 
This-->
<{else}>
<!--Do 
That-->
<{/if}>

<{if 
$xoops_isuser}>
<!--Do 
This-->
<{else}>
<!--Do 
That-->
<{/if}>


HTH.

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

3
balsimar
Re: Group permission check in theme.html?
  • 2006/6/16 22:33

  • balsimar

  • Just popping in

  • Posts: 13

  • Since: 2005/11/30


That does help! Thanks.

Only problem I see now, is I don't seem to have access to $xoopsUser. Everytime I try to use it, I get a white page.

4
msdana
Re: Group permission check in theme.html?
  • 2006/6/16 22:49

  • msdana

  • Just can't stay away

  • Posts: 817

  • Since: 2005/12/11


Based on themes I have done, I use this:

Quote:
<{if $xoops_isadmin}> and <{if !$xoops_isuser}>


Notice the exclamation point.

I apologize in advance if it doesn't work for you, but it does work for me when hard coding the login/register information in the theme.html.

HTH
[size=x-small]If God is watching us, the least we can do is be entertaining.[/size]
Graphic Worx : Xoops Themes

5
balsimar
Re: Group permission check in theme.html?
  • 2006/6/16 22:58

  • balsimar

  • Just popping in

  • Posts: 13

  • Since: 2005/11/30


Quote:

msdana wrote:
Based on themes I have done, I use this:

Quote:
<{if $xoops_isadmin}> and <{if !$xoops_isuser}>


Notice the exclamation point.

I apologize in advance if it doesn't work for you, but it does work for me when hard coding the login/register information in the theme.html.

HTH


Yes, I have that part, thank you. I'm needing explicit group memberships as well. I have items outside of a block that I want to be visible, conditional on specific group membership.

I can't seem to get $xoopsUser to work in the theme, when I access it I get a white page.. Here is an example of code that breaks the page:

<{if $xoops_isuser}>
        <{
php}>
                
$Groups $xoopsUser->getGroups();
        <{/
php}>
<{/if}>

6
msdana
Re: Group permission check in theme.html?
  • 2006/6/16 23:06

  • msdana

  • Just can't stay away

  • Posts: 817

  • Since: 2005/12/11


uhmmm, no. You don't have the exclamation point that I clearly pointed out and noted in my first post.

Quote:
<{if !$xoops_isuser}>


Again, try that, it may work if you put the exclamation point in there.
[size=x-small]If God is watching us, the least we can do is be entertaining.[/size]
Graphic Worx : Xoops Themes

7
balsimar
Re: Group permission check in theme.html?
  • 2006/6/17 1:17

  • balsimar

  • Just popping in

  • Posts: 13

  • Since: 2005/11/30


Quote:

msdana wrote:
uhmmm, no. You don't have the exclamation point that I clearly pointed out and noted in my first post.

Quote:
<{if !$xoops_isuser}>


Again, try that, it may work if you put the exclamation point in there.


no... you do realize what that does, right?

!$xoops_isuser ... means the same as "$xoops_isuser does not exist".

This has no bearing on the fact that I can't seem to use $xoopsUser in the theme file.

8
stefan88
Re: Group permission check in theme.html?
  • 2008/8/8 4:31

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Quote:
I can't seem to get $xoopsUser to work in the theme, when I access it I get a white page.. Here is an example of code that breaks the page:


<{if $xoops_isuser}> 
        <{
php}> 
                
$Groups $xoopsUser->getGroups(); 
        <{/
php}> 
<{/if}>




what about:

<{if $xoops_isuser}> 
        <{
php}> 
            [
b][color=FF0000]GLOBAL $xoopsUser;[/color][/b]
                
$Groups $xoopsUser->getGroups(); 
        <{/
php}> 
<{/if}>
..

Login

Who's Online

148 user(s) are online (90 user(s) are browsing Support Forums)


Members: 0


Guests: 148


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits