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.

 

Configuring menu so that it shows new pending connections in CB

Configuring menu so that it shows new pending connections in CB

Hello again Stephen,

You kindly help me to show that there are new, pending messages in the menu for logged in users. In that same menu, I would like to indicate when they have any new, pending connections.

So for example, if user A has 2 new pending connections, the menu item "My Connections" would become "My Connections (2 pending)"

As you may recall, I am using Community Builder v 1.9.1 on a Joomla 3.2 website, and the full version of Chameleon, of course.

In the image below, you can see the usual way in which Community Builder shows that there are new, pending connections (in this case, 1 new pending connection).
http://www.odylic.com/docs/Pending-connections-notification-in-CB.PNG

I tried to create a rule myself but alas I am not a developer, and after fiddling for 2 hours, I gave up and thought it would be better to ask you. Sorry! smile

Edited By: hectoritobh
09-Dec-13 20:06:34

hectoritobh
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Configuring menu so that it shows new pending connections in CB

Ok, after a little experimentation I came up with this:

Code:

$menuid = XXX; // replace XXX with the id of the menu item to change 


$query = 'sel' . 'ect count(*) as c from `#_' .
  '_comprofiler_members` m, `#_' .
  '_comprofiler` u
  where u.`user_id` = ' . $user->id . '
  and u.`id` = m.`memberid`
  and m.`pending` = 1';
$db->setQuery($query);
$count = $db->loadResult();

$message = "My Connections";
if ($count > 0) $message .= " ($count pending)";

$allmenus = JFactory::getApplication()->getMenu();           
$rProperty = new ReflectionProperty($allmenus, '_items');
$rProperty->setAccessible(true);
$items = $rProperty->getValue($allmenus);
$items[$menuid]->title = $message;

Tested - works - COOL!

This is a great little utility. Thanks for asking about it – and please spread the word in the CB community to let people know the possibilities smile

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

Re: Configuring menu so that it shows new pending connections in CB

Cool! I'll test this tomorrow smile

Hector

hectoritobh
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Configuring menu so that it shows new pending connections in CB

Hi Stephen,

The code worked beautifully and straight out of the box. Thank you so much!!!

Cheers,
Hector

hectoritobh
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Configuring menu so that it shows new pending connections in CB

Hi Stephen,

I have recommended Chameleon on CB's forum. Here are screenshots of what I wrote:
http://www.odylic.com/images/Forum-post-1.PNG
http://www.odylic.com/images/Forum-post-2.PNG

I hope it helps you to bring more clients and business. Your extension really deserves it!

Kind regards,
Hector

hectoritobh
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Configuring menu so that it shows new pending connections in CB

Awww thanks Hector! Much appreciated.

I hope you have a wonderful Christmas,
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
3319 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1675
Total Polls:
6
Total Posts:
5917
Posts this week:
6
User Info:
 
Total Users:
11571
Newest User:
craig6111
Members Online:
2
Guests Online:
223


Forum Legend:

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