1. What do you think is the best way to change the author of the user/client CTP from whoever on our sales team created the CTP to the user/client.
This is done purely in the Front End, correct?
So you can not let your Team choose the Author as in the WP Post Admin area is possible.
That means you need a Custom Code using our API for CRED and some functions of WordPress.
Basically, you will:
- Hook into the save process of the post that CRED performs
https://toolset.com/documentation/user-guides/cred-api/#csd
- Get the user/Client name from somewhere in the Post you are saving
(assuming you have the first and last name in a Field that you save for this post)
https://developer.wordpress.org/reference/functions/get_post_meta/
If you are using Types Fields keep in mind to use wpcf- prefix for the Field's Meta key
- Update the Post Title and name with this values.
https://codex.wordpress.org/Function_Reference/wp_update_post
Keep in mind filtering Posts by Author is possible ONLY as a Query Filter and not as a Parametric Search.
If you need it for latter, I rather suggest updating a Custom Field with this value which you can then use in your search
2. That being said, all of the content tied to the client CTP worked perfectly. How do I create a "ShortCode that produces the necessary JSON for CRED generic Fields" to do it with a select field and follow your recommended way to do it and tie the client CTP to an actual client user account?
That requires Custom Code.
You will use this WordPress API to construct a ShortCode:
https://codex.wordpress.org/Shortcode_API
You will return a $value, which is actually the label/value array in JSON format.
hidden link
Example below creates a Select Field population value set for GMT Time Zones:
function gmt_values( $atts ){
$gmt_values = '
{"value":"GMT-12","label":"GMT-12"},
{"value":"GMT-11","label":"GMT-11"},
{"value":"GMT-10","label":"GMT-10"},
{"value":"GMT-9","label":"GMT-9"},
{"value":"GMT-8","label":"GMT-8"},
{"value":"GMT-7","label":"GMT-7"},
{"value":"GMT-6","label":"GMT-6"},
{"value":"GMT-5","label":"GMT-5"},
{"value":"GMT-4","label":"GMT-4"},
{"value":"GMT-3","label":"GMT-3"},
{"value":"GMT-2","label":"GMT-2"},
{"value":"GMT-1","label":"GMT-1"},
{"value":"GMT+0","label":"GMT+0"},
{"value":"GMT+1","label":"GMT+1"},
{"value":"GMT+2","label":"GMT+2"},
{"value":"GMT+3","label":"GMT+3"},
{"value":"GMT+4","label":"GMT+4"},
{"value":"GMT+5","label":"GMT+5"},
{"value":"GMT+6","label":"GMT+6"},
{"value":"GMT+7","label":"GMT+7"},
{"value":"GMT+8","label":"GMT+8"},
{"value":"GMT+9","label":"GMT+9"},
{"value":"GMT+10","label":"GMT+10"},
{"value":"GMT+11","label":"GMT+11"},
{"value":"GMT+12","label":"GMT+12"},
{"value":"GMT+13","label":"GMT+13"},
{"value":"GMT+14","label":"GMT+14"}
';
return $gmt_values;
}
add_shortcode( 'gmt', 'gmt_values' );
This ShortCode is then used in the CRED Generic Field as values of the field.
You can dynamically construct your JSON but that requires more custom code.
If you need custom programming work which is beyond the scope of our support, I would suggest you consider contacting one of our certified partners from this link:
https://toolset.com/consultant/
You will get the custom assistance you need to get on with your project.