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.

 

Do not show modules in profile editing

Do not show modules in profile editing

Stephen

I use the metamod to display multiple modules in com_comprofiler.
However, when in edit mode of the profile, like that these modules were not shown. It aims to do this?

Edited By: sniper_rio
17-Nov-09 20:17:44

sniper_rio
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: Do not show modules in profile editing

Are you asking to be able to turn off modules when you are on the editing page(s) of CB?

Ok, looking at CB I see URLs like this:

Looking at my own profile:

index.php?option=com_comprofiler&task=userProfile&user=62

Another view of my own profile page:

index.php?option=com_comprofiler

editing my own profile:

index.php?option=com_comprofiler&task=userDetails

update my image:

index.php?option=com_comprofiler&task=userAvatar

manage my connections:

index.php?option=com_comprofiler&task=manageConnections

So I want to exclude the module when I am editing my profile, updating my image, or managing my connections.

Code:

$exclude = false;

if ($option == "com_comprofiler") {
  $task = JRequest::getVar("task");
  if ($task == "userDetails" or $task == "userAvatar" or $task == "manageConnections") $exclude = true;
}
if ($exclude == false) return "101, 102, 103"; /* replace numbers with the modules ids you want to show */

(edited to change com_profiler to com_comprofiler)

Edited By: metamodguy
19-Nov-09 22:27:07

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

Re: Do not show modules in profile editing

His reasoning is correct. You put "com_profiler" I correct for "com_comprofiler". However, using this code, the modules are appearing on every page.
I made some changes, but could not find the error.

sniper_rio
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: Do not show modules in profile editing

Hi sniper_rio,

thanks for pointing out the com_comprofiler error. I fixed that in the post above.

Can you turn on advanced debugging to see what values "task" and "option" have on the pages that you want to exclude the modules?

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

Re: Do not show modules in profile editing

Includes the following line in the code and it seems that it worked. If you say that is correct, it was resolved.
Includes "usersList" too.
hug

$exclude = false;

if ($option == "com_comprofiler") {

  $task = JRequest::getVar("task");
 
  if ($task == "userDetails" or $task == "userAvatar" or $task == "manageConnections" or $task == "userslist") $exclude = true;

}


if ($option == "com_myblog" or $option == "com_content" or $option == "com_seyret" or $option == "com_remository" or $option == "com_simgallery" or $option == "com_myblog" or $option == "com_myblog") $exclude = true;


if ($exclude == false) return "211"; /* replace numbers with the modules ids you want to show */

sniper_rio
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: Do not show modules in profile editing

Hey that looks good. So what you are doing is this:

1 - checks if you are in CB. If you're on the userDetails page, userAvatar pate, manageConnections or userslist, set a flag to exclude the modules.

2 - checks to see if you are on any myblog,article, seyret videos, remository or simgallery pages, and if so sets the flag for excluding the modules. [N.B. I see that you have included the check for "com_myblog" 3 times. You only need this once]

3 - if the flag for excluding the module has not been set, include the module.

This is a good technique to use. However, if you are excluding so many different components, you should ask yourself if it would be simpler to reverse the process and just turn the module ON for a particular component or other condition. But what you have is fine.

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

Board Info

Board Stats:
 
Total Topics:
1691
Total Polls:
6
Total Posts:
5912
Total Posts Today:
6
User Info:
 
Total Users:
11529
Newest User:
jame380003
Members Online:
1
Guests Online:
149

Online: 
jame380003

Forum Legend:

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