• Resolved ianmoody

    (@ianmoody)


    When a user posts a comments their name is used as a link to their website. If they haven’t got a website it is automatically https:// so on a comments page I end up with several links to “https:///” Is there a way to stop https:// being in the user url field by default?

Viewing 3 replies - 1 through 3 (of 3 total)
  • What you can do is edit the comments.php file so that the link only appears if they’ve entered a site.

    In your comments.php page, you’ll should find some code which is along the lines of
    <a href="<?php comment_author_url(); ?>"><?php comment_author();?></a>

    You can wrap this in an if check like thus:

    <?php if ('' != get_comment_author_url()) { ?>
    <a href="<?php comment_author_url(); ?>"><?php comment_author();?></a>
    <?php } else { comment_author(); } ?>

    Now, the name will no longer be hyperlinked if they didn’t leave a URL.

    Thread Starter ianmoody

    (@ianmoody)

    Unfortunately that doesn’t solve the problem. When a user signs up their author url is automatically being set to https:// if they don’t input anything into that field , so https:// then goes into the data base under that users user_url and then for every comment that user makes into the comment’s commont_author_url field. I need stop it from auto inserting https://, which I presume would require editing some of WP’s core files, which I can do without removing anything important, but I can’t seem to find the right one.

    Thread Starter ianmoody

    (@ianmoody)

    Fixed it. Just needed to remove ” ‘https://&#8217; .” from “$newuser_url = preg_match(‘/^(https?|ftps?|mailto|news|gopher):/is’, $newuser_url) ? $newuser_url : ‘https://&#8217; . $newuser_url;” in profile.php

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘changing default user website’ is closed to new replies.