Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Hide a module which is not in 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
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 ?
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
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
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);
}
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.
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.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Hide a module which is not in metamod
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 168
- 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