TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 05:02:27 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 310
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 306
  • Total: 307
  • lurkalot

Check if topic is promoted on front page?

Started by Nightmaster, September 25, 2020, 07:29:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nightmaster

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)

@rjen

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...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Nightmaster

Thanks, that should be enough. I'm gonna just hide edit buttons in Display template with that check :)

Thanks!