mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Add new filter to modify home URL
Allows to change the home/landing page URL when viewing restricted pages instead of permanently set the redirection to the default home page
This commit is contained in:
@@ -1068,7 +1068,7 @@ function um_pre_profile_shortcode( $args ) {
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( ! um_can_view_profile( um_get_requested_user() ) && ! um_is_myprofile() )
|
||||
um_redirect_home();
|
||||
um_redirect_home( um_get_requested_user(), um_is_myprofile() );
|
||||
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', um_get_requested_user() ) )
|
||||
UM()->user()->cannot_edit = 1;
|
||||
@@ -1076,7 +1076,7 @@ function um_pre_profile_shortcode( $args ) {
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
} else {
|
||||
if ( ! is_user_logged_in() )
|
||||
um_redirect_home();
|
||||
um_redirect_home( um_get_requested_user(), um_is_myprofile() );
|
||||
|
||||
if ( ! um_user( 'can_edit_profile' ) )
|
||||
UM()->user()->cannot_edit = 1;
|
||||
@@ -1088,7 +1088,7 @@ function um_pre_profile_shortcode( $args ) {
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', um_get_requested_user() ) ) {
|
||||
um_redirect_home();
|
||||
um_redirect_home( um_get_requested_user(), um_is_myprofile() );
|
||||
}
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
}
|
||||
|
||||
@@ -593,11 +593,15 @@ function um_field_conditions_are_met( $data ) {
|
||||
/**
|
||||
* Exit and redirect to home
|
||||
*/
|
||||
function um_redirect_home() {
|
||||
exit( wp_redirect( home_url() ) );
|
||||
function um_redirect_home( $requested_user_id = '', $is_my_profile = '') {
|
||||
|
||||
$url = apply_filters("um_redirect_home_custom_url", home_url(), $requested_user_id, $is_my_profile );
|
||||
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user