| Joomla! http://forum.joomla.org/ |
|
| Menu's for public and registered visitors http://forum.joomla.org/viewtopic.php?f=39&t=132047 |
Page 1 of 1 |
| Author: | yerg [ Wed Jan 17, 2007 7:44 am ] |
| Post subject: | Menu's for public and registered visitors |
I'm "trying" to set up two menus
I can get this to work with content modules but not menu modules. With the content modules I've replicated newsflash and when the public visit they get a welcome message ... when they login this welcome message disappears (the if statement applies) and is replaced by the registered content. I've achieved this by the following code where user3 is the newsflash component copy. It works fine Code: <?php if( !$my->id ){ mosLoadModules ( 'user3', -1 );}?> <?php mosMainBody(); ?> However I can't achieve the same with the menu modules. What I've got is as follows with user1 being the public only menu and the user2 beign the registered only menu. Code: <?php mosLoadModules ( 'user1' ); ?> <?php if( !$my->id ){ mosLoadModules ( 'user2', -1 );}?> So is there any other way of achieving the outcome? Does anyone know why the if statement works ok for the content modules but not the menu modules? I know I can make registered links on a menu but what I want is the public links to disappear when registered members login. |
|
| Author: | Robin [ Wed Jan 17, 2007 6:40 pm ] |
| Post subject: | Re: Menu's for public and registered visitors |
Hi, I'm no php expert, but am I correct in understanding the following? if( !$my->id ) = user not logged in (! = NOT) if( $my->id ) = user is logged in If so, I would write it like this: Code: <?php if( !$my->id ) mosLoadModules ( 'user1' ); ?> <?php if( $my->id ){ mosLoadModules ( 'user2', -1 );}?> user1 only gets loaded when user is not logged in, hence a public menu. Once logged in, it should disappear. user gets loaded when a user is logged in, and disappears when not logged in e.g. for public. Again, I'm no expert so I could be totally wrong ![]() Edit; it got me curious so I did a quick test on a default sample install. Moved the user menu to position right. Added the first line to pos. left, second statement to pos. right and it worked. Main menu is gone after login, user menu appears after login on the right. So the code should work. Regards Robin |
|
| Author: | yerg [ Wed Jan 17, 2007 7:41 pm ] |
| Post subject: | Re: Menu's for public and registered visitors |
Thanks Rob will give that a go. ![]() I'm not a php anything so all contributions accepted. Not sure why what I did works for content items not menu but I'm not about to waste time finding out. |
|
| Author: | joshuacorpo [ Fri Mar 23, 2007 8:03 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
HI there, I am trying to get some of my "public" modules to disappear when someone logs on as a registered user. I am using RocketThemes Sporticus V2 which has user 5 in a column and then user 6 and 7 in another column. I want to 'disapear" the "public" modules in User 5 and replace them with "registered" modules also in User 5..is this possible? The things i have been reading seem to point to having user module and closing one and opeing another when they log in.... I want to close public in usser 5 and open registered modules in user 5 (i can create another module under user 5 i suppose (but i dont know how to do that either) I have seen the code below used, thosigh i cant get it to work for me if ( !$my->id ) { mosLoadModules ( 'user5' ); } }else mosLoadModules ( 'user5' ); any suggestions would be greatly appreciaed. Mark New Zealand |
|
| Author: | Robin [ Fri Mar 23, 2007 8:29 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
Hi, The trick I used is based on using 2 module positions, otherwise the code is indeed not working. You could try adding a module position though, see if that works. |
|
| Author: | joshuacorpo [ Fri Mar 23, 2007 9:47 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
Thanks for a prmpt response....looks like i will need to change the scope of my search and learn how to add another module position. Thanks Mark NZ |
|
| Author: | Robin [ Fri Mar 23, 2007 10:07 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
This page should help you out with adding module positions
|
|
| Author: | joshuacorpo [ Fri Mar 23, 2007 10:15 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
Ye Gods...it's like a whole another language..... ![]() was hoping for a drop and go solution.. ![]() oh well....they say learning new skills is beneficial i am about to find out................... thanks again Mark NZ |
|
| Author: | hlarsen [ Thu Apr 19, 2007 8:04 pm ] |
| Post subject: | Re: Menu's for public and registered visitors |
Maybe this can help http://forum.joomla.org/index.php/topic,158048.msg779148.html#msg779148 - Cheers |
|
| Author: | locii [ Thu Apr 26, 2007 6:10 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
Wow thats a great little hack ... Ive been wondering how to do this - it really opens up menu flexibility in membership sites. Cheers Locii. |
|
| Author: | Basetballjones [ Thu Apr 26, 2007 6:19 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
Not quite for this application specifically, but to add even more ability segregating content tween visitors and registered users, try searching the extension page for these three mambots: Rokguest Rokmember Rokspecial I use those in addition to the hack listed above to complete the the sometimes tedious puzzle of user management. |
|
| Author: | locii [ Thu Apr 26, 2007 6:24 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
Yes Ive been using the rokguest and rokmember also ... but wasnt aware there was a rokspecial - I imagine these mambots could be changed to add your own user group names also ... |
|
| Author: | Basetballjones [ Thu Apr 26, 2007 6:44 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
locii wrote: Yes Ive been using the rokguest and rokmember also ... but wasnt aware there was a rokspecial - I imagine these mambots could be changed to add your own user group names also ... Rokspecial just came out within the past month or two I think, and it answered more than one of my prayers for sure! As far as editing/creating the mambot to target specific users; I was pretty unsuccesfull, at best I would get a "you are not authorized to view this resource" when using my customized 'bot This tells me I was at least in the ballpark, but probably in the bathroom instead of the bleachers
|
|
| Author: | locii [ Thu Apr 26, 2007 6:47 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
he he ... I might have a go at it and see if I can get out of the house and onto the highway .... |
|
| Author: | locii [ Thu Apr 26, 2007 7:20 am ] |
| Post subject: | Re: Menu's for public and registered visitors |
Actually I just tried to find it ... do you mind pointing me in the right direction? |
|
| Author: | Basetballjones [ Fri Apr 27, 2007 7:51 pm ] |
| Post subject: | Re: Menu's for public and registered visitors |
locii wrote: Actually I just tried to find it ... do you mind pointing me in the right direction? Sorry about the delay in my reply, I was out of town on business. Much to my suprise, I cannot seem to find it either. Even a visit to Rockettheme proved unfruitful :/ However, I have provided a copy of it as an attachment below. (Notice- if this plugin has been deemed unsafe or otherwise is restricted, It is not my intention to circumvent the sale or license or provide hazardous extensions.. I simply cannot find any information regarding it's existence!) |
|
| Author: | locii [ Fri Apr 27, 2007 9:08 pm ] |
| Post subject: | Re: Menu's for public and registered visitors |
Hey thanks for that ... Ill take a look at it soon. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|