Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-redirect'
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubboucek committed Sep 17, 2019
2 parents efc09d1 + bd42ea5 commit edb7d7b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public function __construct( Settings $settings ) {
* @return mixed
*/
public function login_redirect( $redirect, $request, $user ) {

if ( $redirect_url = $this->settings->ssc_get_option( 'ssc_redirect_url' ) ) {
$redirect = $redirect_url;
$redirect_url = $this->settings->ssc_get_option( 'ssc_redirect_url' );
if ( $redirect_url ) {
$redirect = remove_query_arg( [ 'redirect_to' ], $redirect_url );;
}

return $redirect;
Expand All @@ -70,7 +70,7 @@ public function check_access() {

// Check if current user has access to the post, if not, redirect him to defined URL or home if the URL is not set
if ( $post_groups && ! $this->user_can_view_post() && ! is_home() && ! is_front_page() ) {
$no_access_url = $this->get_no_access_redirect_url();
$no_access_url = remove_query_arg( [ 'redirect_to' ], $this->get_no_access_redirect_url() );

$main_redirect_url = is_user_logged_in() ? site_url() : wp_login_url();
$url = $no_access_url ?: $main_redirect_url;
Expand Down

0 comments on commit edb7d7b

Please sign in to comment.