Plugin Directory

Changeset 2855166


Ignore:
Timestamp:
01/26/2023 12:40:05 PM (3 years ago)
Author:
vuukle
Message:

Change the way the post information is obtained to fix an issue where the plugin would sometimes get the wrong post information

Location:
free-comments-for-wordpress-vuukle/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • free-comments-for-wordpress-vuukle/trunk/free-comments-for-wordpress-vuukle.php

    r2818437 r2855166  
    1919 * Plugin URI:        https://vuukle.com
    2020 * Description:       Vuukle is the smartest commenting platform that offers AI-powered commenting, Unique Sharing tool bar, Emoji reaction widget and real time analytics with just one click. Customize all you want, make your pages load faster and experience user engagement like never before!
    21  * Version:           5.1.1
     21 * Version:           5.1.2
    2222 * Author:            Vuukle
    2323 * Author URI:        https://vuukle.com
     
    7171 */
    7272function Run_Free_Comments_For_Wordpress_vuukle() {
    73     $plugin = new Free_Comments_For_Wordpress_Vuukle( '5.1.1', plugin_dir_path( __FILE__ ), plugin_dir_url( __FILE__ ), plugin_basename( __FILE__ ) );
     73    $plugin = new Free_Comments_For_Wordpress_Vuukle( '5.1.2', plugin_dir_path( __FILE__ ), plugin_dir_url( __FILE__ ), plugin_basename( __FILE__ ) );
    7474    $plugin->run();
    7575}
  • free-comments-for-wordpress-vuukle/trunk/public/partials/free-comments-for-wordpress-vuukle-public-platform.php

    r2603004 r2855166  
    1313 */
    1414if ( ! empty( $this ) && $this instanceof Free_Comments_For_Wordpress_Vuukle_Public ) {
    15     $author = get_the_author_meta( 'display_name', $post->post_author );
    16     $tags   = wp_get_post_tags( $post->ID, [ 'number' => 3 ] );
    17     $tags   = ! empty( $tags ) ? array_map( function ( $obj ) {
     15    function get_the_post_id() {
     16        if (in_the_loop()) {
     17            $post_id = get_the_ID();
     18        } else {
     19            global $wp_query;
     20            $post_id = $wp_query->get_queried_object_id();
     21        }
     22        return $post_id;
     23    }
     24    $post_id   = get_the_post_id();
     25    $post_info = get_post( $post_id );
     26    $author    = get_the_author_meta( 'display_name', $post_info->post_author );
     27    $tags      = wp_get_post_tags( $post_id, [ 'number' => 3 ] );
     28    $tags      = ! empty( $tags ) ? array_map( function ( $obj ) {
    1829        return $obj->name;
    1930    }, $tags ) : null;
    20     $tags   = ! empty( $tags ) ? implode( ', ', $tags ) : '';
     31    $tags      = ! empty( $tags ) ? implode( ', ', $tags ) : '';
    2132    ?>
    2233    <script data-cfasync="false">
    2334        var VUUKLE_CONFIG = {
    2435            apiKey: "<?php echo esc_html( $this->app_id ); ?>",
    25             articleId: "<?php echo esc_html( $post->ID ); ?>",
    26             title: <?php echo "'" . esc_html( get_the_title( $post->ID ) ) . "'"; ?>,
     36            articleId: "<?php echo esc_html( $post_id ); ?>",
     37            title: <?php echo "'" . esc_html( get_the_title( $post_id ) ) . "'"; ?>,
    2738            tags: "<?php echo esc_html( str_replace( [ '"', "'" ], '', quotemeta( stripslashes( $tags ) ) ) ); ?>",
    2839            author: "<?php echo esc_html( str_replace( [
Note: See TracChangeset for help on using the changeset viewer.