Forums
-
- Forum
- Posts
-
- Installation
- 28,528
- Troubleshooting
- 62,959
- Themes
- 10,453
- Plugins
- 15,405
- Requests & Feedback
- 15,045
- Showcase
- 3,250
-
you add action is right, and I’d have this as the function (not tested!)
function forum_user_is_spectator(){
if ( is_bbpress() && is_user_logged_in() ) {
$User_ID = get_current_user_id() ;
$Spectator = (!empty(current_user_can( 'spectate' )) ? 1 : 0) ;
if ($Spectator){
wp_enqueue_script( 'spectator-js', get_template_directory_uri() . '/js/spectator.js', array(), false, true);
}
}
}