Viewing 13 replies - 1 through 13 (of 13 total)
  • Yep, same thing happening here. You ever resolve your issue?

    Plugin Author Jean-Philippe Murray

    (@jpmurray)

    I’m curently loocking into this, I think I’ll post an update today resolving this issue!

    (Sorry for long time reply, I though I would have email notifications about theses ! :P)

    Plugin Author Jean-Philippe Murray

    (@jpmurray)

    Okay, I uploaded a new version to WordPress.org’s repository. It should come up as version 1.1 soon enough. I think I corrected the lines of code that where causing problems. If there is anything that still won’t work, feel free to contact me via the URL provided in the readme file !

    I fixed the “submitting even though under character count” Go to the JS file and attach the check to the submit of the form function, not the button press.

    change the lines here: jQuery(‘#publish’).mousedown(function()

    to this

    jQuery(‘#post’).submit(function()
    {
    if(unCompteur < maximum)
    {
    return true;
    }
    else
    {
    alert(‘You are over the maximum allowed characters for the title!’);
    return false;
    }
    });

    Also, the “settings” link in the plugins list was not working. It had the wrong URL. Change link near // Display a Settings link on the main Plugins page:

    ‘options-general.php?page=limit-a-post-title-to-x-characters/lptx.php’

    also, apologies if I am submitting this stuff incorrectly, I’m new to wordpress

    Hi, another change in the “submitting even though under character count” post,
    change
    if(unCompteur < maximum)
    to
    if(unCompteur <= maximum)

    for people not that familiar with the file structure, the JS file you need to change is here:

    /wp-content/plugins/limit-a-post-title-to-x-characters/js/lptx-script.js

    Plugin Author Jean-Philippe Murray

    (@jpmurray)

    Hey Mark ! I’ll be looking into this today!

    Plugin Author Jean-Philippe Murray

    (@jpmurray)

    Hey Mark ! I incorporated your bug fixes in the script (and credited you in the readme), it should update soon today. One thing I didn’t change though is the fact to attach the count check on form submit. If we do that, a jQuery is triggered on WP’s side that shoes a loading icon and makes the button grey. We still can submit again, but it’s confusing, as it’s like the form is submitting, but can’t, while it actually don’t submit at all. That is why the verification is attached to the click. It checks before sending the form and triggering WP’s built in scripts !

    Hi Jean-Philippe,

    I’m glad that you found some of my code useful. re: the loading icon. Yes, I can see your point. I guess the issue is that if we attach to the click event, we don’t intercept the “return” key. So, people can still submit the form, bypassing out character check.

    It’s possible that the loading icon can be overridden via an hook in the PHP. I’ll let you know if I discover anything along those lines.

    Thanks for the great plugin BTW. I really like the character counter on the right side. It’s excellent UI.

    Plugin Author Jean-Philippe Murray

    (@jpmurray)

    Thank for your comments !

    I shall look into it again soon, let’s keep in touch if you find something before me πŸ™‚

    Hi

    I did discover another issue: inthe JS, in your docReady function, you assign a keyup “verification_maximum” function to the title field. In this function, you make this assignment unCompteur = jQuery(elemId).val().length. This function works very well for the UI component on the right side.

    The issue is…

    That unCompteur value is used below on the submit click function: if(unCompteur <= maximum).

    The problem is…

    If the user comes to the edit page and does not modify the title (say they are just changing the category), when they click submit, they will get the error that the title is too long (at least, in firefox they do). This happens because unCompteur has not been assigned and evaluates as “undefined” and causes the if statement to render as false.

    the fix is…

    change the if statement in the submit click function as:

    if(jQuery(‘#title’).val().length <= maximum)

    Apologies if you fixed this already!

    Another solution for the issue where if you edit an existing post it incorrectly shows an over-count warning message is to add this line to the lptx-script.js file in the js directory of the plugin:

    Change it from this:

    var i;
    
    jQuery(document).ready(function(){
    	var maximum = jQuery('#lptx_maximum').val();
        jQuery('#title').keyup(function(){

    to this:

    var i;
    
    jQuery(document).ready(function(){
    	var maximum = jQuery('#lptx_maximum').val();
    	i = jQuery('#title').val().length;
        jQuery('#title').keyup(function(){

    Basically the i variable wasn’t getting set unless you entered text into the #title block. This initializes it on page load with the current value, and the check later on then correctly passes if the value is lower than the maximum allowed.

    Gabriel

    Plugin Author Jean-Philippe Murray

    (@jpmurray)

    Hey everyobdy. Thanks for emailing me and reporting theses bugs.

    I’m curently back from a medical leave, I’ll be updating things soon ! πŸ™‚

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: Limit a post title to X characters] Posts still publish even if title count is too long’ is closed to new replies.