Skip to:
Content
Pages
Categories
Search
Top
Bottom

where to put bbpress.css in child-theme

  • @awal16

    Participant

    I made some changes in the style of bbpress and other files. I copied the bbpress.css file to my child-theme in the root, but I don’t see any difference, when I make another change in a style. I also tried to put it in a folder (bbpress) in my child-theme, but that seems not to work either. What am I doing wrong?

Viewing 25 replies - 1 through 25 (of 30 total)
  • @robin-w

    Moderator

    From the docs

    The “css” directory contains style sheets that work with the default markup. Copy any you want to modify into a directory named “css” in your theme’s root. eg. /wp-content/themes/%your-theme%/css/

    @awal16

    Participant

    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?

    @robin-w

    Moderator

    https://codex.bbpress.org/themes/theme-compatibility/

    should answer your questions, but do come back if you need further help !

    @awal16

    Participant

    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)?

    @robin-w

    Moderator

    no, core functions in bbpress cannot be put in other folders.

    Generally it is not recommended that you change bbpress itself. Rather almost all bbpress functionality can be filtered, so that the plugin remains complete and changes are put in your theme’s functions file using wordpress filering capability.

    What changes did you make? If small, let me know which lines in which file, and post the changes here, and I’ll try to help you with what you should put in your functions file.

    You should also make those changes (and the template files you copied ) in a child theme, so that theme updates donlt overwrite these

    https://codex.bbpress.org/functions-files-and-child-themes-explained/

    @awal16

    Participant

    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.

    @robin-w

    Moderator

    ok so for the roles, you should see and use

    Custom Capabilities

    loop_single_forum in your child theme is the right way to go

    If you need further help in doing this (or anything else!) – please feel free to ask, like all things it is a learning curve 🙂

    @awal16

    Participant

    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?

    @casiepa

    Moderator

    The link is: https://codex.bbpress.org/custom-capabilities/

    Better to post a new topic for a new question with a specific title, so others can find it in the search …

    Pascal.

    @awal16

    Participant

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

    @robin-w

    Moderator

    no problem !

    @awal16

    Participant

    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

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

    @robin-w

    Moderator

    Great – glad you’re fixed !

    @awal16

    Participant

    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?

    @robin-w

    Moderator

    It’s because you haven’t set the moderate primary cap 3rd one down in the list below.

    The full default mod caps are

    // Moderator
    		case bbp_get_moderator_role() :
    			$caps = array(
    
    				// Primary caps
    				'spectate'              => true,
    				'participate'           => true,
    				'moderate'              => true,
    				'throttle'              => true,
    				'view_trash'            => true,
    
    				// Forum caps
    				'publish_forums'        => true,
    				'edit_forums'           => true,
    				'read_private_forums'   => true,
    				'read_hidden_forums'    => true,
    
    				// Topic caps
    				'publish_topics'        => true,
    				'edit_topics'           => true,
    				'edit_others_topics'    => true,
    				'delete_topics'         => true,
    				'delete_others_topics'  => true,
    				'read_private_topics'   => true,
    
    				// Reply caps
    				'publish_replies'       => true,
    				'edit_replies'          => true,
    				'edit_others_replies'   => true,
    				'delete_replies'        => true,
    				'delete_others_replies' => true,
    				'read_private_replies'  => true,
    
    				// Topic tag caps
    				'manage_topic_tags'     => true,
    				'edit_topic_tags'       => true,
    				'delete_topic_tags'     => true,
    				'assign_topic_tags'     => true,
    			);

    you are missing

    'moderate'              => true,
    

    from yours !

    @awal16

    Participant

    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.

    @robin-w

    Moderator

    Try :

    function rew_add_custom_role( $bbp_roles ) {
     
    $bbp_roles['bbp_global_moderator'] = array(
    'name' => 'Globale moderator',
    'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as moderator
    );
    return $bbp_roles;
    }
    add_filter( 'bbp_get_dynamic_roles', 'rew_add_custom_role', 1 );

    @awal16

    Participant

    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.

    @robin-w

    Moderator

    ok – can only suggest it could be a theme or plugin issue

    Plugins

    Deactivate all but bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    Themes

    If plugins don’t pinpoint the problem, as a test switch to a default theme such as twentyfifteen, and see if this fixes.

    Then come back

    @awal16

    Participant

    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

    I will try that, Robin.

    @robin-w

    Moderator

    so did you try my code???

    @awal16

    Participant

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

    @robin-w

    Moderator

    All plugin writers write code to try and not interfere with each other – but occasionally we fail.

    I’d suggest you post a thread on their support forum to see if they can help.

    Did you try my shorter code – there is a reason for this question !

Viewing 25 replies - 1 through 25 (of 30 total)
  • You must be logged in to reply to this topic.
Skip to toolbar