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.

 

Help to form rule to restrict articles for registered / public users

Help to form rule to restrict articles for registered / public users

Hi, I am not all that exp and am trying to show one featured article to non-registered users on the home and another featured (different) article to registered users on the home page (in the same spot or position). I cant wrap my head around how or which succeed of fail variables I need to enter. Any help would be greatly appreciated. Thank you in advance.

Oily
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Help to form rule to restrict articles for registered / public users

Hi Oily,

I assume we're talking about an article appearing as a module, right? That's what MetaMod deals in - modules.

So what I'd do is this:

1 - search for and download a Joomla module from the Joomla Extensions Directory that can display an article in the module. I'm sure I have seen various versions of this.

2 - install it

3 - create 2 modules using this new module type. Set one of them up to display the article for non-registered users, and the other to display the article for registered users.

4 - after you have created and tested the 2 modules, set them both to display on "no menu items". This is so that they won't display on the site - yet!

5 - then create a new MetaMod. Set it to display on the Home Page only, and make sure it's set to the correct module position. Ensure it's published.

6 - in the MetaMod, use the following PHP code:

if ($user->id == 0) return XXX:
else return YYY;


Then replace XXX with the module id of the module that's showing the article for logged-in users.
Replace YYY with the module id of the module that's going to show the article for guests.

7 - save the MetaMod and test.


That should do it.

Best regards,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10778
Newest User:
negina4qx
Members Online:
0
Guests Online:
189

Online: 
There are no members online

Forum Legend:

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