Reply To: customize bbpress reply form with dropdown selection list form
meta boxes are used in the backend, but you are most of the way there.
so to add the dropdown you can use
add_action(‘bbp_theme_before_reply_content’, ‘so_additional_content’);
(there is a bbp_theme_after_reply_content action as well)
and then in the function put the drop down stuff – I’ve not checked your code, so you’ll need to tidy and correct the following if it doesn’t work
so
function so_additional_content () {
?>
<label>Choose the size of the element : </label>
<select name=”custom_element_grid_class” id=”custom_element_grid_class”>
<option value=”normal” <?php selected( $meta_element_class, ‘normal’ ); ?>>normal</option>
<option value=”square” <?php selected( $meta_element_class, ‘square’ ); ?>>square</option>
<option value=”wide” <?php selected( $meta_element_class, ‘wide’ ); ?>>wide</option>
<option value=”tall” <?php selected( $meta_element_class, ‘tall’ ); ?>>tall</option>
</select>
<?php
}
Then when the user presses submit a function in bbpress called ‘new reply handler’ takes over.
that has a hook
do_action( ‘bbp_new_reply_post_extras’, $reply_id );
which you can link to, to do the save.
so you would have
add_action ( 'bbp_new_reply_post_extras' , 'so_save' ) ;
function so-save ($reply_id) {
$meta_element_class = $_POST[‘custom_element_grid_class’];
update_post_meta($reply_id, ‘custom_element_grid_class_meta_box’, $meta_element_class);
}
again your code is not checked.
you will need to add functionality if you want users to edit their replies and change the dropdown selection
I’ll let you play with the above, and do come back with a first version if you need extra help.
If you fix it, then PLEASE post your solution here to help others