Search Results for 'code'
-
Search Results
-
This code works fine:
https://www.reach22.com/r22/forums/topic/tree-/?action=bbp_subscribe&object_id=2009&object_type=post&_wpnonce=c78cb75b54whereas the equivalent shortcode:
https://www.reach22.com/r22/sessions/heathland/?action=bbp_subscribe&object_id=2009&_wpnonce=c78cb75b54&object_type=post
gives a 403 errorGrateful if anyone could give me a steer on how to resolve this?
Thanks
Hi!
I am trying to make any topics and replies submitted on the front end have a default category (I have extended the custom post type of bbPress to support categories). This works for everything submitted on the back end, but not everything submitted on the front end. I have played around with this a lot, and have not made any progress.
I am using WordPress 4.9.5, bbPress 2.5.14 and the site I am working on (locked so this link probably won’t do any good) is https://gateway.aishasalem.com
// adding possibilities to have categories for custom post types public function gt_custom_post_type_categories() { register_taxonomy_for_object_type( 'category', 'topic' ); register_taxonomy_for_object_type( 'category', 'reply' ); } add_action( 'init', 'gt_custom_post_type_categories', 11 );And this code to assign the categories as default when a post is saved / published. It works on the back end, but only partially on the front end.
// setting default post catagory when saving public function gt_set_default_category( $post_id, $post, $update ) { // Slugs of the custom post types $slugs = array('topic', 'reply'); // current post type $current_post_type = $post->post_type; // If this post isn't a custom posty type, don't update if ( !in_array($current_post_type, $slugs) ) { return; } // Sets the default category depending on the current post type switch ($current_post_type) { case 'topic': $default_category = 'livingroom-topics'; break; case 'reply': $default_category = 'livingroom-replies'; // does not hook in on the fron end break; default: return; } // sets the default category $default_term = get_term_by('slug', $default_category, 'category'); wp_set_object_terms(get_the_ID(), $default_term->term_id, 'category'); } add_action( 'save_post', 'gt_set_default_category', 9, 3 );I have tried hooking into ‘bbp_new_reply’ but this doesn’t seem to help (maybe I am doing it wrong). Do you have any advice of how to do this? Where to hook into? If it should be a filter and a function of a different form (if so, please give as much info as possible, I am new to php wordpress and especially filters)?
Thank you so much!!
Topic: User Role Modification
Hello,
I have a bbPress site. I want to change some role permission.
1. Participant Role will be able to delete their post and topic.
2. Annonymous user can delete their post and reply.
For number 1. I tried to follow this post but i am very confused. I added this code to theme childfunction.phpadd_filter ('bbp_get_topic_trash_link', 'topic_dont_delete'); add_filter ('bbp_get_reply_trash_link', 'reply_dont_delete'); function topic_dont_delete( $args = '') { // Parse arguments against default values $r = bbp_parse_args( $args, array( 'id' => 0, 'link_before' => '', 'link_after' => '', 'sep' => ' | ', 'trash_text' => esc_html__( 'Trash', 'bbpress' ), 'restore_text' => esc_html__( 'Restore', 'bbpress' ), 'delete_text' => esc_html__( 'Delete', 'bbpress' ) ), 'get_topic_trash_link' ); $actions = array(); $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) ); if ( empty( $topic ) || !current_user_can( 'delete_topic', $topic->ID ) ) { return; } if ( bbp_is_topic_trash( $topic->ID ) ) { $actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'untrash', 'topic_id' => $topic->ID ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID ) ) . '" class="bbp-topic-restore-link">' . $r['restore_text'] . '</a>'; } elseif ( EMPTY_TRASH_DAYS ) { $actions['trash'] = '<a title="' . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'trash', 'topic_id' => $topic->ID ) ), 'trash-' . $topic->post_type . '_' . $topic->ID ) ) . '" class="bbp-topic-trash-link">' . $r['trash_text'] . '</a>'; } if ( bbp_is_topic_trash( $topic->ID ) || !EMPTY_TRASH_DAYS ) { if ( bbp_is_user_keymaster()) { $actions['delete'] = '<a title="' . esc_attr__( 'Delete this item permanently', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'delete', 'topic_id' => $topic->ID ) ), 'delete-' . $topic->post_type . '_' . $topic->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-topic-delete-link">' . $r['delete_text'] . '</a>'; } } // Process the admin links $retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after']; return $retval ; } function reply_dont_delete( $args = '' ) { // Parse arguments against default values $r = bbp_parse_args( $args, array( 'id' => 0, 'link_before' => '', 'link_after' => '', 'sep' => ' | ', 'trash_text' => esc_html__( 'Trash', 'bbpress' ), 'restore_text' => esc_html__( 'Restore', 'bbpress' ), 'delete_text' => esc_html__( 'Delete', 'bbpress' ) ), 'get_reply_trash_link' ); $actions = array(); $reply = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) ); if ( empty( $reply ) || !current_user_can( 'delete_reply', $reply->ID ) ) { return; } if ( bbp_is_reply_trash( $reply->ID ) ) { $actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'untrash', 'reply_id' => $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) . '" class="bbp-reply-restore-link">' . $r['restore_text'] . '</a>'; } elseif ( EMPTY_TRASH_DAYS ) { $actions['trash'] = '<a title="' . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'trash', 'reply_id' => $reply->ID ) ), 'trash-' . $reply->post_type . '_' . $reply->ID ) ) . '" class="bbp-reply-trash-link">' . $r['trash_text'] . '</a>'; } if ( bbp_is_reply_trash( $reply->ID ) || !EMPTY_TRASH_DAYS ) { if ( bbp_is_user_keymaster()) { $actions['delete'] = '<a title="' . esc_attr__( 'Delete this item permanently', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'delete', 'reply_id' => $reply->ID ) ), 'delete-' . $reply->post_type . '_' . $reply->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-reply-delete-link">' . $r['delete_text'] . '</a>'; } } // Process the admin links $retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after']; return $retval ; }But as I understood that, it was trashing post not deleting them. What I have missed? This code didnot worked for me. May be I have missed some steps.
And for 2, I don’t know if its possible or not. Searched a lot but haven’t found any solution yet. My understanding is annonymous is not a role, nore a user. So how we can achieve that?
Thank You
Topic: Error import user to mybb
Hello,
I use Forum Migrator, but when i try to import user.
Appear this error:Errore sul database di WordPress: [Unknown column 'users.msn' in 'field list'] SELECT convert(users.uid USING "utf8mb4") AS uid,convert(users.password USING "utf8mb4") AS password,convert(users.salt USING "utf8mb4") AS salt,convert(users.username USING "utf8mb4") AS username,convert(users.email USING "utf8mb4") AS email,convert(users.website USING "utf8mb4") AS website,convert(users.regdate USING "utf8mb4") AS regdate,convert(users.usertitle USING "utf8mb4") AS usertitle,convert(users.aim USING "utf8mb4") AS aim,convert(users.yahoo USING "utf8mb4") AS yahoo,convert(users.icq USING "utf8mb4") AS icq,convert(users.msn USING "utf8mb4") AS msn,convert(users.signature USING "utf8mb4") AS signature FROM mybb_users AS users LIMIT 0, 100it’s just 130 user! Not big deal
I created a Single forum page with short code: [bbp-single-forum id=12]
from the single forum page I navigate to one of the topics. when I click on the single forum page link it redirects me to the single forum but not to the page I created. I disabled the forums links in the bread crumbs. Is there a way to edit the link for the single forum so that I could point it the page I created.
step 1: Home Page › Student Forum
step 2: Home Page › Student Forum › Features of Site Wide ForumFrom here when I click on the student forum it redirects me to the student forum and not the page I created with the student forum short code in it.
wordpress version: WordPress 4.9.5
bbpress version: Version 2.5.14
I have been trying to identify location and code to change in order to fix padding problem in the body of content/replies forum. Lack of padding makes the first letter of content to be hidden by arrowhead shape /line separating post message from author/date column.
How could I totally eliminate such vertical grey line/border, and edit/change padding so post text does not appear attached to left?
Topic: HTML tags (again sorry)
I know the subject keeps coming up, and I’ve been through the posts and I’ve added the relevant code to my functions.php all good so far.
My visual editor is inserting tags that get filtered out by BBpress. Is there any plugin that I can say a particular user can have any html? I’m wanting to add more available tags like <h1 style=”text align:center”> etc. All my efforts have failed miserably. I like BBpress, but other forum software doesn’t have these restrictions on basic text formatting.
Maybe if you can explain what the code does rather than link to an example, I haven’t a clue about arrays or what => etc means and the syntax. I just want users to be able to add heading tags and a few other basic text formatting options to tie in with their visual editor.
Thanks in advance
Topic: Incorrect topics count
I use this function to display the total topics count for a single forum:
bbp_get_forum_topic_countIf I change the forum parent to –No Parent —, the topic dissapears from forum section but the count does not change. See the image below:


—————–
bbPress version: 2.5.14
WordPress version: 4.9.5Hi,
I’d like to remove the header from all bbPress pages on my site, but can’t quite figure it out!
I’m using the theme Total, and advice from the theme creator was to put
.ht-main-header{display:none;}in Appearance > Customise > Additional CSS. This worked, but removed the header from all pages across the website and forum. I’d like to keep the header on all main website pages and only remove it from bbPress pages.The main forum is here: https://economy10.com/f/
I can remove the header from an individual page by adding
.postid-994 .ht-main-header{display:none;}but this is only for a specific page. How can I do this for all forum pages?I’m relatively new to using wordpress/bbpress (and don’t really understand CSS tbh!) so any advice would be greatly appreciated.
Cheers
MarkTopic: add new roles
Hello,
I would like to create new roles in bbpress.
Since this is not easy, I have used this code/** * Neue Benutzerrollen */ function add_new_roles( $bbp_roles ) { /* Add a role called Super-Administrator */ $bbp_roles['bbp_super-administrator'] = array( 'name' => 'Super-Administrator', 'capabilities' => custom_capabilities( 'bbp_super-administrator' ) ); /* Add a role called Administrator */ $bbp_roles['bbp_administrator'] = array( 'name' => 'Administrator', 'capabilities' => custom_capabilities( 'bbp_administrator' ) ); /* Add a role called VIP-Member */ $bbp_roles['bbp_vip-member'] = array( 'name' => 'VIP-Member', 'capabilities' => custom_capabilities( 'bbp_vip-member' ) ); /* Add a role called Member */ $bbp_roles['bbp_member'] = array( 'name' => 'Member', 'capabilities' => custom_capabilities( 'bbp_member' ) ); /* Add a role called Trial-Member */ $bbp_roles['bbp_trial-member'] = array( 'name' => 'Trial-Member', 'capabilities' => custom_capabilities( 'bbp_trial-member' ) ); /* Add a role called User */ $bbp_roles['bbp_user'] = array( 'name' => 'User', 'capabilities' => custom_capabilities( 'bbp_User' ) ); 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_super-administrator' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_administrator' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_vip-member' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_member' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_trial-member' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_user' ) $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 'Super-Administrator' role */ case 'bbp_super-administrator': return array( // Keymasters only 'keep_gate' => true, // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => true, 'throttle' => true, 'view_trash' => true, // Forum caps 'publish_forums' => true, 'edit_forums' => true, 'edit_others_forums' => true, 'delete_forums' => true, 'delete_others_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 ); /* Capabilities for 'Administrator' role */ case 'bbp_administrator': return 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, ); /* Capabilities for 'VIP-Member' role */ case 'bbp_vip-member': return array( // Primary caps 'spectate' => true, 'participate' => true, // Forum caps 'read_private_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, // Topic tag caps 'assign_topic_tags' => true, ); /* Capabilities for 'Member' role */ case 'bbp_member': return array( // Primary caps 'spectate' => true, 'participate' => true, // Forum caps 'read_private_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, // Topic tag caps 'assign_topic_tags' => true, ); /* Capabilities for 'Trial-Member' role */ case 'bbp_trial-member': return array( // Primary caps 'spectate' => true, 'participate' => true, // Forum caps 'read_private_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, // Topic tag caps 'assign_topic_tags' => true, ); /* Capabilities for 'User' role */ case 'bbp_user': return array( // Primary caps 'spectate' => true, 'participate' => true, // Forum caps 'read_private_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, // Topic tag caps 'assign_topic_tags' => true, ); break; default : return $role; } }Unfortunately, I have the problem that the rights are all set to deny, as soon as the user changes something in his profile.
Can I prevent that?In addition I have installed the plugin “bbPress Advanced Capabilities”
VeePay