WordPress.org

Ready to get started?Download WordPress

Forums

Welcome Pack
Getting js error on the email admin (2 posts)

  1. smurkas
    Member
    Posted 3 years ago #

    Hi!

    I just downloaded the plugin and tried it out on my site. I get a js error saying that jq is not defined. I rewrote the js to this

    (function($) {
    	$(document).ready( function() {
    
    		$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
    
    		if (-1 === window.location.search.indexOf('tab=emails'))
    			postboxes.add_postbox_toggles('buddypress_page_welcome-pack');
    		else
    			postboxes.add_postbox_toggles('buddypress_page_welcome-pack-emails');
    
    		$('div.initially-hidden').each( function() {
    			$(this).hide();
    		});
    
    		$('#dpw-admin-metaboxes-general input').click( function() {
    			var button = $(this);
    			var config = $('div.setting-' + button.attr('class'));
    
    			if ( 1 == button.attr('value') )
    				config.css('background-color', 'rgb(255,255,224)').slideDown('fast').animate( { backgroundColor: 'rgb(255,255,255)' }, 1600);
    			else
    				config.stop(true).slideUp();
    		});
    
    		$('#emailpicker').change( function() {
    			var index = this.selectedIndex;
    			if ( 0 == index ) {
    				$('#email').hide().empty();
    				return;
    			}
    
    			$.post( ajaxurl, {
    				action: 'dpw_fetch_email',
    				'cookie': encodeURIComponent(document.cookie),
    				'_wpnonce': $("#_ajax_nonce_dpw_emails").val(),
    				'id': index
    			},
    			function(response)
    			{
    				if ( response[0] + response[1] == '-1' )
    					return;
    
    				$('#email').html(response.substr(0, response.length-1)).show();
    			});
    		});
    
    	});
    })(jQuery);

    and that works. Unless jq was intended as something different than a shorthand for jQuery then the self execution wrapper is the recommended way of doing things.

    http://wordpress.org/extend/plugins/welcome-pack/

  2. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 3 years ago #

    jq was/is used by the BuddyPress default theme. Obviously it only works as long as you are using the default theme, or a child theme of it, or redeclare it. I have changed this in the current development version which I'll release in a couple of weeks.
    Thank you for writing and leaving feedback

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic