awal16 (@awal16)

Forum Replies Created

Viewing 23 replies - 1 through 23 (of 23 total)

  • awal16
    Participant

    @awal16

    Is this also possible for the revision of a topic?


    awal16
    Participant

    @awal16

    I created a template to resolve the problem, like at first. Otherwise I wouldn’t know.


    awal16
    Participant

    @awal16

    I already have a page created in WP with the [bbp-forum-index] code in it. So, I don’t understand it.


    awal16
    Participant

    @awal16

    I have to correct something. De right sidebar only doens’t show on the root(index?) of the forum. The other forums/topics he does show the right one 🙂

    How is this possible?


    awal16
    Participant

    @awal16

    I followed the steps, but the right sidebar doesn’t show up, the main-sidebar is still vissible.

    My code in the functions.php:

    
    function rkk_widgets_init(){
    	register_sidebar(array(
    		'id' => 'bbp-sidebar',
    		'name' => __( 'Forum sidebar', 'rkk' ),
    		'description' => __( 'Sidebar voor het forum', 'rkk' ),
    		'before_widget' => '<div id="%1$s" class="forum-widget %2$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>'
    	));
    }
    add_action('widgets_init', 'rkk_widgets_init');
    

    The code in the sidebar.php:

    
    <?php if (is_active_sidebar('main-sidebar') && !is_bbpress()) : ?>
    	<div id="secondary" class="widget-area" role="complementary">
    		<?php dynamic_sidebar('main-sidebar'); ?>
    	</div><!-- .widget-area -->
    	
    <?php elseif (is_active_sidebar('bbp-sidebar') && is_bbpress()) : ?>
    
    	<div id="secondary" class="widget-area" role="complementary">
    		<?php dynamic_sidebar('bbp-sidebar'); ?>
    	</div><!-- .widget-area -->
    <?php endif; ?>
    

    In the backend, the forum widget does appear, and I can add Widgets to it. Only on the front-end, on forum pages, he doesn’t show the right sidebar.


    awal16
    Participant

    @awal16

    I posted a topic on the support of the plugin, so I hope they can help. Thanks for your help so far.


    awal16
    Participant

    @awal16

    I copied and paste the code again, and now I don’t get the warnings. So, why is this code better :)?

    Besides, what does throttle mean, in the capabilitie?


    awal16
    Participant

    @awal16

    Yes, I tried your other code, in an earlier post of yours. But then I get the warnings again.


    awal16
    Participant

    @awal16

    Well, I found the plugin who causes the headache, Photo Gallery by Supsystic. How is this possible?


    awal16
    Participant

    @awal16

    I will try that, Robin.


    awal16
    Participant

    @awal16

    Let me try to explain it another way. bbpress has some existing roles like, Keymaster, Moderator, Spectator, Participant and Blocked.
    In the functions.php I added my own role (Globale moderator), with specifix capabilities.

    When I set a user to my custom role (Globale moderator) he/she can’t read/see any forum/topic, only the root of the forum. When he/she clicks on a forum/topic, the 404 error page shows up, Oops! That page can not be found. Even when all capabilities are set to true.

    When I set the user to an existing role of bbpress like, Spectator (or any other role of bbpress), the user can read/see all the forum/topics.

    What is wrong with my custom role? Didn’t I added it correctly, or? I really don’t know.


    awal16
    Participant

    @awal16

    My custom role doesn’t get a moderator role. It was just an example. Even if I set the role to participant, he works fine, but not with my own customized role.


    awal16
    Participant

    @awal16

    I think the problem is something else. Because, when I set everything on true, even the moderate, he still isn’t working. When I choose a predefined role by bbpress, it’s working fine. When I choose my own role, and set everything to true, he doesn’t.


    awal16
    Participant

    @awal16

    I have a problem with custom capalities. I have this code in my functions.php in the child-theme:

    // Nieuwe forumrolnaam toevoegen
    function add_new_roles($bbp_roles){
    	$bbp_roles['bbp_global_moderator'] = array(
    		'name' => 'Globale moderator',
    		'capabilities' => custom_capabilities( 'bbp_global_moderator' )
    	);
    	return $bbp_roles;
    }
    
    // Nieuwe forumregels toevoegen
    add_filter('bbp_get_dynamic_roles', 'add_new_roles', 1);
    
    function add_role_caps_filter($caps, $role) {
    	// Only filter for roles we are interested in!
    	if ($role == 'bbp_global_moderator')
    		$caps = custom_capabilities($role);
    	
    	return $caps;
    }
    
    add_filter('bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2);
    
    function custom_capabilities($role) {
    	switch($role) {
    		// Capabilities for 'global_moderator' role
    		case 'bbp_global_moderator';
    			return array(
    				// Primary caps
    				'spectate'				=> true,
    				'participate'			=> true,
    				'view_trash'			=> true,
    				
    				// Forum caps
    				'publish_forums'		=> false,
    				'edit_forums'			=> false,
    				'edit_others_forums'	=> false,
    				'delete_forums'			=> false,
    				'delete_others_forums'	=> false,
    				'read_private_forums'	=> true,
    				'read_hidden_forums'	=> false,
    				
    				// Topic caps
    				'publish_topics'		=> true,
    				'edit_topics'			=> true,
    				'edit_others_topics'	=> false,
    				'delete_topics'			=> true,
    				'delete_others_topics'	=> false,
    				'read_private_topics'	=> true,
    				
    				// Reply caps
    				'publish_replies'		=> true,
    				'edit_replies'			=> true,
    				'edit_others_replies'	=> false,
    				'delete_replies'		=> true,
    				'delete_others_replies'	=> false,
    				'read_private_replies'	=> true,
    				
    				// Topic tag caps
    				'manage_topic_tags'		=> false,
    				'edit_topic_tags'		=> false,
    				'delete_topic_tags'		=> false,
    				'assign_topic_tags'		=> false,
    			);
    			break;
    		default :
    			return $role;
    	}
    }

    When I set a user to the specific role, he/she can’t read the closed forum or topic. I get the 404 error: oops, can’t find that page. When I set the user to a standard role, like moderator, it’s fine. So, I copied the same rules capabilities (true/false part) of the moderator, to my functions.php in the child, but that doesn’t seem to help. What is going wrong?


    awal16
    Participant

    @awal16

    haha ofcourse, how stupid!

    Thanks a lot!


    awal16
    Participant

    @awal16

    Can it also be done by coding?


    awal16
    Participant

    @awal16

    I already found the problem. I changed the line function add_custom_role to add_new_roles. Than it worked fine!


    awal16
    Participant

    @awal16

    I added the custom capabilities to my functions.php in the child-theme. When I go to Users, in the back-end of WordPress, there are warning texts like, Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘add_new_roles’ not found or invalid function name in C:\xampp\htdocs\mnddb_nieuw\wp-includes\plugin.php on line 235.

    What did I do wrong?

    My code in the function.php looks like:

    <?php
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
            
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css' );
        }
    endif;
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
    
    // END ENQUEUE PARENT ACTION
    
    // Nieuwe forumrolnaam toevoegen
    function add_custum_role($bbp_roles){
    	$bbp_roles['bbp_global_moderator'] = array(
    		'name' => 'Globale moderator',
    		'capabilities' => custom_capabilities( 'bbp_global_moderator' )
    	);
    	return $bbp_roles;
    }
    
    // Nieuwe forumregels toevoegen
    add_filter('bbp_get_dynamic_roles', 'add_new_roles', 1);
    
    function add_role_caps_filter($caps, $role) {
    	// Only filter for roles we are interested in!
    	if ($role == 'bbp_global_moderator')
    		$caps = custom_capabilities($role);
    	
    	return $caps;
    }
    
    add_filter('bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2);
    
    function custom_capabilities($role) {
    	switch($role) {
    		// Capabilities for 'global_moderator' role
    		case 'bbp_global_moderator';
    			return array(
    				// Primary caps
    				'spectate'				=> true,
    				'participate'			=> true,
    				'moderator'				=> false,
    				'throttle'				=> false,
    				'view_trash'			=> true,
    				
    				// Forum caps
    				'publish_forums'		=> false,
    				'edit_forums'			=> false,
    				'edit_others_forums'	=> false,
    				'delete_forums'			=> false,
    				'delete_others_forums'	=> false,
    				'read_private_forums'	=> true,
    				'read_hidden_forums'	=> false,
    				
    				// Topic caps
    				'publish_topics'		=> true,
    				'edit_topics'			=> true,
    				'edit_others_topics'	=> false,
    				'delete_topics'			=> true,
    				'delete_others_topics'	=> false,
    				'read_private_topics'	=> true,
    				
    				// Reply caps
    				'publish_replies'		=> true,
    				'edit_replies'			=> true,
    				'edit_others_replies'	=> false,
    				'delete_replies'		=> true,
    				'delete_others_replies'	=> false,
    				'read_private_replies'	=> true,
    				
    				// Topic tag caps
    				'manage_topic_tags'		=> false,
    				'edit_topic_tags'		=> false,
    				'delete_topic_tags'		=> false,
    				'assign_topic_tags'		=> false,
    			);
    			break;
    		default :
    			return $role;
    	}
    }
    

    awal16
    Participant

    @awal16

    Ok, thanks a lot for helping me, Robin and Pascal!


    awal16
    Participant

    @awal16

    For some reason I can’t click on Continue reading, in your topic above.
    I do have another question about users who have forgotten their password. I didn’t completly understand that part. Is it ok to ask it in the same topic?


    awal16
    Participant

    @awal16

    I made a few changes in the capabilities.php, in the bbpress/includes/core folder. I added some roles to the participant, like edit_others_topics => false, etc…

    And in the loop_single_forum.php, but that file I already placed in the root of my child-theme.


    awal16
    Participant

    @awal16

    Thanks a lot! I read it, but they only talk about the directory files in de bbpress/templates/default. I also made changes in bbpress/includes/core/capabilities. Do I put these files in the same folder in my child-theme (bbpress)?


    awal16
    Participant

    @awal16

    Yes, thank you, now it works!

    Another question. Where do I have to put the other files, the .php, if I make any changes in there? Just in the root of my child-theme? And does this also work for other plugins?

Viewing 23 replies - 1 through 23 (of 23 total)