Support » Plugin: WP-PostRatings » Ratings not working in chrome ?

  • Resolved rivmedia

    (@rivmedia)


    Is there anyone else getting the ajax loading image when pressing a star rating in Chrome and IE ? It works perfectly on Firefox.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Lester Chan

    (@gamerz)

    Most likely it is your theme or plugin conflict that is causing it. I can confirm 100% it will work with the default theme out of the box on all major browsers.

    You can test it on my dev site on Chrome with the default theme https://lesterchan.net/wordpress/

    Yes you are correct, shortly after posting the above I realised it was not browser related, but actually dependant on the user. For us it was all non-admin users could not rate.

    We found that this code we were using was conflicting :

    // Redirect non-admin users out of the Admin panel
    add_action( 'init', 'blockusers_init' );
    function blockusers_init() {
        $user_id = get_current_user_id();
        if ( is_admin() & $user_id != 1) {
            wp_redirect( home_url() );
            exit;
        }
    }
    

    We’ve solved this issue but adding the Ajax conditional :

    // Redirect non-admin users out of the Admin panel
    add_action( 'init', 'blockusers_init' );
     function blockusers_init() {
        if ( is_admin() && ! current_user_can( 'administrator' ) && 
           ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
            wp_redirect( home_url() );
            exit;
        }
    }
    • This reply was modified 2 years, 5 months ago by rivmedia.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ratings not working in chrome ?’ is closed to new replies.