Comments (4)
It's impossible to say without seeing your code. Can you paste your code up on somewhere like https://gist.github.com/ or http://pastebin.com/ (or fork this repo and commit your changes) and let me know the URL here and I'll take a look.
from wp-force-password-change.
Thanks for your response. I figured out a solution. Here are the changes I made to the redirect()
function.
- added an
else
section to handle an "allowed" front-end URL - updated
wp_redirect()
to use the WooCommerce Edit Account URL
function redirect() {
global $current_user;
if ( is_admin() ) {
$screen = get_current_screen();
if ( 'profile' == $screen->base )
return;
if ( 'plugins' == $screen->base )
return;
} else {
global $wp;
$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );
if ( strpos( $current_url, 'edit-account' ) ) {
return;
}
}
if ( ! is_user_logged_in() )
return;
wp_get_current_user();
if ( get_user_meta( $current_user->ID, 'force-password-change', true ) ) {
wp_redirect( get_site_url() . '/my-account/edit-account' );
exit; // never forget this after wp_redirect!
}
}
Thanks,
-J
from wp-force-password-change.
Great, glad you figured it out!
from wp-force-password-change.
This can be fixed for almost all front-end profile plugins (WooCommerce, TML, etc) by simply checking if the current page is the same as the redirect.
Add this before if ( ! is_user_logged_in() )
:
if ( wp_make_link_relative( admin_url( 'profile.php' ) ) == $_SERVER['REQUEST_URI'] )
return;
A nice addition would be a filter to allow custom overrides to be added without modifying the plugin.
from wp-force-password-change.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-force-password-change.