Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom URL for admin area and login page #1324

Merged
merged 8 commits into from
Apr 26, 2023
Merged

Fix custom URL for admin area and login page #1324

merged 8 commits into from
Apr 26, 2023

Conversation

poetter-sebastian
Copy link
Contributor

@poetter-sebastian poetter-sebastian commented Apr 17, 2023

@herrvigg herrvigg added the core Core functionalities, including the admin section label Apr 18, 2023
Copy link
Contributor

@spleen1981 spleen1981 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Rather than local preg_matches I would introduce a new qtranxf_get_admin_base function maybe in url.php
  • Though the regex looks ok, I would use a simpler str_replace( [site_url(), '/'], '', admin_url() );

Creaded the function qtranxf_get_login_base for login name
Created the function´qtranxf_get_admin_base for backend name
Creaded test function for str_replace
@poetter-sebastian
Copy link
Contributor Author

poetter-sebastian commented Apr 19, 2023

I've created two new functions for backend and login name and use the str_replace instead of regex.

(maybe the test is not necessary)

src/url.php Outdated Show resolved Hide resolved
src/url.php Outdated Show resolved Hide resolved
dev/qtx-test-test-urlBases.php Outdated Show resolved Hide resolved
@poetter-sebastian
Copy link
Contributor Author

Thanks for the comments, I simplified the functions.

@herrvigg
Copy link
Collaborator

Looks good at first sight, I'll take a closer look soon.

@herrvigg herrvigg added the enhancement New feature or request label Apr 20, 2023
Copy link
Collaborator

@herrvigg herrvigg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to rewrite this a bit differently.

src/url.php Outdated Show resolved Hide resolved
src/url.php Outdated Show resolved Hide resolved
src/url.php Outdated Show resolved Hide resolved
@poetter-sebastian
Copy link
Contributor Author

Is there something I can do ?

@herrvigg
Copy link
Collaborator

I will merge it, but please test more once it's in master.
I spotted possible bugs but they come from the state before patch so let's separate the scope of changes. Beyond the custom wp-admin functionality coming here, this should also fix neutral path for wp-login.php. The previous version has a regex match against wp-login/ (with trailing slash) but this looks wrong to me. The new check is a strict equality vs wp_login_url() which leads to wp-login.php by default.

@herrvigg herrvigg changed the title Fixed custom url for admin area (error) Fix custom URL for admin area and login page Apr 26, 2023
@herrvigg herrvigg merged commit 0a7e21e into qtranslate:master Apr 26, 2023
@herrvigg
Copy link
Collaborator

Released in 3.15.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionalities, including the admin section enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants