Adding signature with post from form content
-
The signature of the user comes from an external system and is retrieved through an API.
I have the signature in the form in an hidden input before a new post or reply is created.
All I need is to use a hook to automatically include this with the content.I am trying the following with no success.
I am new to bbPress programming and I am trying to piece up information found on different sites, so bare with me if part of what I wrote is incorrectfunction add_signature_to_post($topic_id=0) {
$content = get_post_field( ‘post_content’, $topic_id );
$signature = “”;if (isset($_POST) && $_POST[‘bbp_signature’]!=”)
$signature = $_POST[‘bbp_signature’];echo ‘<script>’;
echo “console.log(‘Signature:”. $_POST[‘bbp_signature’] .”‘);”;
echo ‘</script>’;return $content . $signature;
}add_action(‘bbp_new_topic’, ‘add_signature_to_post’, 10, 0);
add_action(‘bbp_new_reply’, ‘add_signature_to_post’, 10, 0);Thanks
- You must be logged in to reply to this topic.