is there anyway i can disable the redirect option, it would

Hello, is there anyway i can disable the redirect option, it would be useful if it was just for my directory users but it redirects all users: admin, editors subscribers etc.. so this is no good as it's confusing people.

thanks :slight_smile:

  • Mike
    • New Recruit

    Hi @peter_caines!

    Thanks for posting your question today!

    Can I just confirm, are we talking about the page to which users are redirected to upon login/registration?

    If so, do you want to disable it all together? Because it would be better if you set it to redirect to a page that is useful. For example when signing in or out you could set the redirect to your listings page, that way people don't have to browse there twice.

    To do this login to your Wordpress wp-admin and browse to Listings > Settings. Scroll down to Redirection Options and change both urls to "/listings/" without the quotes.

    If that wasn't your question, please reply and let me know.

    Best Regards,
    Mike

  • peter_caines
    • Flash Drive

    yes i can confirm that is what i mean, i agree it is a useful feature, the only problem is that when i set it to redirect to "my listing" page ( or any page ) it sends all users there not just people logging in to the directory.

    Also if i log in via the main admin i.e: mywebsite.com/wp-admin it then takes me to where i have set the redirect in the directory. which is really annoying when i just want to go straight to wp admin.

    If i can just disable this feature it then i can use a redirect plugin so i can set a different redirect depending on the type of user.

    thanks

  • Mike
    • New Recruit

    Hi @peter_caines thanks for the reply!

    That makes sense!

    It's not advisable to edit plugin files as it will result in your changes being lost on upgrade, but if you wish to make changes anyway, you can!

    Also I'm not a coder, so I'm not entirely sure my edits are safe to follow :wink:

    Having said that, load up /directory/core/core.php and find this on line 269:

    /**
    	* Redirect signin to home or user defined url
    	*
    	*/
    	function on_login_redirect($redirect = '', $request = '', $user = '') {
    		$options = $this->get_options('general');
    		$redirect = (empty($options['signin_url']) )? home_url() : $options['signin_url'];
    
    		return $redirect;
    	}
    
    	/**
    	* Redirect signout to home or user defined url
    	*
    	*/
    	function on_logout_url($logout_url = '', $redirect = '') {
    		$options = $this->get_options('general');
    		$redirect = (empty($options['logout_url']) ) ? home_url() : $options['logout_url'];
    		$logout_url = add_query_arg(array('redirect_to' => $redirect), $logout_url );
    
    		return $logout_url;
    	}

    Replace both instances of home_url() with '', like this:

    /**
    	* Redirect signin to home or user defined url
    	*
    	*/
    	function on_login_redirect($redirect = '', $request = '', $user = '') {
    		$options = $this->get_options('general');
    		$redirect = (empty($options['signin_url']) )? '' : $options['signin_url'];
    
    		return $redirect;
    	}
    
    	/**
    	* Redirect signout to home or user defined url
    	*
    	*/
    	function on_logout_url($logout_url = '', $redirect = '') {
    		$options = $this->get_options('general');
    		$redirect = (empty($options['logout_url']) ) ? '' : $options['logout_url'];
    		$logout_url = add_query_arg(array('redirect_to' => $redirect), $logout_url );
    
    		return $logout_url;
    	}

    What this should do, is if you enter a url in the boxes in the admin area then those will be the pages that users are redirected to when they log in/out. But if you leave them empty, the functions above return an empty response so that should do what you want.

    I hope this helps!

    Best Regards,
    Mike

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.