• Hi,

    I noticed that some of my translation code was being duplicated 5 times and finally traced it to the Social Connect plugin. Further investigation showed that it was the sc_add_javascripts() function in the media.php file and was related to the way that the javascript files were being included. I am by no means an expert on this plugin, but I added the following to my functions.php file and all is still working as expected, without the duplicated javascript:

    // Override Social Connect plugin to prevent duplicate javascript output
    remove_action( 'login_head', 'sc_add_javascripts' );
    remove_action( 'wp_head', 'sc_add_javascripts' );
    add_action( 'login_head', 'my_sc_add_javascripts' );
    add_action( 'wp_head', 'my_sc_add_javascripts' );
    function my_sc_add_javascripts(){
    	wp_enqueue_script("social_connect", SOCIAL_CONNECT_PLUGIN_URL . "/media/js/connect.js", array("jquery", "jquery-ui-core", "jquery-ui-dialog"));
    }

    The original code uses the wp_print_scripts function, which is calling the print_scripts filter, which in turn results in the duplicated translation javascript. Unless I am totally off, this might be a good update for the base plugin.

    Thanks for all the work you’ve put into this!

    http://ww.wp.xz.cn/extend/plugins/social-connect/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Social Connect] Fix for sc_add_javascripts()’ is closed to new replies.