To manipulate the Author of a Post with a Toolset form, if a guest uses that form, you need to apply a Custom Code snippet to that form, using the cred_save_data() hook
You will (within above-shown hook) add a snippet that is using the WordPress API function wp_update_post() to update the created Post with the Author.
To get the proper user (the existing Author of the related Object), you need to:
- make sure there is some form of relation between the Message and Object.
- since the form if placed on the object it's supposed to relate to, it's not crucial to know the exact relationship, you can get the "related Object" author from the current post (where the form is displayed on).
This Is accessible in Toolset Form's API linked above as $form_data['container_id'].
Hence, we can conclude that you will need to apply a Custom Code snippet to your Form, which follows the above logic and uses the outlined API.
We can be of limited assistance only of what comes after (The coding itself):
https://toolset.com/toolset-support-policy/
Here is an example snippet that updates the Post Author with the user of the page where the Form is inserted to, for reference:
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==19)
{
//Get author of container post
$container_author = get_post_field( 'post_author', $form_data['container_id'] );
// Update message created
$my_post = array(
'ID' => $post_id,
'post_author' => $container_author
);
// Update the post into the database
wp_update_post( $my_post );
}
}
Please adapt the code to your site, it is just a reference snippet that updates the post submitted by the Form with the author of the Page where the Form is inserted to.
The API's above used are documented here:
https://toolset.com/documentation/programmer-reference/cred-api/
https://developer.wordpress.org/reference/functions/add_action/
https://codex.wordpress.org/Function_Reference/get_post_field
https://codex.wordpress.org/Function_Reference/wp_update_post