Support Forum

Notification Button

JL Justin Lewis
Justin Lewis
Member

Is there a way to implement a notification button inside of my actual WordPress theme?

For example, when people aren’t on the forum, but rather they are inside of a course I have setup, can there be something at the top right of the page (inside of header.php) that shows them the # of unread posts they have? Or # of replies they’ve had?

Thanks!

13 Answers

New Answer

BR Brandon
Brandon
Member

You could use the same type of thing that is used in the forum that shows unread posts.

screenshot_01.png

 

 

 

 

If you have a text widget and something like the Exec-PHP plugin installed you could use the same code that displays unread posts.

Something like:

<?php
    global $spThisUser;
    sp_forum_api_support();
sp_UnreadPostsInfo('tagClass=spRight spUnreadPostsInfo&spanClass=spLeft&iconClass=spLeft spIcon', __sp('%COUNT% topics with<br />unread posts'), __sp('Most recent topics with unread posts'), __sp('Mark all topics as read'));
?>

The CSS might or style may need to be adjusted but that should show the unread list on every WP page where the widget is active.

The codex entry sp_UnreadPostsInfo shows more info on that function and how you can change it if needed.

JL Justin Lewis
Justin Lewis
Member

I’ll try it out and let you know how it goes :D

JL Justin Lewis
Justin Lewis
Member

It worked great actually and the code is very simple to grab.

I simply added a link to it like this

<a href="http://www.nicheoptimizer.com/forum/"><?php
 global $spThisUser;
 sp_forum_api_support();
sp_UnreadPostsInfo('tagClass=spRight spUnreadPostsInfo&spanClass=spLeft&iconClass=spLeft spIcon', __sp('%COUNT% Unread Posts'), __sp('Most recent topics with unread posts'), __sp('Mark all topics as read'));
?></a>
AL almase
almase
Member

The possibility sounds good and i will try it too.

here my site: http://www.bulls-club.de

it works great but i can`t open the window with all new topics when i click the “Most recent topics with unread posts” button. i click the button but nothing happens. dosn`t work it on the sidebar?

BR Brandon
Brandon
Member

almase said: it works great but i can`t open the window with all new topics when i click the “Most recent topics with unread posts” button. i click the button but nothing happens. dosn`t work it on the sidebar?

It should be a direct url link to new posts. When you hover over the icon does it show the /forum/newposts link at the bottom of your browser?

MP Mr Papa
Mr Papa
Member

Javascript:void(0) is correct. It just means the href attribute is not used. Instead the onclick attribute is used.

AL almase
almase
Member

Mr Papa said 
Javascript:void(0) is correct. It just means the href attribute is not used. Instead the onclick attribute is used.

mmh and how can i change it?

i used the code from user Justin Lewis

 

 

BR Brandon
Brandon
Member

almase said
No its javascript:void(0)

Thanks. That mean it is trying to use the popup window to display the unreads.  If in the sidebar you should turn off the popup and have it take the user to the actual unread page itself.
You should add &popup=0 to the line right after spLeft in that example above, not using any spaces.