CRED plugin provides an API, making it easy to customize your post or user forms. The API includes hooks (actions and filters) to accomplish specific tasks using PHP code.
When you ask for help or report issues, make sure to tell us all related information about your form and what you want to achieve.
Viewing 12 topics - 721 through 732 (of 732 total)
Problem: I have a custom select field that stores the values 1, 2 and 3 but has different text labels. I would like to display the selected text label using PHP.
Problem: I would like to use a cred_save_data hook to update a User's role when a Form is submitted.
Solution: Use the following custom code to set a User's role to be "seller":
add_action('cred_save_data', 'cred_update_user_role_action',10,2);
function cred_change_user_role_action($post_id, $form_data) {
if ($form_data['id'] == 205164) {
// get the author ID and corresponding WP_User from the post ID
$p = get_post( $post_id );
$author_id = $p->post_author;
$u = new WP_User( $author_id );
// modify the user role to match the selected option
$u->remove_role( 'pending' ); /// adjust role name here if needed
$u->add_role( 'seller' );
}
}
I have a post called 'Venues'
Venues has a custom field called contact-email - this is separate field from the authors user_email
I want to create a form on this page which is visible only to logged in users which has a text box for a message that will be sent to contact-email.
I assume I would create custom post type called 'messages' or something to the form actually creates this and then sends the notification on.
contact-email is dynamic as every venue could have a different one - I seem to be able to send the notifcation to a designated email address, the logged in user or a designated user but not to a value of a custom field.
Solution:
It is possible with Toolset Forms plugin, see details here: