WordPress.org

Ready to get started?Download WordPress

Forums

Admin jQuery error on install "Uncaught TypeError: Object #..." (15 posts)

  1. robhadfield
    Member
    Posted 3 years ago #

    Hi all...

    I've upgraded (by hand on command line) my install to 3.2.1
    All is working fine except I get a .js error (in the console log) in the admin area "Uncaught TypeError: Object #<Object> has no method 'swing'"

    This obviously refers to the JQ Easing script but unsure why it isn;t picking it up... any ideas?

    Cheers
    Rob

  2. KatieBen
    Member
    Posted 3 years ago #

    Same problem here.. did you figure out a fix?

  3. chucklin72
    Member
    Posted 3 years ago #

    I'm having the same problem. I have reinstalled wordpress and compared it with a fresh install. The fresh install (out of the box) doesn't have this problem. I'm suspecting that this is a problem with a plugin.

    Here are mine:

    BuddyPress Template Pack
    Version 1.0.2 | By apeatling

    MailChimp
    Version 1.2.4 | By MailChimp and Crowd Favorite

    MailChimp Archives
    Version 3.2 | By Mark Parolisi

    WordPress Popular Posts
    Version 2.1.4 | By H├ęctor Cabrera

    Akismet
    Version 2.5.3 | By Automattic

    All in One SEO Pack
    Version 1.6.13.2 | By Michael Torbert

    BuddyPress
    Version 1.2.5.2 | By The BuddyPress Community

    Buddypress Sitewide activity widget
    By Brajesh Singh

    Disable Admin Bar
    Version 1.1 | By Ozh

    Events Calendar Pro
    Version 1.2 | By Shane & Peter, Inc.

    Google Analytics for WordPress
    Version 4.1 | By Joost de Valk

    Janrain Engage
    Version 1.0.5 | By forestb

  4. chucklin72
    Member
    Posted 3 years ago #

    Looks like buddypress is the culprit.

  5. robhadfield
    Member
    Posted 3 years ago #

    For me it turns out that Buddypress (1.2.8) causes this error.

    Unfortunately I'm working on some core changes to Buddypress which means I can't upgrade at the moment! That's my own fault though of course.

    It's the new WP Admin menus that use 'swing' from jQuery Easing - did they before? I thought they were just a slide.

    The "install plugins" drop down still works as it uses slide rather than swing.

    That's my research.

  6. chucklin72
    Member
    Posted 3 years ago #

    For mine, the BP template pack was the problem. I fixed it by modifying
    bp-template-pack/bp-template-pack.php

    line 35 if ( !is_admin() ) {
    line 36 wp_enqueue_script( 'bp-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array( 'jquery' ) );
    line 37 }

  7. robhadfield
    Member
    Posted 3 years ago #

    Ah OK - I don't use that. Glad you sussed it for you.

  8. chucklin72
    Member
    Posted 3 years ago #

    Rob, I think whats important here is to disable the buddypress javascript when you are in the admin area.

    Adding a is_admin() test allows me to keep buddypress global.js loaded on the front end of the website and keep it from loading in wp-admin. It's useless in wp-admin anyway.

  9. robhadfield
    Member
    Posted 3 years ago #

    You're right, wrapping for tests is a good idea (and quick!) - I have many more pages to break before I'm back on this. If I'm stuck I'll be back!

  10. Tosh
    Member
    Posted 2 years ago #

    @ chucklin72 Thanks for the tip. I edited the bp-template-pack.php file per you instructions and I can edit my widgets again. Yay! Thank you!

  11. tmuka
    Member
    Posted 2 years ago #

    I had the same error, except without the bp-template-pack.php, my issue was from using the default buddypress theme. I adapted chucklin72's fix into my buddypress theme's function.php file.

    seems a bit sloppy for buddypress not to use a hook for that, but this fixes the issue with modals not closing in admin anyway...

    if ( !is_admin() ) {
    	/* Load the AJAX functions for the theme */
    	require_once( TEMPLATEPATH . '/_inc/ajax.php' );
    
    	/* Load the javascript for the theme */
    	wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
    }
  12. applegateian
    Member
    Posted 2 years ago #

    Hi guys

    I am using BuddyBase child theme and have this problem. I have tried replacing the global.js in the theme with the Buddypress file as I read elsewhere, but this didn't work.

    I also tried adding the code above into functions.php, but again, no luck.

    Any other ideas?

    Thanks

  13. tmuka
    Member
    Posted 2 years ago #

    @applegateian the code i posted isn't just to add to functions.php, the point is to find where the existing ajax.php and global.js files are being included and wrap those lines in

    if ( !is_admin() ) {
        //existing code to wrap in this check goes here.
    }

    i think in a child theme you'll have to do it in the parent theme since functions.php of the child and parent both get loaded. hope this helps!

  14. applegateian
    Member
    Posted 2 years ago #

    Thanks Tmuka

    In the parent theme, there are two instances in functions.php where if ( !is_admin().... appears as below:

    function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
    	if ( !is_admin() || !is_super_admin() )
    		return false;
    
    	if ( 'activity' == $_POST['page_on_front'] )
    		return 'activity';
    	else
    		return $oldvalue;
    }
    if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" )
    	add_action( 'admin_notices', 'bp_dtheme_show_notice' );

    I'm not entirely clear where to add the code above, any thoughts?

    The child theme functions.php is empty.

    Thanks,

    Ian

  15. tmuka
    Member
    Posted 2 years ago #

    yes, you need to find the part inside of the if statement in my original post, not the if is_admin wrapper that you need to add...

Topic Closed

This topic has been closed to new replies.

About this Topic