• Resolved iCosmin

    (@icosmin)


    Hi,

    Please correctly register and then enqueue the JS for the themed profiles. You are now just enqueuing it, you need to register it with a hook first.

    Try to dequeue the useless file returns an undefined index notice, because there is no hook registered.

    This is the line, in /theme-my-login/modules/themed-profiles/themed-profiles.php :

    /**
    	 * Enqueue scripts
    	 *
    	 * @since 6.4
    	 * @access public
    	 */
    	public function wp_enqueue_scripts() {
    		wp_enqueue_script( 'tml-themed-profiles', plugins_url( 'theme-my-login/modules/themed-profiles/themed-profiles.js' ), array( 'jquery' ) );
    	}

    https://www.ads-software.com/plugins/theme-my-login/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    The function wp_enqueue_script also registers a script if it’s not registered.

    Thread Starter iCosmin

    (@icosmin)

    add_action( 'wp_print_scripts', 'my_deregister_unneeded_js', 100 );
    function my_deregister_unneeded_js() {
    
        // TML Themed profiles
        if ( !is_page( array( 'profile', 'login', 'logout', 'lostpassword', 'register', 'resetpass' ) ) ) {
            wp_deregister_script( 'tml-themed-profiles' );
        }
    
    }

    … results in these notices being shown (checking with WP_DEBUG):

    Notice: Undefined index: tml-themed-profiles in /var/www/.../wp-includes/class.wp-scripts.php on line 250
    
    Notice: Trying to get property of non-object in /var/www/.../wp-includes/class.wp-scripts.php on line 250
    Plugin Author Jeff Farthing

    (@jfarthing84)

    I’m not sure why I have that script loading on every page. I’ll have to fix that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Themed profiles module – script enqueueing’ is closed to new replies.