Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter kirti09

    (@kirti09)

    Hello,

    Please reply. I am waiting.

    Plugin Author Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    Hello! I’ll take a look ??

    Plugin Author Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    Okay! I think I’ve got it. I’m assuming you’re using the plugin’s built-in CF7_URL shortcode, which, in the current version of 3.2, uses the $_SERVER['SERVER_NAME'] variable for pulling the site domain.

    I took a look at the webpage you provided and can see that it uses Nginx and I’ve discovered this old WordPress Core ticket that in some server configurations for Nginx, that variable is outputted as _ (an underscore) which seems to be happening with your site.

    For an immediate fix, you can edit the /wp-content/plugins/contact-form-7-dynamic-text-extension/includes/shortcodes.php file and replace lines 104-110…

    // Build the full URL from the $_SERVER array
    $url = sprintf('http%s://', is_ssl() ? 's' : '');
    if (!empty($_SERVER['SERVER_PORT']) && intval($_SERVER['SERVER_PORT']) !== 80) {
        $url = $url . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
    } else {
        $url = $url . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    }

    with this

    // Build the full URL
    if (!empty($_SERVER['SERVER_PORT']) && intval($_SERVER['SERVER_PORT']) !== 80) {
        $url = network_home_url() . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
    } else {
        $url = network_home_url($_SERVER['REQUEST_URI']);
    }

    We’ll certainly update our plugin with this code in the future as well.

    Thank you!

    Thread Starter kirti09

    (@kirti09)

    Hello,

    Thanks for your reply. It’s working fine now.
    Please update this code in your next plugin update.

    Thanks.

    Hey.. this is apparently breaking my install.. with version 3.3.0 url passed from:

    https://www.argenteriadabbene.com:443/it/prodotto/ricci-ascot/
    to
    https://argenteriadabbene.com/it:443/it/prodotto/ricci-ascot/

    That /it that comes twice is breaking the link.

    Why using network_home_url() ? i’m not on a network at all.

    I’m using qtranslateXT for language management and website is served by nginx as a proxy on port 80 and apache on port 443 (ssl).

    i temporary solved by modifying the file (link 96) you mentioned with

    $url = home_url($_SERVER[‘REQUEST_URI’]);

    Plugin Author Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    Version 3.3.0 includes the update that resolved this issue for @kirti09.

    @mayaliny can you please start a new thread for your issue? That’ll make it easier for both of us to track progress since this person’s issue was resolved.

    I chose to use network_home_url() because that is what WordPress used to resolve the same issue in this thread. Also, the first few lines in network_home_url() checks for a network using !is_multisite() and determines if your site is not a network, then it returns the value for home_url(), so this function is used over just home_url() so it is compatible with both network and single installations. See WordPress Documentation here.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Current url not working’ is closed to new replies.