Skip to:

form to post multiple inputs into post_content

  • jslom


    I have a form, with multiple inputs that I am trying to get posted to the wordpress “post_content”. I am able to get the title field and only one other field to post successfully, only when making a field name “description” instead of “description[]”, but have no idea how I can get the rest to submit into the post_content. I would like the inputs posted like the image I have created below.

    Here is the code I currently have that works for the title only.

        <?php /* Template Name: Question Form */ ?>
        if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {
        if (isset ($_POST['title'])) {
        	$title =  $_POST['title'];
        } else {
        	echo 'Please enter a title';
        if (isset ($_POST['description'])) {
        	$description = $_POST['description'];
        } else {
        	echo 'Please enter the content';
        $tags = $_POST['post_tags'];
        $new_post = array(
        	'post_title'    => $title,
        	'post_content'  => $_POST['description'],
        	'post_parent' => 599,
        	'post_status'   => 'publish',
        	'post_type' => 'topic'
        $topic_meta = array(
        'forum_id'       => $new_post['post_parent']
        $topic_id = bbp_insert_topic($new_post, $topic_meta);
        wp_redirect(get_permalink($topic_id)); exit;
        <form id="new_post" name="new_post" method="post" action="">
        <p class="question"><label>Title</label><input name="title" type="text">
        <p class="question"><label>Description</label><input name="description[]" type="text">
        <p class="question"><label>Your First Name</label><input name="description[]" type="text">
        <p class="question"><label>Your Last Name</label><input name="description[]" type="text">
        <p align="right"><input type="submit" value="Publish" tabindex="6" id="submit" name="submit" />
        <input type="hidden" name="action" value="new_post" />
        <?php wp_nonce_field( 'new-post' ); ?>

    I don’t know how to add the other fields to be a part of post_content.
    I have tried a few other things, but have been unsuccessful. I would appreciate any help very much!

Viewing 7 replies - 1 through 7 (of 7 total)

  • Robin W


    Really a wordpress not a bbPress question, and quite a techy area

    This is the code that I use to add a location to user details, which should help get you started.

    //this function adds the updated town and county info to the database
    function bbp_edit_user_tc( $user_id ) {
    	$town = ( $_POST['town'] ) ;
    	$county = ($_POST['county'] ) ;
    	// Update town user meta
    	if ( !empty( $town ) )
    		update_user_meta( $user_id, 'town', $town);
    	// Delete town user meta
    		delete_user_meta( $user_id, 'town' );
    	//Update county user meta
    	if ( !empty( $county ) )
    		update_user_meta( $user_id, 'county', $county);
    	// Delete county user meta
    		delete_user_meta( $user_id, 'county' );
    add_action( 'personal_options_update',         'bbp_edit_user_tc' );
    add_action( 'edit_user_profile_update',        'bbp_edit_user_tc' );



    @Robin-W This is only adding to their user profile, right?

    My form posts to a new thread, which is what I was looking to do with the remaining fields.


    Robin W


    Yes, I was giving you the sort of code you need to write, in this case to write stuff to usermeta.

    As I said this is not a bbPress issue as bbPress just uses wp-posts, so you’d do better on their forum



    Hi Robin W,

    Is there a way to include make these fields available to the get_available_tags function in bbpress-notify-nospam/bbpress-notify-nospam.php. Basically I’m trying to display these fields in the email notification area. Listed is the code for the get_available_tags function… Any input would be greatly appreciated. Many thanks.

    public function get_available_tags( $tags='' )
    		$tags 		= '[blogname], [topic-title], [topic-content], [topic-excerpt], [topic-url], [topic-replyurl], [topic-author]';
    		$extra_tags = apply_filters( 'bbpnns_extra_topic_tags',  null );
    		if ( $extra_tags )
    			$tags .= ', '. $extra_tags;
    		return $tags;		

    Robin W


    sorry I am fully tied up in a website development the moment, so i’m unable to help at this time



    @robin-w, I am aware this thread is quite old however I am looking into the main reason @jslom posted this in the first place.

    Form To Forum Post

    I currently have a website and I would like to integrate the application form into bbpress forums as a new thread.

    Robin W


    @omarsammour Unfortunately @jslom didn’t post the solution, maybe he will see this and come to our help.

    Whilst my knowledge has improved, and given enough time I could probably work out an answer – I am fully tied up in other work at the moment – sorry 🙁

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar