11
Dave_L
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?
  • 2006/8/3 10:49

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Quote:
To use the group name instead of its ID/number isn't recommended: the groupd Id will always stay the same, while you may want to change its display name in the future, whitout having to change all your templates.


That depends on your point of view.

If groups are removed and added again, the IDs will change.

12
irmtfan
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?
  • 2006/8/3 14:30

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Leostotch:
i have problem with this code.
put it in a the profile module "userinfo.html" template.
but the if statment is always true and show all groups for users.
also as dave said there must be a way to show group name. can it be done with another smarty code?

13
bluescreen
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?
  • 2006/11/7 9:35

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


Is there an easy way to quickly modify to use this within a module instead of template? In other words how could I take this and then make a PHP If Statement to lets say redirect the page based on the group? I know nothing about PHP but this is something I could use for my site so that it would redirect the main page based on UserGroup. And MyHome has already been offered to me... have it. The redirect doesn't work, and it only does it based on 2 groups. Not 3 or 4 like I need.

14
tylerjordan
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?
  • 2007/5/24 14:02

  • tylerjordan

  • Just popping in

  • Posts: 9

  • Since: 2007/2/27


Quote:

leostotch wrote:


Now you can test if the user is a member of a specific group using something like this in your templates:
Quote:
<{if 1|in_array:$xoops_usergroups}>User is a member of group 1<{/if}>
<{if 2|in_array:$xoops_usergroups}>User is a member of group 2<{/if}>


To use the group name instead of its ID/number isn't recommended: the groupd Id will always stay the same, while you may want to change its display name in the future, whitout having to change all your templates.


I've tried this everyway but sideways and I always get the blank white screen of death - surely I have something configured wrong?! I'm attempting to build a custom main menu block. . .can this code go into the block? I assume so. I've also tried replacing the modules/system/templates/blocks/system_block_mainmenu.html file with my own menu system - still get the blank white screen of death. . .any clues?

Cheers, Tyler

15
MIchaelMcA
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?
  • 2007/6/8 8:37

  • MIchaelMcA

  • Just popping in

  • Posts: 13

  • Since: 2005/5/1 1


I'm sure that's probably just a syntax error - have you sorted it out yet?

leostotch - that was great! well done. This or something similar definitley needs to be in the XOOPS core

16
nachenko
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?
  • 2007/6/8 10:05

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


Quote:
<{if 1|in_array:$xoops_usergroups}>User is a member of group 1<{/if}>


Try this:

in_array($xoops_usergroups)


BTW, that always gave true for me no matter what group I evaluated, don't know why. I ended doing a foreach loop and traversing the whole $xoops_usergroups array.


Oh, and be sure the $xoops_usergroups array is defined in header.php, not in the footer.php, or it will be defined too late for some uses.


BTW I just tested this hack in an old site with XOOPS 2.0.7.3, perhaps template engine works a bit different now.

17
Ario_Barzan
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?

Well that`s great but is still not working well!
actually i want to make a table on my theme and add a function for guest users, is there any smarty for guest user to use in a xo-theme??
i`ve tried these codes above but still no solution it just shows the message for all groups

18
vaughan
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?
  • 2007/7/27 16:02

  • vaughan

  • Friend of XOOPS

  • Posts: 680

  • Since: 2005/11/26


Quote:

Ario_Barzan wrote:
Well that`s great but is still not working well!
actually i want to make a table on my theme and add a function for guest users, is there any smarty for guest user to use in a xo-theme??
i`ve tried these codes above but still no solution it just shows the message for all groups


<{if !$xoops_isuser}>
your data
<{/if}>


the ! makes it a negative meaning if it isn't instead of it is.

19
Ario_Barzan
Re: $xoops_isadmin, $xoops_isuser, but $xoops_?

thx a lot dear vaughan

20
tallpaul
Re: $xoops_isadmin, $xoops_isuser, but $xoops_<custom group>?
  • 2008/7/11 15:47

  • tallpaul

  • Just popping in

  • Posts: 3

  • Since: 2008/7/11


This is great! Would there be a way to do this for an individual user...Im a webmaster, but there's a couple other webmasters on the site I work on, and I would like to have a couple of things in my theme so only I would have a slightly different layout.
Also, Im really new to xoops, so if somebody could lay it all out for me, like leoscotch did (thanks for that!)
Thank y'all!

Login

Who's Online

209 user(s) are online (142 user(s) are browsing Support Forums)


Members: 0


Guests: 209


more...

Donat-O-Meter

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

Latest GitHub Commits