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.

 

How to show a module to specific users?

How to show a module to specific users?

Hi,

I would like to know how i could use MetaMod to show certain modules to certain usernames?

thanks!

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

Re: How to show a module to specific users?

Hi sweet160,

Start with the Quick Start guide:

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

Then you can use the following rule to check for username:

if ($user->username == "joe") return XXX;
if ($user->username == "bob") return YYY;
if ($user->username == "ann" or $user->username == "brenda") return ZZZ;

... replace XXX etc with the module numbers that you want to use for that user.

Hope that helps,
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: How to show a module to specific users?

Actually there's another way to do this, introduced recently, that can help if you have a long list of usernames that you want to give the same module.

if ($core_genius->check("userloginname = ann, brenda, charles, diane, ed, fred, geoff") ) return XXX;
if ($core_genius->check("userloginname = henry, ian, jake, kathy, liam, mary, niall") ) return YYY;

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: How to show a module to specific users?

that actually worked excellent!
thank you very much!

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

Re: How to show a module to specific users?

first of all thanks for this Module, maybe after 2 months I found a solution.
However, unfortunately I don't have any PHP knowledge..
To put it very simply, what i need is to to have a module shown depending on THE user id.
If I'm not wrong, the syntax to be used is as it follows:

if ($user->id == "63") return 40

where 63 is the user id (got it from user's panel) where 40 is the module id (set in specific 'metamodpos1', added in template's xml)

Unfortunately it is not working (Parse error: syntax error, unexpected $end in Z:\www\joomla\modules\mod_metamod\helper.php(539) : eval()'d code on line 1)
Is the sintax correct?
Can anyone send me some screens to understand the whole setup?
Thanks

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

Re: How to show a module to specific users?

I got it.... stupid error!

if ( $user->id == "63") return 40;

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

Re: How to show a module to specific users?

Yes, always need the semicolon ";" at the end of lines.

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:
1666
Total Polls:
6
Total Posts:
5909
Dormant:
User Info:
 
Total Users:
10091
Newest User:
lamanaudio
Members Online:
3
Guests Online:
146


Forum Legend:

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