Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 1:01 pm (All times are UTC )

 


Forum rules

Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 17 posts ] 
Author Message
Posted: Wed Jan 17, 2007 7:44 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Aug 18, 2005 12:22 pm
Posts: 933
Location: Ballarat, Australia
I'm "trying" to set up two menus
  • Public Menu - which all people can see when they visit
  • Registered Menu - which replaces the public menu when logged in.

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.

_________________
We cannot become what we need to be ... by remaining what we are


Top
   
 
Posted: Wed Jan 17, 2007 6:40 pm 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Thu Aug 18, 2005 10:41 am
Posts: 15089
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

_________________
Regards Robin


Last edited by Robin on Wed Jan 17, 2007 6:48 pm, edited 1 time in total.

Top
   
 
Posted: Wed Jan 17, 2007 7:41 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Aug 18, 2005 12:22 pm
Posts: 933
Location: Ballarat, Australia
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.

_________________
We cannot become what we need to be ... by remaining what we are


Top
   
 
Posted: Fri Mar 23, 2007 8:03 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Jun 22, 2006 12:05 am
Posts: 114
Location: New Zealand
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

_________________
“You can only be young once. But you can always be immature.”


Top
  E-mail  
 
Posted: Fri Mar 23, 2007 8:29 am 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Thu Aug 18, 2005 10:41 am
Posts: 15089
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.

_________________
Regards Robin


Top
   
 
Posted: Fri Mar 23, 2007 9:47 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Jun 22, 2006 12:05 am
Posts: 114
Location: New Zealand
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

_________________
“You can only be young once. But you can always be immature.”


Top
  E-mail  
 
Posted: Fri Mar 23, 2007 10:07 am 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Thu Aug 18, 2005 10:41 am
Posts: 15089
This page should help you out with adding module positions  ;)

_________________
Regards Robin


Top
   
 
Posted: Fri Mar 23, 2007 10:15 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Jun 22, 2006 12:05 am
Posts: 114
Location: New Zealand
Ye Gods...it's like a whole another language..... :-\

was hoping for a drop and go solution.. :laugh:

oh well....they say learning new skills is beneficial

i am about to find out...................

thanks again

Mark
NZ

_________________
“You can only be young once. But you can always be immature.”


Top
  E-mail  
 
Posted: Thu Apr 19, 2007 8:04 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Sep 15, 2006 6:46 pm
Posts: 34
Maybe this can help http://forum.joomla.org/index.php/topic,158048.msg779148.html#msg779148 -

Cheers


Top
  E-mail  
 
Posted: Thu Apr 26, 2007 6:10 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Mar 18, 2006 11:23 pm
Posts: 48
Wow thats a great little hack ... Ive been wondering how to do this - it really opens up menu flexibility in membership sites.

Cheers
Locii.


Top
   
 
Posted: Thu Apr 26, 2007 6:19 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Sat Jan 06, 2007 5:43 pm
Posts: 228
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.

_________________
http://www.fraganoob.com&nbsp; Putting Gamers in Control!


Top
   
 
Posted: Thu Apr 26, 2007 6:24 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Mar 18, 2006 11:23 pm
Posts: 48
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 ...


Top
   
 
Posted: Thu Apr 26, 2007 6:44 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Sat Jan 06, 2007 5:43 pm
Posts: 228
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 :D

_________________
http://www.fraganoob.com&nbsp; Putting Gamers in Control!


Top
   
 
Posted: Thu Apr 26, 2007 6:47 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Mar 18, 2006 11:23 pm
Posts: 48
he he ... I might have a go at it and see if I can get out of the house and onto the highway ....


Top
   
 
Posted: Thu Apr 26, 2007 7:20 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Mar 18, 2006 11:23 pm
Posts: 48
Actually I just tried to find it ... do you mind pointing me in the right direction?


Top
   
 
Posted: Fri Apr 27, 2007 7:51 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Sat Jan 06, 2007 5:43 pm
Posts: 228
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!)


You do not have the required permissions to view the files attached to this post.

_________________
http://www.fraganoob.com&nbsp; Putting Gamers in Control!


Top
   
 
Posted: Fri Apr 27, 2007 9:08 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Mar 18, 2006 11:23 pm
Posts: 48
Hey thanks for that ... Ill take a look at it soon.


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group