I've got a custom role for my site and users can only access their profile page, this appears to be the minimum for wordpress. However, the accounts are managed by us and this is a private site, we do not want users to be able to change their username, email or password using wordpress.
The only issue we have right now is logging in. The inner pages all require you to be logged in. We have a landing page with a link to the login page, for this link we apply redirect_to=/blog/
and after logging in you go to the blog. This works well enough for us.
However, if a user links to an inner page (or recieves the link in an email automatically, from subscription setting) then the link will require them to login, taking them to the login screen without the redirect_to parameter. This means they will go right to the profile page.
Why it goes to the profile page instead of the page they requested is beyond me, but we need to redirect them back to the blog.
Here is a function I set up with the intention that after logging in, you will get taken to the blog. At this point we don't care if a permalink doesn't work on first visit (of course they will once you log in).
But this function does not work. wp_signon is not triggered after a user logs in, but instead is used to log a user in.
What should I do?
function login_redirect() {
wp_redirect( get_bloginfo( 'url' ) . '/blog/' );
}
add_action('wp_signon', 'login_redirect');`