WordPress.org

Making WordPress.org

Changeset 6423


Ignore:
Timestamp:
01/24/2018 07:13:02 PM (4 years ago)
Author:
obenland
Message:

O2 Follow: Avoid JS errors when following comments.

Props pento.
Fixes #2786.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/class-o2-follow.php

    r6421 r6423  
    183183     */
    184184    public function subscribe_o2_register_post_action_states() {
    185         if ( ! function_exists( 'o2_register_post_action_states' ) ) {
     185        if ( function_exists( 'o2_register_post_action_states' ) ) {
    186186            o2_register_post_action_states( 'follow', [
    187187                'normal'     => [
     
    280280        }
    281281
    282         if ( 'post-comment-subscribe' !== $_GET['action'] ) {
    283             die;
    284         }
    285 
    286         $this->subscribe_to_comments( $post_id );
     282        if ( 'post-comment-subscribe' === $_GET['action'] ) {
     283            $this->subscribe_to_comments( $post_id );
     284        }
     285
     286        // Echo success if this was an AJAX request, otherwise redirect.
     287        if ( isset( $_GET['ajax'] ) ) {
     288            echo '1';
     289        } else {
     290            wp_safe_redirect( get_permalink( $post_id ) );
     291        }
    287292        die;
    288293    }
Note: See TracChangeset for help on using the changeset viewer.