Automattic / babble

Multilingual WordPress done right.
https://wordpress.org/plugins/babble/
245 stars 50 forks source link

The flag to prevent recursion in `updated_post_meta` is never lifted #261

Closed simonwheatley closed 9 years ago

simonwheatley commented 9 years ago

The flag is set with: $this->no_meta_recursion = 'updated_post_meta';

But then when the flag is lifted, the wrong property name is used: $this->updated_post_meta = false;

Current code as follows:

    public function updated_post_meta( $meta_id, $post_id, $meta_key, $meta_value ) {
        // Some metadata shouldn't be synced
        if ( ! apply_filters( 'bbl_sync_meta_key', true, $meta_key ) )
            return;
        if ( $this->no_meta_recursion )
            return;
        $this->no_meta_recursion = 'updated_post_meta';
        $translations = $this->get_post_translations( $post_id );
        foreach ( $translations as $lang_code => & $translation ) {
            if ( $this->get_post_lang_code( $post_id ) == $lang_code )
                continue;
            update_post_meta( $translation->ID, $meta_key, $meta_value );
        }
        $this->updated_post_meta = false;
    }

This results in meta not being synced when it should be synced. :unamused:

simonwheatley commented 9 years ago

Finally got that set of PRs straight.