Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Visible to Single user ID or username

Visible to Single user ID or username

I only want a single module visible only to one user ID or username.

Don't see recipe...cant figure it out.

I tried this for username football but others can see it.

if ( $search_user_name = 'football') ) return 344;

skillview
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Visible to Single user ID or username

Try it this way:

if ($user->username == "football") return 344;

Note 1: you have to use a double "=" sign
Note 2: this detects the login name of the user, not their full name.

Also, make sure you follow the instructions in the Quick Start guide. If all users were able to see the module with the PHP you used above, then you probably didn't have it set up right.

http://www.metamodpro.com/metamod/quick-start


Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Visible to Single user ID or username

I'm having similar difficulties.  I have a site in which I want to show a roktabs module containing report articles to a specific registered user.  User1 gets to see the module with his reports, user2 gets to see only his reports, and unlogged users see some standard text.

I have been using the single user recipe - but there are two problems:
1)If user1 logs in, user1 can see his module, but so can anyone else who goes to the site when user1 is logged in.
2)I'm also having problems modifying the code so that metamod can identify a single user from multiple users and return only the module specific to that individual, as in the logic "if user1, show user1 reports, else if user2, show user2 reports."

Any help would be much appreciated.
Thanks,
Andrew

andrewn51
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Visible to Single user ID or username

Well the following simple code seems to work...so as Emily Litella once said "Never mind!"

if ($user->username == "Summer") return 229;
if ($user->username == "duck") return 230;
return 221;

Thanks for a great product!!

andrewn51
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Visible to Single user ID or username

Yep, you got it :-)

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10137
Newest User:
lexispoker1
Members Online:
1
Guests Online:
258

Online: 
liaskas

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked