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.

 

Show module on Jomsocial profile pages only

Show module on Jomsocial profile pages only

I have a module I want to display only when a JomSocial profile is being shown.  I have used the following code in a MetaMod module to do this:

Code:

if ($option == "com_community" and $view == "profile") return 102;

However, if a user is logged in and they select one of the options to edit their profile, the module is displayed.  I do not want this behavior, because the module is using the userID of the JomSocial user being viewed to display data.  If there is no userid in the URL, the module shows nothing, which can be confusing for my users.

So basically, I want to show the module when the above is true, but NOT when there is one of the following tasks being performed - uploadAvatar, editPage, edit, or preferences.  I have tried this, but just cannot seem to get the syntax correct:

Code:

$showit == false;

$task = JRequest::getVar("task");
if ($option == "com_community" and $view == "profile") {
if ($task == "uploadAvatar" or $task == "edit" or $task == "preferences" or $task == "editPage") {$showit == false;}
endif;
}
$endif;
if ($showit == true) return 102;

Can anyone provide some guidance?

Thanks!!!

momentis
Web Developer
Beginner Modder
ranks
useravatar
Offline
12 Posts
User info in posts
Administrator has disabled public posting

Re: Show module on Jomsocial profile pages only

Hi momentis,

the problem might just be with the use of "endif" which is not necessary since you are using {} syntax.

So try this:

Code:

$showit == false; 

$task = JRequest::getVar("task");
if ($option == "com_community" and $view == "profile") {
  if ($task == "uploadAvatar" or $task == "edit" or $task == "preferences" or $task == "editPage") {
    $showit == false;
  }
}
if ($showit == true) return 102;

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

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Posts this week:
4
User Info:
 
Total Users:
5534
Newest User:
kaylee
Members Online:
0
Guests Online:
155

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