access control
-
I want to use the following action hook for action control.
add_filter('asgarosforum_filter_post_content','forum_content_control') function forum_content_control($content) { global $current_user; if (current_user_can_for_blog(8, 'lp_read_intermediate')) { return $content; } else { return "Content available to LP students only."; } }
right now I can turn on or off content display on a global bases, in all forums. However, I want some forums to be student only, and some to be public. My question, is there a way for me to tell what forum I’m in so I can adjust the access routines. something like
add_filter('asgarosforum_filter_post_content','forum_content_control') function forum_content_control($content) { global $current_user; global $forum_id; global $category_id; if ($forum_id == 3 || $forum_id==4) {//do access control on forums 3 and 4 if (current_user_can_for_blog(8, 'lp_read_intermediate')) { return $content; } else { return "Content available to LP students only."; } } else { //its not forum 3 or 4, therefore no access control return $content; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘access control’ is closed to new replies.