我正在尝试让当前用户的文档只能由当前用户和管理员访问。
我目前正在尝试添加过滤器,当您不在自己的个人资料中时,您将看不到文档。然而,文件仍在显示......
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);