Search Results for 'code'
-
Search Results
-
Topic: Help with Forum Roles
Hello.
So i’m developing a tech website but for some reason i can’t make the created forum roles to appear on users.
Roles Created:
Member – Participant rules but can’t create topics, only reply to existent ones.
GCam Dev – with same permissions as Member but can create threads.
ROM Dev – with same permissions as Member but can create threads.
Kernel Dev – with same permissions as Member but can create threads.
Modder – with same permissions as Member but can create threads.I’ve been searching and used this code below for it:
//code to add tutor role function add_new_roles( $bbp_roles ) { $bbp_roles['bbp_gcamdev'] = array( 'name' => 'GCam Developer', 'capabilities' => custom_capabilities( 'bbp_gcamdev' ) ); $bbp_roles['bbp_romdev'] = array( 'name' => 'ROM Developer', 'capabilities' => custom_capabilities( 'bbp_romdev' ) ); $bbp_roles['bbp_kerneldev'] = array( 'name' => 'Kernel Developer', 'capabilities' => custom_capabilities( 'bbp_kerneldev' ) ); $bbp_roles['bbp_modder'] = array( 'name' => 'Modder', 'capabilities' => custom_capabilities( 'bbp_modder' ) ); $bbp_roles['bbp_member'] = array( 'name' => 'Member', 'capabilities' => custom_capabilities( 'bbp_member' ) ); return $bbp_roles; } 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_gcamdev' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_romdev' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_kerneldev' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_modder' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_member' ) $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 ) { case 'bbp_gcamdev': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // 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' => false, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, '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' => true, ); case 'bbp_romdev': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // 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' => false, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, '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' => true, ); case 'bbp_kerneldev': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // 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' => false, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, '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' => true, ); case 'bbp_modder': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // 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' => false, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, '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' => true, ); case 'bbp_member': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // 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' => false, 'edit_topics' => false, 'edit_others_topics' => false, 'delete_topics' => false, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, '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' => true, ); break; default : return $role; } }
The Forum Roles appear on the Users menu but when i select it and Save Changes the role is removed. Am i missing anything?
Topic: Similar discussions
Hello everyone! I’m working on a online store made with Magento, but it also have a forum created with bbPress and I have to make a modification but it’s the first time when I work with WordPress. After we enter in a discussion, we have the question, the answers and after Similar discussions, topics(topics that are in the same category with the question). Right now we are loading 10, but I need a button bellow and everytime when you press it to load another 10. In content-single-topic.php I have this custom code, that give us the number of similar topics, on the homepage of te category we have 50 discussion on page:
<?php $direct_parent = $post->post_parent; if (bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => $direct_parent, 'post__not_in' => array($post->ID), 'posts_per_page' => 10 ) )) bbp_get_template_part('bbpress/loop', 'topics');
Can someone help me to add more topics on button click with ajax or something like this?
Hi,
I’d like to modify the reply topic from paragraph <p> to heading <h1> or <h2>. I tried to modify few php files but couldn’t get it working. Also checked few codex content but couldn’t find anything relevant. Wondering if somone done this before or knows how to do it. Thanks.
Topic: is_bbpress not working
I’m trying to detect requests for the bbpress forum index page.
Initially I tried ‘bbp_is_forum_archive()’.
This doesn’t return true from the forum archive page.I decided to test if any bbpress conditional tags were working, so I tested ‘is_bbpress’, because the function calls many (maybe all?) of the other conditionals.
However, ‘is_bbress’ doesn’t return true either.
However, on any page in my site, whether bbpress is on that page or not, this condition returns true:
‘if ( ! is_bbpress() )…’What could be happening here?
This is my function and the hook I’m using:
add_action('init', 'test_bbpress'); function test_bbpress() { if ( is_bbpress() ) { wp_die("got to the forums page") ; }
}
Hi,
I want to change generally all x days (years, whatever) ago to german like “vor x Tagen”.
I Have found the code base in inludes/commeons/formatting.php.
But I’m not so goog in develeoping.
Can somebaody help me please?Kind regards,
OleAfter installing bbpress I have a set of forums.
Every forum is presented using a php template in my child theme.
The php template has the filename bbpress.php.I’d like to create a php template that applies *just* to the individual forum pages. Not the forum topics or singles. Or anything else.
I’ve been looking at this:
The heirarchy seems to suggest that you can use ‘single-[forum].php’, which suggests that ‘[forum]’ needs to be substituted with the name of the forum.
… which is great. But I want one template to be applied to all forum singles and nothing else.
Just to test, I copied my existing bbress.php to a file called ‘single-forum.php’.
bbpress did pick this up and use it for my forum singles.
But the page didn’t present the actual forum. Where the forum should have been, there was just empty space.So… how do I create a template that gets applied to all forums and nothing else?
I’ve set up a set of discussion forums on a site. Now I want to the purpose of each forum to be clear.
One forum is called ‘Introductions’.
I’d like to have a message on the page saying something like “Hi. This is where we get to know each other”.I guess I could hack up something with ACF and put some logic in the page template that shows the forums. But I’m wondering if there’s a faster option.
Is there an inbuilt way to make add non-hardcoded content to the forum pages?