• I found this:

    $input = 'www.google.co.uk/';
    
    // in case scheme relative URI is passed, e.g., //www.google.com/
    $input = trim($input, '/');
    
    // If scheme not included, prepend it
    if (!preg_match('#^http(s)?://#', $input)) {
        $input = 'https://' . $input;
    }
    
    $urlParts = parse_url($input);
    
    // remove www
    $domain = preg_replace('/^www\./', '', $urlParts['host']);
    
    echo $domain;
    
    // output: google.co.uk

    But where and especially how do I place this, so the URL showing on profiles will be shorter. Example:
    https://www.facebook.com/help/notifications > facebook.com/help/notifications
    We all know that https:// is back to the 90’s and www is gone in the most browsers, so why showing old URL’s, right?

    Only the showing URL and not the hardcoded URL ??

    https://www.ads-software.com/plugins/amr-users/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Kimberly

    (@_kimberly_)

    OR can I add a field to rename the links?

    URL https://www.facebook.com/name
    NAME My Facebook page
    URL https://www.twitter.com/name
    NAME Twitter me now!

    Plugin Author anmari

    (@anmari)

    Hi Kimberley,

    This add-on may help: https://wpusersplugin.com/downloads/amr-users-plus-social/
    It’s well commented and should be easy to customise for own use if you want to change it. It includes a user_url formatting function similar to what you request here.

    NOTE: While I kinda agree with you re www, there are people who believe otherwise. For example, see: https://www.yes-www.org/ and I have encountered people whose sites are known as www…… and they do not want other people to show it without the www. So the base plugin doesn’t strip what people entered as it assumes that is what they want. The way I see it, if people enter their website with the www, then they want it shown as such (else they’d leave the www out).

    I suppose one could make similar argument about the protocol – it provides info (eg: it’s a secure site or not), which a protocol independent url does not.

    One way around this is to have an icon as the link text instead – as per the social media examples. That would also help make the field width consistent and more efficient.

    Anyway the addon (v 1.1) mentioned above has very clear functions to format both the social media and the user url. It currently uses icons instead of link text for the social media stuff, but that you could change easily to what you suggest above.

    Examples:
    https://directories.wpusersplugin.com/list-with-url/
    https://directories.wpusersplugin.com/alpha-nav-list/

    hope that helps

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove https://www. and https://www. from user website url info’ is closed to new replies.