-
Author
-
August 13, 2015 at 13:03 #72842dunnyukParticipant
on the blog – under code snippets –
http://seventhqueen.com/blog/code-snippets/restrict-guest-users-from-accessing-buddypress-or-bbpress-pages.htmli want to make this work on sweetdate – ive added the code to my child theme functions.php in its original form but it didnt work.
i also tried changing any reference to kleo – to sweetdate but no joy.`/**
* Redirect buddypress and bbpress pages to registration page
*/
function sweetdate_page_template_redirect()
{
//if not logged in and on a bp page except registration or activation
if( ! is_user_logged_in() &&
( ( ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) || is_bbpress() )
)
{
wp_redirect( home_url( ‘/register/’ ) );
exit();
}
}
add_action( ‘template_redirect’, ‘sweetdate_page_template_redirect’ );
`
any chance of having a look why its not working please.August 16, 2015 at 00:06 #73176LauraModeratorHello, do not change kleo to sweetdate, should be kleo as sweetdate uses kleo framework
Using it like kleo it doesnt give any result?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
August 17, 2015 at 19:12 #73444LauraModeratorHello, please share admin credentials so i can check it out 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
August 27, 2015 at 22:57 #74958AndreiModeratorI have given a look at the code, updated it a little bit and here is it:
COPY CODEfunction redirect_non_logged_in_users(){ if( ! is_user_logged_in() && ( ( is_buddypress() && ( ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) ) || is_bbpress() ) ) { wp_redirect( home_url( 'register' ) ); exit(); } } add_action( 'template_redirect', 'redirect_non_logged_in_users' );
Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 1, 2015 at 13:09 #75625dunnyukParticipanthi Andrei thanks for helping.
this makes the forums not visible to non registered members but not the group pages or the members pages / profiles which is what i was after.
any chance of helping me fix this.?September 2, 2015 at 18:55 #75879AndreiModeratorTry to clear your browser cache, when I tested this code you couldn’t access any part of buddypress or member pages/profiles.
Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 3, 2015 at 12:21 #75993dunnyukParticipanttried that but no joy.
can you goto the site and click members in the menu and see if its a cache problem my end.thanks.
September 3, 2015 at 18:13 #76062AndreiModeratorI’ve given a second test to the code, here is the updated version:
COPY CODEfunction redirect_non_logged_in_users(){ if( ! is_user_logged_in() && ( ( is_buddypress() && ( ! bp_is_activation_page() && ! bp_is_register_page() ) ) || is_bbpress() ) ) { wp_redirect( home_url( 'register' ) ); exit(); } } add_action( 'wp', 'redirect_non_logged_in_users' );
Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 4, 2015 at 20:40 #76234AndreiModeratorI’m glad to hear that !
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.