Friend request – wp-login redirects?
-
HI
I am testing my site and if a user does a friend request the other person gets sent the request. When they click on the link, if they are not already logged into the site instead of going to a wp-login.php? its goes to a wp-login.php?redirect_to= and then says page not found. Please could anyone tell me how to solve this. Its the latest version of Buddypress.
Thanks
-
What version of WPMU are you running? Are you using the default BuddyPress theme?
Hi,
I am having the same problem. I am running the latest version of Buddy Press and WordPress MU 2.8.4.
Any help would be greatly appreciated, Thanks!
Upgrade to WPMU 2.8.5.2 and make sure you are using the default BuddyPress theme.
Hi
I have just upgraded to the latest version of WPMU and gone back to the default theme but still have the same problem, any ideas please?
Thanks
HI
This is the site I am having problems on now with the default theme loaded.
http://houseinfrancenetwork.com/
So when I try to add a friend the new friend gets an email with a link
http://houseinfrancenetwork.com/members/testera/friends/requests/
If this link is clicked when the user “testera” is not logged in the URL goes to http://houseinfrancenetwork.com/wp-login.php?redirect_to=http://houseinfrancenetwork.com/members/testera/friends/requests/
Any help much appreciated.
Thanks
I have just tried changing permalinks to default structure and now if I click the link
http://houseinfrancenetwork.com/members/testera/friends/requests/
I still get this as the URL
but I am taken to the home (not logged in) page. Is this the correct behaviour for buddy press or should the email link take you to the login page?
Sorry to keep adding but I am experimenting to see if I can figure it out.
Are there any errors in your server’s error logs? Do you have any plugins activated besides BuddyPress? If so, deactivate them all and see if the issue resolves. Also, please continuing using the default theme as we troubleshoot this issue.
HI
Thanks for your help
Sorry I have reset to default theme and checked the server error logs and there aren’t any.
I had one other plugin enabled – login with ajax (wasn’t using it though) I have now disabled it but the problem continues.
I am not very clued up on what the htaccess does but I know it can redirect things- this is mine. Thanks
RewriteEngine On
RewriteBase /
#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . – [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
Anyone got any ideas please? Should I start again and reinstall or I saw a plugin called force-member-login mentioned in the forum will this sort it out.
Thanks
I have no ideas but I am getting the same type of problem with WP 3.0.1 BP1.2.5.2. When a new user is registered by the admin, via the “add user” option on the users page, an auto email is sent. When the new user clicks on the link they get redirected to wp-login.php. What make this a major problem is that they have not yet been assigned a password so there is no way for them to confirm their existing registration and no way for them to register themselves with the same email address until the first email registration expires (2 days i think).
This wasn’t happening to me at first with the same set up. The new user would enter the site. But I’m unsure if they couldn’t leave without being assigned an avatar and selecting a password?
What’s up with this redirect? Any solutions?
I’ve experienced this problem as well, here is my work around. This fixes my particular grief with this defect, but is not particularly kosher (modifying core plugin files, be careful with your updates) so your mileage may vary.
In /wp-content/plugins/buddypress/bp-friends/bp-friends-notifications.php edit the variable $all_requests_link on line 14. This is the link sent in your friend requests e-mail that breaks if you are not logged in.
What you will attempt to do now is change this variable to include /wp-login.php?redirect_to=the_link_you_want_to_login_redirect to. reauth=1 is added in case the person is logged in, they will be redirected to the correct place also and not bypassed.
In the end your line 14 variable $all_requests_link should read:
` $all_requests_link = “http://www.yourdomain.com/wp-login.php?reauth=1&redirect_to=”.bp_core_get_user_domain( $friend_id ) . BP_FRIENDS_SLUG . ‘/requests/’; `
Please change yourdomain.com in this variable to your actual domain.
Good luck and lets hope this defect gets fixed the right way, soon.
See official bug trac for more updates on this bug: https://trac.buddypress.org/ticket/2647
I was having this same problem and posted a lengthy comment about it in the trac ticket mentioned above ( https://trac.buddypress.org/ticket/2647 ), but in the meantime, I developed a workaround that works on my site and doesn’t require modifying any core files (and will fix the problem in any BP component, not just with friend request emails).
Just add the following function (a filter) to your theme’s functions.php file:
`
/**
* Intercept bp_core_catch_no_access() when nothing is set to enable smart login page redirects
* and prevent BP from just redirecting the user to the homepage
*
* @param string $found_template The result of locate_template() call
* @param mixed $templates Not sure what it’s for, but it’s generally bool false
*/
function yourtheme_load_template_filter( $found_template, $templates ) {
if ( ! $templates && empty( $found_template ) ) {
// just set it as default theme file so that file_exists() returns true
$found_template = get_stylesheet_directory() . ‘/index.php’;
}
return $found_template;
}
add_filter( ‘bp_located_template’, ‘yourtheme_load_template_filter’, 11, 2 );
`It’s not a good permanent solution, but I haven’t noticed it affecting anything else (including BP 404s) on my site, and it leaves your BP install happily untouched. If the issue is fixed in the future, of course, I would highly recommend removing this fix, but as far as I can tell, it’s harmless, and certainly makes your site far more usable.
@acustica
You are my hero ! Thanks.@guigoz
I’m very glad my solution was helpful for you! and your welcome@acustica = genius! this worked for me, thanks so much!
I hate all those “deactivate all your plugins” and “only use standard theme” answers — they are not really helpful but guaranteed to waste your time.
What you offer is a fix that works — at least for me with WP 3.2.1 and BP 1.2.9 — let’s see what the fixed version 1.3 brings
In BP 1.3, this is all handled quite nicely in the core! Coming soon.
I am on BuddyPress 1.7.3 but still have this problem, should this have been fixed? Users get an error 404 from the email link that is sent to them when receiving a friend request, any thoughts?
- The topic ‘Friend request – wp-login redirects?’ is closed to new replies.