Support » Plugin: Welcome Pack » [Plugin: Welcome Pack] Getting js error on the email admin

  • smurkas

    (@smurkas)


    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/

Viewing 1 replies (of 1 total)
  • Plugin Author Paul Gibbs

    (@djpaul)

    BuddyPress Lead Developer

    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

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Welcome Pack] Getting js error on the email admin’ is closed to new replies.