• irregardless

    (@irregardless)


    despite only being a wordpress user for a couple weeks and virtually ignorant of PHP, i’ve managed to squash a fair share of bugs through perseverance and research, but this one has me stumped.

    i’m running wordpress 2 with an adaptation of the wordpress classic 1.5 theme. and have everything operating smoothly except one thing: whenever i add a “mailto” link to a post and press ‘save’ i’m thrown back to my home page without any changes actually getting saved.

    it doesn’t matter whether i use the rich text editor, the editor monkey plugin, or i manually type in the source code. i can put in regular http hyperlinks just fine, but if i try a mailto, nothing happens.

    any ideas? many thanks.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Samuel B

    (@samboll)

    What form are you using for the links?
    This works for me:
    <a href="mailto:blah@blah.com">blah's email</a>

    giving this result:
    blah’s email

    Thread Starter irregardless

    (@irregardless)

    yep, i’m using standard html mailto syntax and whenever i press save, my post is reset to the point before i started editing.

    Chris_K

    (@handysolo)

    Would you have an example of this that we could look at? Would be very helpful! πŸ™‚

    stewdio

    (@stewdio)

    Are you clicking save and continue editing, or just save by itself.

    I have run into a related problem, but it may be because of an edited plugin or core file I have changed on my own.

    Myself, I cannot click “save and continue editing” almost exclusively. It’s something I know I did, but i’m curious about how your saving your posts to comapre wih my own experience and troubleshooting.

    Samuel B

    (@samboll)

    yea- this is weird. I don’t think I’ve heard of this problem.
    An example would be nice.

    The only thing I could find at TRAC was this:
    http://trac.wordpress.org/ticket/532

    Doesn’t really describe your problem, though.

    Thread Starter irregardless

    (@irregardless)

    i did some playing and, on a hunch, have determined that wordpress is choking on the ‘@’ symbol. as soon as i removed it, my mailto links were accepted. though they aren’t very useful without the ‘@’.

    so that leads me to believe that it’s some sort of text encoding problem. in fact, if i input the html character entities via an email encoder, wordpress accepts it just fine.

    that’s more of a workaround and not a solution. do my pages need to be using a particular text encoding? i think they’re utf at the moment.

    Chris_K

    (@handysolo)

    Would be interesting to know what plugins you have running.

    I just checked and I have no problem putting “mailto” urls in my posts.

    Chris_K

    (@handysolo)

    … as a thought, might also be interesting to know if your host is running mod_security. Granted, a long shot, but I’ve seen some mod_security rules run amok…

    Thread Starter irregardless

    (@irregardless)

    well i turned off all my plugins and the problem is still occurring; no ‘@’ signs to be had.

    i checked, and yes, my host is running mod_security, but beyond that i have no idea how to find out if it is the cause of the problem.

    now to be clear, i can type the @ in the body of a post just fine. it’s when i put the @ inside the ‘a’ tag to create the mailto link that it fails. the problem occurs whether i’m posting from multiple browsers on mac os x 10.4 or IE on win2k.

    my hunch is still leaning toward some kind of character encoding conflict, but i haven’t made much progress in that direction.

    Chris_K

    (@handysolo)

    My hunch would be to find out if your host’s mod_security rules don’t like the “mailto” tag. They probably don’t want to “give away” the rules they’re using, but you might ask them if posts with mailto in ’em are going to have issues.

    Thread Starter irregardless

    (@irregardless)

    i’ll check with my host and see what they have to say, but let me run this by you as well:

    if i use improper syntax like this :

    <a href="mailto:test.example.com">email me</a>

    my post works fine. i get a working mailto link that launches my mail program and puts test.example.com in the To: field.

    if i try

    <a href="mailto:test@example.com">email me</a>

    it fails.

    Chris_K

    (@handysolo)

    See, I can’t replicate that on my blog (WP 2.0.2). Your second example works for me.

    How are you adding the link? I’ve tried doing it with the wysiwyg editor directly (clicking the hyperlink speed button, typing in mailto: etc.) and I’ve tried adding it via the little html editor as part of the wysiwyg editor. Both worked for me.

    If not mod_security rules, we’re probably back to wondering about the plugins you have activated. Do any of them do any post processing or formatting?

    I had the same problem – the workaround – use ascii text for the “@” symbol

    & # 64 ;

    (with no spaces of course).

    Hope that helps.

    Working on robwrightnet’s workaround, I added the following to wp-includes/kses.php on line 50:

    $string = str_replace("@","&#64",$string);

    so the function looks like this:

    function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'feed', 'gopher', 'mailto'))
    	###############################################################################
    		# This function makes sure that only the allowed HTML element names, attribute
    		# names and attribute values plus only sane HTML entities will occur in
    		# $string. You have to remove any slashes from PHP's magic quotes before you
    		# call this function.
    		###############################################################################
    	{
    	$string = str_replace("@","&#64",$string);
    	$string = wp_kses_no_null($string);
    	$string = wp_kses_js_entities($string);
    	$string = wp_kses_normalize_entities($string);
    	$string = wp_kses_hook($string);
    	$allowed_html_fixed = wp_kses_array_lc($allowed_html);
    	return wp_kses_split($string, $allowed_html_fixed, $allowed_protocols);
    } # function wp_kses

    My mailto links in the tinymce wysiwyg editor now work like a charm.

    Cheers,
    Mike

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘mailto links breaking my posts’ is closed to new replies.