Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to check if a post is announced?
Tijmen
New
Is there a way to check in php if a single post is set as "announced'?
What I like to do is when a user reads a post that is set as "announced", show that the post is "announced" by adding an icon next to the title, but I have no idea how to check that in php.
Right now the only place a user sees that a post is "announced" is on the discussion overview page.
Tagged:
0
Comments
You would need a plugin this depends on whether you have programming ability.
you could use the
BeforeDiscussionOptions
orAfterDiscussionTitle
hooksthen you would check
$Sender->Data('Discussion.Announce')
grep is your friend.
I would have expected to see that already in the core since announcements are a core feature. There is indeed no way to tell if a discussion is an announcement just by looking at the discussion itself. Strange...
There is no nice event for that one, I guess. I would like to see that in ´< div class="MessageList Discussion">`. Putting a css class Announcement in the body element feels not right but for styling it seems to be the best place :-/
@R_J I'm actually a big fan of Body classes. Just remember to append!!
It is a great way to style a single, using css rules. I just thought he wanted to add some element too.
grep is your friend.
Based on the question it would be enough to add something to the discussion title, but I could imagine that it would be useful to style the background based on the fact that a discussion is an announcement. Or if your announcements usually are super important, even hide the panel and make them really eye catching.
Adding an icon before any child element should be no problem with CSS, I guess.
You are absolutely right concerning the code snippet!
The problem is fixed now, thanks