• Resolved Austin

    (@austyfrosty)


    Very nice plugin. I would love to see the addition of non-role form removal. So for users who are not logged in, would love to hide the form on certain forum posts.

    Either adding:

    //Disallowed?
    foreach($current_user->roles as $role){
    	if(in_array($role, $disallowed_roles)){
    		ob_start();
    		add_action( 'bbp_theme_after_topic_form', 'pf_stop_capture');
    	}
    }
    //Not logged in
    if ( empty( $current_user->roles ) ) {
    	ob_start();
    	add_action( 'bbp_theme_after_topic_form', 'pf_stop_capture');
    }

    Or filtering in a non role in the meta box option. Like so:

    //after (Disallowed?) If no role is set and 'no-role' option is in option array.
    if ( empty( $current_user->roles ) ) {
    	if(in_array('no-role', $disallowed_roles)){
    		ob_start();
    		add_action( 'bbp_theme_after_topic_form', 'pf_stop_capture');
    	}
    }
    
    //new funtion
    function pf_add_no_role_rule( $role ) {
    	$role['no-role'] = array( 'name' => __( 'No Role' ) );
    	return $role;
    }
    add_filter( 'pf_disallowed_roles', 'pf_add_no_role_rule' );

    Add:

    $all_roles = apply_filters( 'pf_disallowed_roles', $wp_roles->roles );

    Also, casting your $post->ID‘s as integers isn’t really necessary, but if you do you should try using shorthand (int) or at least lower-casing (Integer).

    http://wordpress.org/extend/plugins/bbpress-protected-forums/

Viewing 1 replies (of 1 total)
  • Plugin Author JordiPlana

    (@jordiplana)

    Hi Austin,
    Thank you for the suggestions. I will include in the next release of the plugin (yet to be determined, because of lack of free time).
    Best regards

Viewing 1 replies (of 1 total)
  • The topic ‘Suggestions’ is closed to new replies.