Conversation
supportHello. Thank you for this excellent contribution. I am using it with BuddyBoss. On my website, when a page is restricted, Restrictions for BuddyPress currently redirects to the registration page. I would rather it redirect to the login page. How might I effect this? Many thanks. This topic was modified 5 years, 7 months ago by wilayatrust . The page I need help with: [ log in to see the link]
Hello, glad to hear it works for you. We have a filter for the redirect URL: ‘bp_restrict_pmpro_url_redirect’ it can be changed using some code added to your child theme functions.php something like: add_filter(‘bp_restrict_pmpro_url_redirect’, ‘change_bp_restrict_url’); function bp_restrict_pmpro_url_redirect( $url ) { return ‘ https://mysite.com/login’ ;; }
Hi there, The above mentioned code doesn’t work for me, it causes a critical error on my site.
Hi, I have added here so there is no formatting issue: https://gist.github.com/codezz/8ce3909871115195f0fba014be7ab35d
Hi @staxwp – This isn’t working for me. No critical errors, but it still just redirects to the register page. I don’t have Paid Memberships Pro installed – is that required?
Hey there, Thanks for keeping in touch with us. In this case, please try out the code below instead: function sq7_login_redirect( $redirect_to, $request, $user ) { $redirect_to = site_url('/welcome/'); return $redirect_to; } add_filter('login_redirect', 'sq7_login_redirect', 11, 3); I hope this gets to help. Kind Regards
Hello, glad to hear it works for you. We have a filter for the redirect URL: ‘bp_restrict_pmpro_url_redirect’ it can be changed using some code added to your child theme functions.php something like: add_filter(‘bp_restrict_pmpro_url_redirect’, ‘change_bp_restrict_url’); function bp_restrict_pmpro_url_redirect( $url ) { return ‘ https://mysite.com/login’ ;; }
Hi there, The above mentioned code doesn’t work for me, it causes a critical error on my site.
Hi, I have added here so there is no formatting issue: https://gist.github.com/codezz/8ce3909871115195f0fba014be7ab35d
Hi @staxwp – This isn’t working for me. No critical errors, but it still just redirects to the register page. I don’t have Paid Memberships Pro installed – is that required?
Hey there, Thanks for keeping in touch with us. In this case, please try out the code below instead: function sq7_login_redirect( $redirect_to, $request, $user ) { $redirect_to = site_url('/welcome/'); return $redirect_to; } add_filter('login_redirect', 'sq7_login_redirect', 11, 3); I hope this gets to help. Kind Regards