Forum Replies Created
-
In reply to: One Off Identities or Posting As Multiple Users
I did something very similar to what you suggested. I hadn’t found the ‘bbp_new_reply_post_extras’ action so I tied it into wp_insert_post.
I added a drop-menu/select field inside
form-reply.php
which I’m able to then access the data through the$_POST['d20_char']
variable in the wp_insert_post action.I’m populating that select box by simply running a wp_query and selecting all the CPT Characters and populating them. I will eventually limit that list of Characters based on a User’s role, and who the author of the Character is. DMs can post as Player’s Characters, and players can post as more than 1 character. (I’m not sure yet how I’m going to allow other people to use the website with their players and character lists, but I’ll cross that bridge some day in the future)
Below is the really rudimentary version of my code. I will be adding a $post->post-type check to make sure I will then only the run code if a reply is being created, and also a check to make sure the POST data I’m looking for is present.
function rpg_bbp_new_topic_handler( $post_id , $post , $update ) { update_post_meta( $post_id , 'd20_char' , $_POST['d20_char'] ); } add_action( 'wp_insert_post', 'rpg_bbp_new_topic_handler', 10, 3 );
In reply to: One Off Identities or Posting As Multiple UsersQuick update. I used the CPT UI plugin to create a “Character” Custom Post Type.
I modified form-reply.php to pull all these Characters and put those into a drop menu (select).
Each of these CPT’s has their own Post ID, which I’m going to save as “d20_character” in the meta of the Reply.
Question: Can you tell me the best way to modify the data saved for a reply when the user clicks “Submit”?
Then in loop-single-reply.php I’m checking for the existence of the “d20_character” meta entry. If that entry exists for a reply, then I am pulling the Post Title of the Character Post by the ID, and the Post Thumbnail (Featured Image) to display that in the bbp-reply-author div instead of the default.
Question: There are several actions in loop-single-reply.php. What’s the best way to modify those actions on an individual reply basis? I would like the use the same functionality those functions provide, but I need to tell them to use the ID of the Character post associated with the reply instead of the Reply WP User Author.
Actions: bbp_theme_before_reply_author_details, bbp_reply_author_link, bbp_theme_before_reply_author_admin_details, bbp_theme_after_reply_author_admin_details, bbp_theme_after_reply_author_details
In reply to: One Off Identities or Posting As Multiple UsersWow! Fantastic guidance! Thank you so much! I will share what I do in here if this is left open to possibly help others.
In reply to: One Off Identities or Posting As Multiple UsersYep… I’m aware… That’s why I asked about documentation. If anyone can (usefully) respond with a link to an area of the documentation that deals with user identities at submission or how a post/thread/reply is associated with a given user.
My current idea is to program the “submit reply” box to have a drop menu that lists a certain selection of names. If I have to create user accounts for each, I can, but I’m thinking instead of making a custom post type called Characters which it populates from. This would allow me to associate multiple characters with one user, give them each avatars, and additional details.
If a reply MUST be associated with an actual WordPress user, then I can have it associate with the user account submitting, but check if they selected a Character CPT and, if so, show that name and avatar instead.