Login/Redirect issues
-
Greetings! After days and nights of digging into WP, code, plugins, etc..and a beginner at that, i’m almost there.
I’m using Multisite. I have 4 sites and users to match. Here’s the issue.I will be sending clients the same login link to their page each time
they have new files available for download.
url/page/wp-login.php? which takes them to url/pageOnce user1 has logged into their site, (url/page) IF they click on that same link OR a link to any other page i’ve created, it takes them to the wp-admin/profile.php of the original user (user1). While logged in, if they click on the link to would like to take them to the url/page OR to log them out if they click on the link.
Follow?
Please help.
Thank you!
-
Why not just send them to the page, and on that page have a ‘if not logged in’ check that shows a login form that keeps them on that page?
I’m not sure I follow, bare with me.
1.If they log into their site and stay logged in.(basic stripped page, no toolbar, customized, etc)
2.If they go back to the link we sent them in the email, for whatever reason, and click on that link, while still logged into their site, they
will be taken to their profile page.I may be doing this whole thing wrong to begin with. I just want to create multiple users (one for each client) to login and retrieve their files.
I’m using Multi Site with WP-Filebase, Add Login to Admin, Login Configurator, Take Control of the WordPress Bar, WP Hide Dashbar and have edited many files on the backend.
Thanks for help and patience.
Yes, I got that 🙂
Think of it this way.
You send me a link to domain.com/ipstenu/my-cool-page
That page is coded, using a Members plugin, to say ‘Aha, Ipstenu isn’t logged in. Show a login form!’
I log in and, because the forum is written to do this, I get sent back to domain.com/ipstenu/my-cool-page
Now that I’m logged in, I can go to domain.com/ipstenu/my-cool-page all I want and it’ll work until I log back out 🙂
Ok i’m with you. Hope on the horizon 🙂
Now how do I go about coding the individual pages?
I whipped up shortcodes: http://pastebin.com/fMwHKQ8Z
Put that in a file in your mu-plugins folder, I called it ‘loggedin-shortcodes.php’
Then the content of a post is this:
This page contains information. [loggedin_message]This content is only shown to logged-in users. Here's your cool thing! [/loggedin_message] [loggedout_message]This content is only shown to logged-OUT users. [loginform] [/loggedout_message]WOW, thank you so much for the in depth help! Here’s what i’m not getting.
log in at link below with user: test3 pw: c1234
http://spotsonline.com/test3/wp-login.php?
then while still logged in, paste the same link in another window and
see what you get. Should get “Invalid user ID.”.which is great! Except the user has to log out before they can log back in. So if they close the browser without logging out, they are stuck. I’ve thought about a “timeout” on the page…Any other thoughts? Thanks again, this is getting me much closer.
Well … Yes and no.
If I don’t log out and go right to http://spotsonline.com/test3 everything works. The wp-login.php page is annoying in that it will always ask you to log back in (which is why I said you shouldn’t try sending people there).
However yours is sending you to http://spotsonline.com/test3/wp-admin/profile.php which is locked, and makes me think one of the plugins your using is stripmining the profile page. The Hide Dashboard plugin is sending you there, as it should, which will keep people out of too much trouble.
Maybe I missed something in your original thoughts. Should I be sending them another link?
I re-read your 2nd response but still not sure I know how to proceed from this point.
Right now, if I go to http://spotsonline.com/test3/ and I’m logged out, I get sent to http://spotsonline.com/test3/wp-login.php?redirect_to=%2Ftest3%2F
If I log in, I go back to http://spotsonline.com/test3/
So … Just send ’em to http://spotsonline.com/test3/
They’ll log in and go to the right page 🙂
Super! (many smiles from North Carolina!)
Here’s one last one on this topic. Not that this should happen in while the site is live as client1 shouldn’t know client2, however.
If you log into
http://spotsonline.com/test3/
then go to
http://spotsonline.com/test4/
I can get in without creds.. Potential security issue?Good Morning!
Did some more testing and sure enough, if I go to
spotsonline.com/test3 and login
then, while logged in, I go to
spotsonline.com/test4
it takes me straight to the test4 page without having to login.
I would need to logout of test3 first–I assume this is because with MU.
Seems this is the last piece to this login puzzle.Thank you so very much for your help on this issue.
Multisite users are logged in for the whole network. Not a security issue, it’s by design. If you wanted to lock it down more, you’d want to check for is_blog_user()
http://codex.ww.wp.xz.cn/Function_Reference/is_blog_user
So where it has this:
if ( is_feed() || !is_user_logged_in() || is_null( $content ) )You’d double check
if ( is_feed() || !is_user_logged_in() || !is_blog_user() || is_null( $content ) )And then
if ( is_user_logged_in() || is_null( $content ) )Would become
if ( is_user_logged_in() || !is_blog_user() || is_null( $content ) )I hate to be such a Needy little newbee, lol, however…
I’ve looked at the page and looked in the wp-includes/user.php
to find any of the lines you referred to, and I can’t find where to
make these changes. I did try a couple of things, with no success.S’okay 🙂 This is the code you’d change: http://pastebin.com/fMwHKQ8Z
I made the change to the loggedin-shortcodes.php
file you made for me and ended up with this, according to
the other instructions: Bold is what I changed, and still
experiencing the same issues. While logged in to one “account” and
click on another, can get it without logging in 🙁// [loggedin_message]This content is only shown to logged-in users.[/is_user_logged_in]
// Shows content to logged in usersadd_shortcode( ‘loggedin_message’, ‘ippy_loggedin_message_shortcode’ );
function ippy_loggedin_message_shortcode( $attr, $content = null ) {/* If it is a feed or the user is not logged in, return nothing. */
if ( is_feed() || !is_user_logged_in() || !is_blog_user() || is_null( $content ) )
return ”;/* Return the content. */
return do_shortcode( $content );
}// [loggedout_message]This content is only shown to logged-in users.[/is_user_logged_in]
// Shows content to logged out users 🙂add_shortcode( ‘loggedout_message’, ‘ippy_loggedout_message_shortcode’ );
function ippy_loggedout_message_shortcode( $attr, $content = null ) {/* If it is a feed or the user is not logged in, return nothing. */
if ( is_user_logged_in() || !is_blog_user() || is_null( $content ) )
return ”;/* Return the content. */
return do_shortcode( $content );
`
The topic ‘Login/Redirect issues’ is closed to new replies.