WordPress.org

Ready to get started?Download WordPress

Forums

links posted in posts or comments formatted wrong (7 posts)

  1. killingspree
    Member
    Posted 9 years ago #

    hi,
    i'm just starting my own blog using a 1.5 nightly build and have noticed a problem with the formatting of links both posted in posts and comments. it doesn't only display the desired URL as written into the tags, but adds the current url infront of it. so a url from a post on my frontpage suddenly becomes http://www.mypage.com/www.cnn.com/etc...

    the same happens if a user posts a url in his comment, then even the whole url to the specific post is added in front: like http://www.mypage.com/index.php/2005/02/my_test_post/www.urlfromcomment.com

    i've been searching quite a bit in the forums as well as several wikis and (of course) google, but haven't been able to pinpoint the solution to this problem

    thanks for any help

    kr
    steve

  2. Kafkaesqui

    Posted 9 years ago #

    You must specify the protocol for the url (i.e. http:// <-- web url); otherwise the browser must assume the link is a location on your site. So:

    http://www.yahoo.com

    is seen as a local path, whereas:

    http://www.yahoo.com

    is seen as a site url/address.

  3. killingspree
    Member
    Posted 9 years ago #

    thx a lot... any way around this, as i find it rather confusing for rather inexperienced commet posters... or do i just have to edit their comments in case?!

  4. Kafkaesqui

    Posted 9 years ago #

    Well, let's see...

    Simple: You could place an "http://" as the initial value for the comment form's "Website" input field to prompt them. The field is found in wp-comments.php (or comments.php for 1.5 theme templates).

    In 1.5's default theme comment.php, change the value to:

    value="<?php if($comment_author_url) { echo $comment_author_url; } else { echo 'http://'; } ?>"

    Not so simple:

    There are ways through PHP (as a hack to the script, or a plugin) to try and assure that web URLs are prefixed with the proper http scheme. These could be used to filter both the website URL and the contents of a comment. Just not easy to cover in an off-the cuff forum reply. :)

  5. killingspree
    Member
    Posted 9 years ago #

    never mind then :) i'm just getting into PHP and right now am proud that i managed to understand most of the content of the default theme folder :)

    for now i'll just settle with adding a little line above the comment field that urls have to be prefixed with http:// and in case somebody ignores that, i'll have to edit the comment...

    thx for your quick and comprehensive help, very much appreciated!

    steVe

  6. Kafkaesqui

    Posted 9 years ago #

  7. killingspree
    Member
    Posted 9 years ago #

    the plugin works really nice and solves all the trouble i had with the default wp function

    thx a lot

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.