Making WordPress.org


Ignore:
Timestamp:
03/22/2017 05:08:21 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Add contextual checks for extra reply actions:

  • Don't display "Reply and mark as resolved" checkbox if the topic is already resolved.
  • Don't display "Reply and close the topic" checkbox if the topic is already closed.

Fixes #2595. See #2070.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r5135 r5161  
    264264     */
    265265    public function add_extra_reply_actions() {
     266        $topic_id = bbp_get_topic_id();
     267
    266268        if ( class_exists( 'WordPressdotorg\Forums\Topic_Resolution\Plugin' ) ) :
    267269            $topic_resolution_plugin = Topic_Resolution\Plugin::get_instance();
    268270
    269             if ( $topic_resolution_plugin->is_enabled_on_forum() && $topic_resolution_plugin->user_can_resolve( get_current_user_id(), bbp_get_topic_id() ) ) : ?>
     271            if (
     272                $topic_resolution_plugin->is_enabled_on_forum()
     273            &&
     274                $topic_resolution_plugin->user_can_resolve( get_current_user_id(), $topic_id )
     275            &&
     276                'yes' !== $topic_resolution_plugin->get_topic_resolution( array( 'id' => $topic_id ) )
     277            ) : ?>
    270278                <p>
    271279                    <input name="bbp_reply_mark_resolved" id="bbp_reply_mark_resolved" type="checkbox" value="yes" />
     
    276284        endif;
    277285
    278         if ( current_user_can( 'moderate', bbp_get_topic_id() ) ) : ?>
     286        if ( current_user_can( 'moderate', $topic_id ) && ! bbp_is_topic_closed( $topic_id ) ) : ?>
    279287            <p>
    280288                <input name="bbp_reply_close_topic" id="bbp_reply_close_topic" type="checkbox" value="yes" />
Note: See TracChangeset for help on using the changeset viewer.