I am trying to make the current user's documents only accessible to the current user and admins.
I am currently trying to add a filter when you are not on your own profile, you will not see the documents. The documents are still showing however...
function debug($data) {
$output = $data;
if (is_array($output))
$output = implode(',', $output);
echo "<script>console.log('Debug Objects: " . $output . "' );</script>";
}
function document_screen_restrict() {
if ( bp_is_my_profile() != 1 ) {
debug("not my documents, SHOULD NOT SEE");
add_filter("document_screen",'__return_false');
debug(did_action( 'document_screen' ));
return;
}else{
debug("My documents, SEE");
remove_filter("document_screen",'__return_false');
debug(did_action( 'document_screen' ));
}
}
add_action('wp','document_screen_restrict',10);