• I have been trying to solve a problem for over a week now with no luck. I need to find someone who knows PHP and is familiar with wordpress.

    I have a popup window for comments on my blog.

    When you view the post with its comments each comment has the the persons name who made the comment. I would like to hyperlink the name of the person who comments with their website ONLY if they give one (i do not require it to be entered).

    The input lines in the form are:

    <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />

    and

    <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />

    Any help would be appreciated
    thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • its not the input thats needed for this, is the output. and it would be helpful to know what its doing with now.

    In other words, in every theme i have seen..the comment author’s name IS ONLY linked if they provide a url, already.

    Im missing where you are asking for something that isnt supposed to be happening by default.

    How can it link without a url? If so, whats it linking to?

    Thats why its important to know what you are presently seeing.

    ah, from your other thread.


    The only problem is that when people do not enter a URL, which i do not require, the <?php comment_author_url(); ?> string is empty. The result is that the hyperlink becomes the name of the post!

    ..

    I’ll have to look at my 2.2.2 install – Im pretty sure it doesnt do that though.

    Thread Starter andyb2

    (@andyb2)

    so did you convince yourself of the issue?
    What do you suggest?

    umm, actually no I havent. Since every 2.2.x blog ive looked at, including my own installs dont do that.

    For instance, here is a friends 2.2.2 install:

    http://tin-men.net/2007/05/02/unsleepable-for-rapidweaver/

    If the author url is left blank, no link is made, to anything.

    I suggest looking at your plugins, to see if one of them might be causing that behaviour — or perhaps you have commented out a relative filter somewhere inside kses.php.

    Point is, that while its easy enough to give you the php to fix that — it shouldnt be happening, so the real fix is to figure out what’s causing it in the first place.

    Here’s a 2.3.x install:

    http://www.tamba2.org.uk/T2/2007/09/01/to-av-or-not-av/#comments

    Thread Starter andyb2

    (@andyb2)

    I’ve sorted it out!

    The reason this works is that there is a function comment_author_link() which does that. I didnt have that function in my code, just comment_author() and comment_author_url() which i was trying to use to achieve what comment_author_link() does.

    Thanks for making me look into the code

    Following the highlight blog author comments method as described at http://5thirtyone.com/archives/774, here’s how you could use comment_author_url()

    <?php if ($comment->comment_author_url != '') : ?>
    <a href="<?php comment_author_url(); ?>">Text you wish to have linked</a>
    <?php endif; ?>

    Explanation: if comment_author_url is NOT empty, show the url

    @scottlenger,
    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘is there a php coder out there?’ is closed to new replies.