Forum Discussion
HI mfeltscher
As per my knowledge its not possible to set user notification using rest api but it can be achiveable using jquery. I have done the same part. i.e. facebook shows notification on top of the page. I achived it using jquery. Following is the code. Hope it may help you:
;( function( $, undefined )
{
$.fn.UserNotifications = function()
{
var $item = $( '#user-notifications-menu-top' )
, $list = $item.find( '#notification-list' )
, unread = parseInt( $item.find( '.user-navigation-combine-notification-feed .lia-header-nav-component-unread-count' ).text() )
, pageURL = $item.find( '.user-navigation-combine-notification-feed .lia-link-navigation' ).attr( 'href' );
$item.find( '#alerts-count' ).text( unread );
$item.find( '#notifications-page-link' ).attr( 'href', pageURL );
if( unread > 0 )
{
$item.addClass( 'new-notifications' );
$list.find( 'li:lt( ' + unread + ' )' ).addClass( 'unread' );
}
else
{
$item.addClass( 'no-new-notifications' );
}
};
} )( jQuery );
Note: Also you need to make some css per code.
Hi bhupen
Thank you for your reply. Since we want to use the notification count in a third party software we cannot solve this by using Frontend technologies such as Javascript / jQuery.
Thanks anyway for sharing your code
Moreno
- bhupen10 years agoAdvisor
mfeltscher I think you want when some one rank/like/mention/reply/ on your post then notification will comeup as unread. Once you click on view all notification the it will convert into read. Thats what exactly this code does. I don't think lithium provide third party api etc.. Hope this will help you.. also there is api for notification count
restapi/vc/users/id/youruserid/notifications/count
- mfeltscher10 years agoExpert
Yes this is what I want but I want to expose this information in another application, therefore I need to be able to access this information using Lithium's REST API. I hope Lithium will offer this functionality at some point, since it is already possible in the frontend. As cblown mentioned it would be a good approach regarding consistency to implement new functionality in the API first and afterwards develop the frontend parts.
Related Content
- 11 years ago
- 11 years ago
- 5 months ago
- 7 months ago