Thread

CP/URL service not using correct CP URL, using php SELF

June 28, 2017 1:46pm

Subscribe [3]
  • #1 / Jun 28, 2017 1:46pm

    TJ Draper's avatar

    TJ Draper

    210 posts

    I’m running into an issue where the CP/URL service is not using the config item cp_url and instead uses SELF.

    In the screenshot I’m dumping:

    ee()->config->item('cp_url');
    ee('CP/URL', 'cp/members/profile/settings')->setQueryStringVariable('id', $memberId);
    ee('CP/URL', 'cp/members/profile/settings')->setQueryStringVariable('id', $memberId)->compile();
    

    cp-url-dump.png

    As you can see, cp_url is set, but the URL class’s base is wrong.

    From inspecting the URLFactory class, it seems the problem is either in the constructor when setting the default_cp_url or the make method using the default_cp_url instead of checking cp_url first.

  • #2 / Jun 29, 2017 11:55am

    Kevin Cupp's avatar

    Kevin Cupp

    722 posts

    Hi TJ, we have it this way so that URLs can be correctly generated to either admin.php or index.php, whichever you’re accessing, and also if you’re accessing the CP across other domains via MSM. So we try to leave out the typically hard-coded cp_url setting when we can.

    But I saw in Slack you were having trouble redirecting with one of these URLs? We redirect using URLs generated via the CP/URL service all the time and have never heard of the browser attempting to redirect back to root. Can you share what you’re doing differently than us?

ExpressionEngine News

#eecms, #events, #releases