UPDATES EasyBlog 6.0.14 Released! Joomla 5.x and PHP 8.x compatible now!

Helpdesk

Your Time
Our Time
Response Time
24 — 48 hours
We strive to provide the fastest ever response possible. However, we are not super beings.

Allow at least 24 — 48 hours
  Support is offline
It is currently off working hours and most of us aren't around

Rest assured that we will get back to you as soon as the day starts tomorrow!
  Support is offline

Recreating conversation notifications

Ron Wade-Megghross · ·
6:03 AM Wednesday, 11 March 2015
None
Hi,

I'm trying to add a 'conversations' item to the sidebar. It should work similarly to the conversations icon in the toolbar. It should show notifications when a new message comes in.

Here's what I have done so far:

I have used a template override to modify the dashboard layout, overriding dashboard/default.php. In the dashboard override I use the following code snippet to pull in a custom template I created called 'messages':
echo $this->includeTemplate( 'site/dashboard/messages' ); 


The messages template basically looks like this:

<?php
$my = Foundry::user();

if( $my->id )
{
// Get a list of new conversations
$newConversations = $my->getTotalNewConversations();
}
?>

<div class="es-widget es-widget-borderless">
<div class="es-widget-head">
<div class="widget-title pull-left">
<?php echo JText::_( 'Messages' );?>
</div>
</div>

<?php echo $this->loadTemplate( 'site/toolbar/default.conversations' , array( 'newConversations' => $newConversations ) ); ?>

</div>


This pulls in the 'site/toolbar/default.conversations' template and gives a value to the $newConversations variable, which is the number of new messages received. This is shown on the front-end as a red circle showing the number of new conversations. And this is where I have my problem...

So far I get the new conversations count to update correctly on page load. However, when a new conversation comes in after page load, the counter doesn't update like the one in the toolbar does. I was hoping that pulling in the 'site/toolbar/default.conversations' template, which is the same one used in the toolbar, would cause the required JavaScript to work. Is there a non-hackish way to accomplish this?

How do I get the conversations counter to update?
The replies under this section are restricted to logged in users or users with an active subscription with us