Forum Replies Created
-
In reply to: bbPress Topics for Posts comment
Thank you @robin-w for helping to get this one updated for everyone.
In reply to: First Post of Forum Topic On Page@robin-w , I must have misread what you posted then. I’ll go back and take a look. I was using the shortcode
[bsp-display-topic-index show=’1′ forum =’10’ template = ‘short’ show_stickies=’true’ noreply=’true’]
In reply to: First Post of Forum Topic On PageSorry I might not have explained what I’m trying to accomplish properly.
The shortcode I’m currently using on my live site is this:
[bbp-single-topic id=4657]
Just the normal bbpress shortcode to show the content of the actual topic. I used some CSS code to remove the post form and any replies. So it shows only the first post in a topic which is what I want to display as news on my front page from different forums. The shortcode you listed does show the stickies but just the actual forum topic and not the content of the first post of that forum topic.
I wasn’t sure if there was a shortcode that displays the content of the first post from “x” amount of topics from a specific forum.
So on my page I have three codes that are pulling a single topic from 3 different forums.
In reply to: First Post of Forum Topic On PageHi @robin-w,
That gets me close to the functionality. I managed to get it displayed properly. You can see at the top of the homepage at tidesofwar.net. I used the single topic shortcode and some css hacks to get it to display how I want it.
The issue is I have to manually edit the page anytime I want the topic to change.
In reply to: First Post of Forum Topic On PageThanks for the information. This does accomplish sort of what I want. I don’t want to feed it just a single topic. I would like it to post the two most recent topics in a specific forum. Perhaps I can hunt for this shortcode code and modify it.
In reply to: New Views Code Help@robin-w OMG I’m so dumb! I totally forgot the add_action wow. Thanks for that.
In reply to: bbpress topics for posts@robin-w,
I can help test with my test site when you’re ready.In reply to: bbpress topics for postshi @neon67, I think that will work for some but for others, like myself, we’ve started using Gutenberg.
In reply to: bbpress topics for postsHi @robin-w,
Thanks for the reply. I actually am using Gutenberg for my website in conjunction with Elementor.My use for the plugin is so that I can make topics go into specific forums I’ve created. The original plugin had the capability to do this I believe but from post to post in the post editor.
In reply to: bbpress topics for postsThanks for taking a look Robin. I haven’t seen any activity on that plugin for a very long time. It’s a great plugin and I’m shocked it’s something that isn’t being maintained. Please do let me know how I can contribute to this.
In reply to: Roles & CapabilitesHi @netweb,
Thanks for the reply. I have seen this plugin before but it doesn’t have the ability to add a custom role. I was just making the suggestion that the ability to create and edit new roles and capabilities be an out of the box feature of bbpress.In reply to: User Roles – Adding/RenamingHi @robin-w,
I managed to get this to work with this code
I needed a custom role and I also needed to reorder it in my legend. This code made it work//BBpress Custom Roles // function add_role_caps_filter( $caps, $role ) { /* Only filter for roles we are interested in! */ if( $role == 'bbp_lead' ) $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 'tutor' role */ case 'bbp_lead': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => true, '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' => 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, ); break; default : return $role; } } // End BBpress Custom Roles // //BBpress Rename Roles // add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' ); function ntwb_bbpress_custom_role_names() { return array( // Keymaster bbp_get_keymaster_role() => array( 'name' => 'Administrator', 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) ), 'bbp_lead' => array( 'name' => 'Community Lead', 'capabilities' => custom_capabilities( 'bbp_lead' ) ), // Moderator bbp_get_moderator_role() => array( 'name' => 'Moderator', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) ), // Participant bbp_get_participant_role() => array( 'name' => 'Member', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) ), // Spectator bbp_get_spectator_role() => array( 'name' => 'Spectator', 'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() ) ), // Blocked bbp_get_blocked_role() => array( 'name' => 'Blocked', 'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() ) ) ); } //BBpress Rename Roles End //
Here is an image of what I’m talking about.
It’s leaving the post that isn’t attached to a forum there.
Hi @robin-w,
For some odd reason it’s making two post entries in bbpress. It’s showing duplicate topics on a “Recent Topic” widget and the url’s are different. It’s strange. I can let you take a look at my website if you have time.
Thanks again for this, it really is great and helps me a lot.
@robin-w ,
Thanks so much for the follow up. I looked over the docs last night and saw that. This is really awesome.I do have one question.
When I’m posting a topic from Gravity Forms, for some odd reason it is making duplicate post. Does this happen when you use the code?
I think this is great but I wanted to ask you about this.
Is this function for ALL Gravity Form submissions or is it limited to any you choose?
I’m setting up a site where the Gravity Form information should be created as a topic but I have other Gravity Forms on the site that I don’t need this function for.In reply to: How To Add “New Topic” buttondid you create a new page and name it “new topic”. This is where you will place the short code [wpmu_bbp_topic]
In reply to: Thread PrefixFor anyone interested in this, I had this made and it’s available on codecanyon now.
http://codecanyon.net/item/bbpress-thread-prefixes/14402729?s_phrase=&s_rank=4
If anyone is interested in seeing it in action, check out my forum
http://artofwargaming.net/forums/cat/community-forums/off-topic-discussions/
The author of the plugin was fantastic and I recommend him to anyone looking for a custom plugin.
In reply to: How To Add “New Topic” buttonI actually placed my button inside of loop-topics.php and it works for my needs.
My users have the option to click the button or use the form at the bottom of the page.
In reply to: How To Add “New Topic” button@robkk,
I thought the exact same thing when they sent the code. Hopefully we see this as a core feature in the future updates of bbpress.One can make the button visible to logged in users only by using the
<?php if ( is_user_logged_in() ) : ?> button code here <?php endif; ?>
I’m not sure, I’ll have to do some testing on my site to see if it will work with forums.
In reply to: Thread PrefixThanks @robkk, I might have to find a plugin developer to do this for me.
In reply to: MyBB 1.8 to bbpressHi @robkk,
Not a problem. It didn’t seem to convert the passwords; however. Hopefully there will be an update that will convert the passwords in the future.
In reply to: MyBB 1.8 to bbpressHere is the fix I worked out to get the importer to work properly.
The problem I was having was the user accounts were not being imported due to some outdated usermeta fields in the database. I simply removed the sql code from the current importer script, re-ran, and it worked correctly.
I wanted to share the code of that mybb import script. The file name is Mybb.php.
<?php /** * Implementation of MyBB Forum converter. * * @since bbPress (r5140) * @link Codex Docs https://codex.bbpress.org/import-forums/mybb */ class MyBB extends BBP_Converter_Base { /** * Main Constructor * * @uses MyBB::setup_globals() */ function __construct() { parent::__construct(); $this->setup_globals(); } /** * Sets up the field mappings */ public function setup_globals() { /** Forum Section *****************************************************/ // Forum id (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'fid', 'to_type' => 'forum', 'to_fieldname' => '_bbp_forum_id' ); // Forum parent id (If no parent, then 0, Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'pid', 'to_type' => 'forum', 'to_fieldname' => '_bbp_forum_parent_id' ); // Forum topic count (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'threads', 'to_type' => 'forum', 'to_fieldname' => '_bbp_topic_count' ); // Forum reply count (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'posts', 'to_type' => 'forum', 'to_fieldname' => '_bbp_reply_count' ); // Forum title. $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'name', 'to_type' => 'forum', 'to_fieldname' => 'post_title' ); // Forum slug (Clean name to avoid conflicts) $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'name', 'to_type' => 'forum', 'to_fieldname' => 'post_name', 'callback_method' => 'callback_slug' ); // Forum description. $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'description', 'to_type' => 'forum', 'to_fieldname' => 'post_content', 'callback_method' => 'callback_null' ); // Forum display order (Starts from 1) $this->field_map[] = array( 'from_tablename' => 'forums', 'from_fieldname' => 'disporder', 'to_type' => 'forum', 'to_fieldname' => 'menu_order' ); // Forum dates. $this->field_map[] = array( 'to_type' => 'forum', 'to_fieldname' => 'post_date', 'default' => date('Y-m-d H:i:s') ); $this->field_map[] = array( 'to_type' => 'forum', 'to_fieldname' => 'post_date_gmt', 'default' => date('Y-m-d H:i:s') ); $this->field_map[] = array( 'to_type' => 'forum', 'to_fieldname' => 'post_modified', 'default' => date('Y-m-d H:i:s') ); $this->field_map[] = array( 'to_type' => 'forum', 'to_fieldname' => 'post_modified_gmt', 'default' => date('Y-m-d H:i:s') ); /** Topic Section *****************************************************/ // Topic id (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'tid', 'to_type' => 'topic', 'to_fieldname' => '_bbp_topic_id' ); // Topic reply count (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'replies', 'to_type' => 'topic', 'to_fieldname' => '_bbp_reply_count', 'callback_method' => 'callback_topic_reply_count' ); // Topic total reply count (Includes unpublished replies, Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'replies', 'to_type' => 'topic', 'to_fieldname' => '_bbp_total_reply_count', 'callback_method' => 'callback_topic_reply_count' ); // Topic parent forum id (If no parent, then 0. Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'fid', 'to_type' => 'topic', 'to_fieldname' => '_bbp_forum_id', 'callback_method' => 'callback_forumid' ); // Topic author. $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'uid', 'to_type' => 'topic', 'to_fieldname' => 'post_author', 'callback_method' => 'callback_userid' ); // Topic Author ip (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'ipaddress', 'join_tablename' => 'threads', 'join_type' => 'INNER', 'join_expression' => 'USING (tid) WHERE replyto = 0', 'to_type' => 'topic', 'to_fieldname' => '_bbp_author_ip' ); // Topic content. // Note: We join the 'posts' table because 'threads' table does not have content. $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'message', 'join_tablename' => 'threads', 'join_type' => 'INNER', 'join_expression' => 'USING (tid) WHERE replyto = 0', 'to_type' => 'topic', 'to_fieldname' => 'post_content', 'callback_method' => 'callback_html' ); // Topic title. $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'subject', 'to_type' => 'topic', 'to_fieldname' => 'post_title' ); // Topic slug (Clean name to avoid conflicts) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'subject', 'to_type' => 'topic', 'to_fieldname' => 'post_name', 'callback_method' => 'callback_slug' ); // Topic parent forum id (If no parent, then 0) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'fid', 'to_type' => 'topic', 'to_fieldname' => 'post_parent', 'callback_method' => 'callback_forumid' ); // Sticky status (Stored in postmeta)) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'sticky', 'to_type' => 'topic', 'to_fieldname' => '_bbp_old_sticky_status', 'callback_method' => 'callback_sticky_status' ); // Topic dates. $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'dateline', 'to_type' => 'topic', 'to_fieldname' => 'post_date', 'callback_method' => 'callback_datetime' ); $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'dateline', 'to_type' => 'topic', 'to_fieldname' => 'post_date_gmt', 'callback_method' => 'callback_datetime' ); $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'lastpost', 'to_type' => 'topic', 'to_fieldname' => 'post_modified', 'callback_method' => 'callback_datetime' ); $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'lastpost', 'to_type' => 'topic', 'to_fieldname' => 'post_modified_gmt', 'callback_method' => 'callback_datetime' ); $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'lastpost', 'to_type' => 'topic', 'to_fieldname' => '_bbp_last_active_time', 'callback_method' => 'callback_datetime' ); // Topic status (Open or Closed, MyBB v1.6.10 open = null & closed = 1) $this->field_map[] = array( 'from_tablename' => 'threads', 'from_fieldname' => 'closed', 'to_type' => 'topic', 'to_fieldname' => 'post_status', 'callback_method' => 'callback_topic_status' ); /** Tags Section ******************************************************/ /** * MyBB v1.6.10 Forums do not support topic tags out of the box */ /** Reply Section *****************************************************/ // Reply id (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'pid', 'from_expression' => 'WHERE replyto != 0', 'to_type' => 'reply', 'to_fieldname' => '_bbp_post_id' ); // Reply parent forum id (If no parent, then 0. Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'fid', 'to_type' => 'reply', 'to_fieldname' => '_bbp_forum_id', 'callback_method' => 'callback_topicid_to_forumid' ); // Reply parent topic id (If no parent, then 0. Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'tid', 'to_type' => 'reply', 'to_fieldname' => '_bbp_topic_id', 'callback_method' => 'callback_topicid' ); // Reply author ip (Stored in postmeta) $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'ipaddress', 'to_type' => 'reply', 'to_fieldname' => '_bbp_author_ip' ); // Reply author. $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'uid', 'to_type' => 'reply', 'to_fieldname' => 'post_author', 'callback_method' => 'callback_userid' ); // Reply title. $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'subject', 'to_type' => 'reply', 'to_fieldname' => 'post_title' ); // Reply slug (Clean name to avoid conflicts) $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'subject', 'to_type' => 'reply', 'to_fieldname' => 'post_name', 'callback_method' => 'callback_slug' ); // Reply content. $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'message', 'to_type' => 'reply', 'to_fieldname' => 'post_content', 'callback_method' => 'callback_html' ); // Reply parent topic id (If no parent, then 0) $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'tid', 'to_type' => 'reply', 'to_fieldname' => 'post_parent', 'callback_method' => 'callback_topicid' ); // Reply dates. $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'dateline', 'to_type' => 'reply', 'to_fieldname' => 'post_date', 'callback_method' => 'callback_datetime' ); $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'dateline', 'to_type' => 'reply', 'to_fieldname' => 'post_date_gmt', 'callback_method' => 'callback_datetime' ); $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'edittime', 'to_type' => 'reply', 'to_fieldname' => 'post_modified', 'callback_method' => 'callback_datetime' ); $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'edittime', 'to_type' => 'reply', 'to_fieldname' => 'post_modified_gmt', 'callback_method' => 'callback_datetime' ); /** User Section ******************************************************/ // Store old User id (Stored in usermeta) $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'uid', 'to_type' => 'user', 'to_fieldname' => '_bbp_user_id' ); // Store old User password (Stored in usermeta serialized with salt) $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'password', 'to_type' => 'user', 'to_fieldname' => '_bbp_password', 'callback_method' => 'callback_savepass' ); // Store old User Salt (This is only used for the SELECT row info for the above password save) $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'salt', 'to_type' => 'user', 'to_fieldname' => '' ); // User password verify class (Stored in usermeta for verifying password) $this->field_map[] = array( 'to_type' => 'users', 'to_fieldname' => '_bbp_class', 'default' => 'MyBB' ); // User name. $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'username', 'to_type' => 'user', 'to_fieldname' => 'user_login' ); // User nice name. $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'username', 'to_type' => 'user', 'to_fieldname' => 'user_nicename' ); // User email. $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'email', 'to_type' => 'user', 'to_fieldname' => 'user_email' ); // User homepage. $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'website', 'to_type' => 'user', 'to_fieldname' => 'user_url' ); // User registered. $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'regdate', 'to_type' => 'user', 'to_fieldname' => 'user_registered', 'callback_method' => 'callback_datetime' ); // User display name. $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'usertitle', 'to_type' => 'user', 'to_fieldname' => 'display_name' ); // Store Signature (Stored in usermeta) $this->field_map[] = array( 'from_tablename' => 'users', 'from_fieldname' => 'signature', 'to_type' => 'user', 'to_fieldname' => '_bbp_mybb_user_sig', 'callback_method' => 'callback_html' ); } /** * This method allows us to indicates what is or is not converted for each * converter. */ public function info() { return ''; } /** * This method is to save the salt and password together. That * way when we authenticate it we can get it out of the database * as one value. Array values are auto sanitized by WordPress. */ public function callback_savepass( $field, $row ) { $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] ); return $pass_array; } /** * This method is to take the pass out of the database and compare * to a pass the user has typed in. */ public function authenticate_pass( $password, $serialized_pass ) { $pass_array = unserialize( $serialized_pass ); return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) ); } /** * Translate the post status from MyBB v1.6.10 numeric's to WordPress's strings. * * @param int $status MyBB v1.6.10 numeric topic status * @return string WordPress safe */ public function callback_topic_status( $status = 0 ) { switch ( $status ) { case 1 : $status = 'closed'; break; case 0 : default : $status = 'publish'; break; } return $status; } /** * Translate the topic sticky status type from MyBB v1.6.10 numeric's to WordPress's strings. * * @param int $status MyBB v1.6.10 numeric forum type * @return string WordPress safe */ public function callback_sticky_status( $status = 0 ) { switch ( $status ) { case 1 : $status = 'sticky'; // MyBB Sticky 'topic_sticky = 1' break; case 0 : default : $status = 'normal'; // MyBB Normal Topic 'topic_sticky = 0' break; } return $status; } /** * Verify the topic/reply count. * * @param int $count MyBB v1.6.10 topic/reply counts * @return string WordPress safe */ public function callback_topic_reply_count( $count = 1 ) { $count = absint( (int) $count - 1 ); return $count; } }
Hope this helps someone else who is switching over from MyBB to WordPress.
In reply to: plugin Button to create new topicI”ve been reading these topic about “new topic button” and I’m just curious why this isn’t included in the plugin? Most major forums have this feature and when I click on “Start Topic” I don’t have to choose the forum where I want the topic posted. So if I click on “start new topic” in the “General Discussions” forum, it post the topic there. I don’t have to select where to post the topic.
Would love to see this feature in future releases. Thanks for the hard work on bbpress.