We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

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

Developer Preview

TJ Draper's avatar
TJ Draper
222 posts
7 years ago
TJ Draper's avatar TJ Draper

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.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
7 years ago
Kevin Cupp's avatar Kevin Cupp

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?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.