WordPress.org

Ready to get started?Download WordPress

Forums

make_slugedit_clickable() is not defined (13 posts)

  1. helmi
    Member
    Posted 5 years ago #

    After upgrading to WP 2.9 i get the error "make_slugedit_clickable()" in Firebug and all javascript on post edit page doesn't work.

    Any idea where this may come from?

  2. Rhand
    Member
    Posted 5 years ago #

    Error is not very clear. The function - functions != errors - can be found in:

    * /wp-admin/js/slug.dev.js -> line 41

    Referenced 4 times:

    * /wp-includes/js/autosave.js -> line 1
    * /wp-admin/js/page.js -> line 1
    * /wp-admin/js/slug.dev.js -> line 17
    * /wp-admin/js/page.dev.js -> line 3

    So it does look like a javascript issue in the Dashboard..
    Do you have an Apache error log you can look at for more information and can you reproduce the error? What browser were you using? Did you try to run WP with all plugins turned off? Did you get the same errors?

  3. helmi
    Member
    Posted 5 years ago #

    there's no slug.dev.js in /wp-admin/js/ in my blog nor in the download package - probably that's the plain simple problem. I'll have a look for that.

  4. helmi
    Member
    Posted 5 years ago #

    Seems like this file is nowhere - like page.js and page.dev.js are also not there.

    Are you sure you named the right ones? These files are not in the germen nor in the english (original) download package and i even don't get them if i checkout via svn.

  5. helmi
    Member
    Posted 5 years ago #

    The problem was caused by the more fields plugin. I've disabled it and now it works.

  6. dokshor
    Member
    Posted 5 years ago #

    I found a solution.

    Open wp-admin/js/utils.js

    In the header of file: add

    function edit_permalink(post_id) {
    	var i, c = 0, e = jQuery('#editable-post-name'), revert_e = e.html(), real_slug = jQuery('#post_name'), revert_slug = real_slug.html(), b = jQuery('#edit-slug-buttons'), revert_b = b.html(), full = jQuery('#editable-post-name-full').html();
    
    	jQuery('#view-post-btn').hide();
    	b.html('<a href="#" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="#">'+slugL10n.cancel+'</a>');
    	b.children('.save').click(function() {
    		var new_slug = e.children('input').val();
    		jQuery.post(slugL10n.requestFile, {
    			action: 'sample-permalink',
    			post_id: post_id,
    			new_slug: new_slug,
    			new_title: jQuery('#title').val(),
    			samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) {
    				jQuery('#edit-slug-box').html(data);
    				b.html(revert_b);
    				real_slug.attr('value', new_slug);
    				make_slugedit_clickable();
    				jQuery('#view-post-btn').show();
    			});
    		return false;
    	});
    	jQuery('#edit-slug-buttons .cancel').click(function() {
    		jQuery('#view-post-btn').show();
    		e.html(revert_e);
    		b.html(revert_b);
    		real_slug.attr('value', revert_slug);
    		return false;
    	});
    	for(i=0; i < full.length; ++i) {
    		if ('%' == full.charAt(i)) c++;
    	}
    	slug_value = (c > full.length/4)? '' : full;
    	e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
    		var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
    		// on enter, just save the new slug, don't save the post
    		if (13 == key) {b.children('.save').click();return false;}
    		if (27 == key) {b.children('.cancel').click();return false;}
    		real_slug.attr('value', this.value)}).focus();
    }
    
    function make_slugedit_clickable() {
    	jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
    }

    This worked for me.

    Best regards

  7. Michelle
    Member
    Posted 5 years ago #

    Thanks @dokshor! That works great. Wish I didn't have to touch the WP core but I do need both this and the More Fields plugin to work - you're a lifesaver. :)

  8. leggo-my-eggo
    Member
    Posted 5 years ago #

    Actually, it seems there is a simple edit to the More Fields plugin which fixes this issue, posted by shortformblog on the More Fields Forums here:

    http://labs.dagensskiva.com/forum/topic.php?id=234&replies=8#post-810

    It fixes several problems related to More Fields and javascript.

    So, no Core Edits necessary.

  9. Michelle
    Member
    Posted 5 years ago #

    Even better, @leggo-my-eggo - thanks! I realized just this morning that the above fix works okay for the edit-published-on-date javascript, but that the edit-permalink button was still deactivated.

    Updating the more-fields file fixed everything and I was able to roll back utils.js to the original version sent out with 2.9.1. Thank you!

  10. mralexweber
    Member
    Posted 5 years ago #

    I'm having the same problem!

    To be fair, I'm using WPMU, but this doesn't seem to be related. I've just updated my codebase using svn to the latest tag. No dice. Also not using the more-fields plugin.

    Admin JS is broken, specifically the drag-n-drop and edit post permalink (slug) button.

    Please help!

  11. leggo-my-eggo
    Member
    Posted 5 years ago #

    @mralexweber if you're not using the more fields plugin, then this problem likely does not relate to you.

    You could try searching your plugins' code for make_slugedit_clickable to see if some other plugin has implemented that function.

  12. mralexweber
    Member
    Posted 5 years ago #

    @leggo-my-eggo I guess you're right, I'm not having the same problem, but rather getting the same error.

    I searched through my wp directory, and here's what I came up with:

    ./wp-admin/js/page.js
    ./wp-admin/js/slug.dev.js
    ./wp-admin/js/slug.js
    ./wp-admin/js/post.dev.js
    ./wp-admin/js/post.js
    ./wp-admin/js/page.dev.js

    It seems like the following scripts ARE being loaded: common, media-upload, utils, word-count.

    Where are page.js, post.js, and slug.js supposed to be loaded? I've searched around a lot but please point me in the right direction if you know where I should be looking.

    Thanks a lot!

  13. mralexweber
    Member
    Posted 5 years ago #

    After a bit more debugging, I've forcibly loaded slug[.dev].js and that appears to be working.

    Now I'm getting an error with localization, it seems like! FFFUUUUUUU

    Here's the error, anyway. I may need to make a new topic for this.

    slugL10n is not defined
    http://example.com/wp-admin/js/slug.dev.js?ver=2.9.1
    Line 5

    And that line consists of:
    b.html('<a href="#" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="#">'+slugL10n.cancel+'</a>');

    :sigh:. Again, any help is appreciated.
    Thanks,
    Alex

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.