Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/05/2018 04:11:03 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Subscriptions: simplify edit logic for getting checked() value.

Props wpdennis. See #3206.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/forums/template.php

    r6829 r6830  
    22272227    function bbp_get_form_forum_subscribed() {
    22282228
     2229        // Default value
     2230        $forum_subscribed = false;
     2231
    22292232        // Get _POST data
    22302233        if ( bbp_is_forum_form_post_request() && isset( $_POST['bbp_forum_subscription'] ) ) {
     
    22332236        // Get edit data
    22342237        } elseif ( bbp_is_forum_edit() || bbp_is_reply_edit() ) {
    2235 
    2236             // Get current posts author
    2237             $post_author = (int) bbp_get_global_post_field( 'post_author', 'raw' );
    2238 
    2239             // Post author is not the current user
    2240             if ( bbp_get_current_user_id() !== $post_author ) {
    2241                 $forum_subscribed = bbp_is_user_subscribed( $post_author, bbp_get_forum_id() );
    2242 
    2243             // Post author is the current user
    2244             } else {
    2245                 $forum_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id(), bbp_get_forum_id() );
    2246             }
     2238            $post_author      = (int) bbp_get_global_post_field( 'post_author', 'raw' );
     2239            $forum_subscribed = bbp_is_user_subscribed( $post_author, bbp_get_forum_id() );
    22472240
    22482241        // Get current status
    22492242        } elseif ( bbp_is_single_forum() ) {
    22502243            $forum_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id(), bbp_get_forum_id() );
    2251 
    2252         // No data
    2253         } else {
    2254             $forum_subscribed = false;
    22552244        }
    22562245
Note: See TracChangeset for help on using the changeset viewer.