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
Our team is away during the weekend. Some answers may already be available on our documentation

Rest assured that we will get back to your posts as soon as the week starts!
  Support is offline
Sometimes you need to display total blog post count "outside" EasyBlog component, in a custom template position.
You can do this by using the code below. The code will query the database and will display the total published blog posts count for current logged-in user.


<?php
$user =JFactory::getUser();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = 'select count(1) as `post_count`';
$query .= ' from `#__easyblog_post` as a';
$query .= ' where a.`created_by` = ' . $user->id;
$query .= ' and a.published = ' . $db->Quote('1');
$db->setQuery($query);
$postcount = $db->loadResult();
echo $postcount;
?>


You can use this if you want for example to present to the current logged-in user his total blog posts count. Think about it kinda like a "notification" count. In our case scenario, we built a "My Account" custom menu where we listed some personal menu option for current logged in user. We used the above code to show post count next to "My Blog Posts" menu option.

Enjoy ! I hope you will find a good use ! :p
The replies under this section are restricted to logged in users or users with an active subscription with us