If new posts in X forum function

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
teebling
Registered User
Posts: 8
Joined: Sat Apr 14, 2018 7:38 pm
Contact:

If new posts in X forum function

Post by teebling » Sun Oct 21, 2018 5:22 am

Hello,

I'd like to make some code something like this:

Code: Select all

<!-- IF f=7 has UNREAD posts --><img src='#'><!-- ENDIF -->
Which I would be able to use on any viewforum page.

This is so that I could display a small image (indicating unread posts in X forum) next to any forum links in my navigation bar.

Could anyone help me out with the PHP bit? I am comfortable implementing this into the template itself just not the actual function.

Thanks,
Teeb
Image My World of Warcraft: Classic forum

User avatar
david63
Jr. Extension Validator
Posts: 14932
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: If new posts in X forum function

Post by david63 » Sun Oct 21, 2018 7:12 am

What code have you already got in your extension - is it on Github?
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
teebling
Registered User
Posts: 8
Joined: Sat Apr 14, 2018 7:38 pm
Contact:

Re: If new posts in X forum function

Post by teebling » Sun Oct 21, 2018 11:28 pm

I don't have any code yet david63 - I understand how I will put in the IF statement into the template, but not the PHP behind that.

Teeb
Image My World of Warcraft: Classic forum

User avatar
Toxyy
Registered User
Posts: 556
Joined: Mon Oct 24, 2016 3:22 pm
Contact:

Re: If new posts in X forum function

Post by Toxyy » Mon Oct 22, 2018 1:01 am

topicrow.S_UNREAD_TOPIC will be true per topic row on viewforum if it is unread in the templates.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][RC] Show User Activity

User avatar
teebling
Registered User
Posts: 8
Joined: Sat Apr 14, 2018 7:38 pm
Contact:

Re: If new posts in X forum function

Post by teebling » Mon Oct 22, 2018 6:17 am

Toxyy wrote:
Mon Oct 22, 2018 1:01 am
topicrow.S_UNREAD_TOPIC will be true per topic row on viewforum if it is unread in the templates.
Thanks for this - will it work with other forums not currently displayed?

For example I am viewing forum ID 1, and there are unread posts in forum ID 3 (a page I am not currently viewing), and I do something like this:

Code: Select all

<!— IF topicrow.S_UNREAD and FORUM ID=3—><img src=“image.png”><!— ENDIF —>
Basically I have links to all the different forums in overall_header and would like to display an ‘unread posts’ indicator image above each if they have unread posts.
Image My World of Warcraft: Classic forum

User avatar
Toxyy
Registered User
Posts: 556
Joined: Mon Oct 24, 2016 3:22 pm
Contact:

Re: If new posts in X forum function

Post by Toxyy » Mon Oct 22, 2018 9:53 am

teebling wrote:
Mon Oct 22, 2018 6:17 am
Basically I have links to all the different forums in overall_header and would like to display an ‘unread posts’ indicator image above each if they have unread posts.
I don't recall if that variable available within topic rowset but if they are you could get the array column if that and the key you need and loop through it looking for a hit, within your own mini extension of course.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][RC] Show User Activity

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 231 guests