TinyPortal
Development => Support => Topic started by: Nightmaster on September 25, 2020, 07:29:00 AM
Heya all!
Thanks for creating this wonderful portal system! :)
I'd like on my 2.0.17 forum to check if topic is promoted on front page.
Exactly what I'd like is to disallow first post edits if the topic is promoted on front page. (TP version 1.6.7)
So something like if{topis_is_promoted) --> disallow edits
Any help about the code i should use in template?
Thanks! 8)
Hi, welcome to TinyPortal.
To do what you want you will need to adapt the SMF code, because TinyPortal does not control the edits of Topics.
A couple of hints though:
Promotion to Frontpage is only effective when the frontpage layout is set to Promoted topics only (forum_selected) or Promoted topics + articles - sorted on date (forum_selected_articles)
The setting that a topic is 'Promoted' is stored in the TinyPortal settings: $context['TPortal']['frontpage_topics'])
This code will check if the promoted topics is set on the frontpage, and if the current topics is part of the set list of topics...
(($context['TPortal']['front_type']=='forum_selected' || $context['TPortal']['front_type']=='forum_selected_articles'))) {
if(!in_array($context['current_topic'], explode(',', $context['TPortal']['frontpage_topics'])))
The logic needed to block the user from editing the topic is up to you...
Thanks, that should be enough. I'm gonna just hide edit buttons in Display template with that check :)
Thanks!