Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: One Off Identities or Posting As Multiple Users

@glaxton

Participant

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 );
Skip to toolbar