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.

 

Hide a module which is not in metamod

Hide a module which is not in metamod

Today I purchased Metamod Pro, because I needed the ability to handle modules that are not part of metamod.  However I have not find anything that will help me do this.

Please advise how I enable or disable a module on a page by user.

Please provide an example so I understand.

Thanks

Addy
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

I have tried the following as part of it.  Thou I am also asking it to return other modules that are in the metamod module which is just about this code and working fine:

Code:


if ( $user->id == ** ) {
$changes->mod(25)
     ->enable(false);
return 25;
}

However this is not working... Any ideas ?

Addy
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

Hi Addy,

almost right! If module #25 is not inside the MetaMod, then MetaMod Pro will still allow you to set it to be disabled (removed, essentially). So in that case, you do the enable(false) thing as above, but you shouldn't then do the "return 25;", as that part will attempt to place module 25 inside the MetaMod.

So, assuming that you are going to replace ** with a real user id number, you should be able to do the following in MetaMod Pro:

Code:

if ( $user->id == ** ) { 

  $changes->mod(25)->enable(false);
}

Again, this will turn off module 25 no matter where it appears on the page, if the logged-in user has the user id specified in **.

Make sense?

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
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

This is what I have now, but the custom html mod is still showing?

Code:


if ( $user->id == ** ) {
$changes->mod(25)->enable(false);
}

Addy
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

Did you replace ** with a real user id? e.g. the superadministrator is normally id 62, so if you were going to test for that person logged in on the front end, you would use this:

Code:

if ( $user->id == 62 ) {

  $changes->mod(25)->enable(false);
}

Also, you need to ensure that the MetaMod Pro plugin is enabled in the Plugin Manager. Have you done that step? (just checking)

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
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

Hiya, big_smile   

Yesh, I have put my id in, and I have enable the metamod pro plug in.

I had metamod first, used it, and then put the plugin on afterwards, could that be a reason?

Addy
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

On the off chance, something else is playin games, here is whats in the box:

Code:


if ( MM_NOT_LOGGED_IN ) return 66;
if ( $user->id == ** ) return 59;
if ( $user->id == ** ) return 59;
if ( $user->id == ** ) {
$changes->mod(25)->enable(false);
}

Addy
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

Ok, just a thought. Do you want module 25 to be disabled only for one particular user, or for all of the logged-in users?

The way you have it set up above, if module 59 gets displayed (because the user is one of two particular ids, not stated above), then the PHP code will exit before it gets to the point of disabling module 25.

I'm still uncomfortable about those asterisks... can we put in placeholder numbers...?

If you want module 25 removed for all logged-in users, you could do it this way:

Code:

if ( MM_NOT_LOGGED_IN ) return 66; 

$changes->mod(25)->enable(false);
if ( $user->id == 101 ) return 59; // 101 is a placeholder
if ( $user->id == 102 ) return 59; // 102 is a placeholder

Another possibility: there are some components for Joomla which are known to conflict a bit with MetaMod Pro. One of these is BreezingForms. Are you using that by any chance? If so, there's a fix available for it (search this forum for it). There could be other potential conflicts too.

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
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

Hiya,

It must have been where it was put as the following code seems to work:

Code:


if ( MM_NOT_LOGGED_IN ) return 66;
if ( $user->id == 101 ) {
    $changes->mod(25)->enable(false);
}
if ( $user->id == 101 ) return 59;
if ( $user->id == 102 ) return 59;

There will be more than one user, but it will be when I get the groups within jomsocial working.  Basiclly anyone within a group I would like to show a module.

Addy
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Hide a module which is not in metamod

I still have 2 problems thou.  It will not work on Menu Modules, it just does not work.  And I cannot make the following to work:

Code:


if ( MM_NOT_LOGGED_IN ) $changes->mod(66)->enable(true);

Any ideas ?

Addy
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
4
User Info:
 
Total Users:
4383
Newest User:
kingpen99
Members Online:
0
Guests Online:
187

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