Re: Securing components from non logged in users
@Imgoel in my bp-custom.php I put:
function js_restrict_access(){
global $bp, $bp_unfiltered_uri;
if (!is_user_logged_in() && (MEMBERS_SLUG == $bp_unfiltered_uri[0]
|| BP_GROUPS_SLUG == $bp->current_component || BP_BLOGS_SLUG == $bp->current_component)){
bp_core_redirect( get_option(\\\'home\\\') . \\\"/register?s=1\\\");
}
}
add_action( \\\'wp\\\', \\\'js_restrict_access\\\', 3 );
Then in my theme I put the following in register.php:
<?php
if($_REQUEST[\\\"s\\\"]){?>
<script type=\\\"text/javascript\\\">
jQuery(document).ready(function () {
setTimeout(function(){ jQuery(\\\"#error\\\").fadeOut(\\\"slow\\\"); }, 3000);
});
</script>
<div id=\\\"error\\\" class=\\\"error\\\">
<p>You can only view this information if you are a registered user. Either login or register to continue.</p>
</div>
<?php } ?>
<?php bp_core_signup_do_signup() ?>