By Mustaq Sheikh on Monday, 04 November 2013
Posted in Technical Issues
Replies 3
Likes 0
Views 882
Votes 0
Hi Guys,

I am looking at adding a notifications badge on the avatar for our Super Login Pro module ( see screenshot )
Is there a Global notifications variable I can tap into to get the notifications count ?

Thanks as always

Mustaq
Hello Mustaq,

Yep, it's as easy as this:


require_once( JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' );

// To get current user.
$my = Foundry::user();

// To get total new conversations
$totalConversations = $my->getTotalNewConversations();

// To get total pending friends
$totalNewFriends = $my->getTotalFriendRequests();

// This is a little different but I do plan to move them into our user library.
$model = Foundry::model( 'Notifications' );
$totalNotifications = $model->getCount( array( 'unread' => true , 'target' => array( 'id' => $my->id , 'type' => SOCIAL_TYPE_USER ) ) );
·
Monday, 04 November 2013 20:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Wow, super, that is really nice and clean/simple .
·
Monday, 04 November 2013 21:32
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Mustaq If you need more direct response over API / questions you can always get in touch with me on Skype, marklee_777 and I'll bring some of the team members to help you out as well

Thanks for building such integrations!
·
Monday, 04 November 2013 23:02
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post