WordPress.org

Ready to get started?Download WordPress

Forums

is there a php coder out there? (8 posts)

  1. andyb2
    Member
    Posted 6 years ago #

    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

  2. whooami
    Member
    Posted 6 years ago #

    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.

  3. whooami
    Member
    Posted 6 years ago #

    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.

  4. andyb2
    Member
    Posted 6 years ago #

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

  5. whooami
    Member
    Posted 6 years ago #

    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

  6. andyb2
    Member
    Posted 6 years ago #

    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

  7. scottlenger
    Member
    Posted 6 years ago #

    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

  8. noonnoo
    Member
    Posted 5 years ago #

    @scottlenger,
    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic