Ido Angel
Admite hilos creados en los últimos 30 días: 0
Debates favoritos del foro
Este usuario no tiene debates favoritos.
Temas del foro creados
Status | Debate | Supporter | Voces | Mensajes | Caducidad |
---|---|---|---|---|---|
taxonomy which is also a post?
Iniciado por: Ido Angel en: Toolset Professional Support |
|
1 | 4 | hace 6 años, 3 meses | |
display vustom field/taxonomy in a view only if it was filtered
Iniciado por: Ido Angel en: Toolset Professional Support |
|
2 | 3 | hace 6 años, 3 meses | |
Allow frontend user to change "any" to "all"
Iniciado por: Ido Angel en: Toolset Professional Support |
|
2 | 8 | hace 6 años, 4 meses | |
can i continue the count of an ordered list with pagination?
Iniciado por: Ido Angel en: Toolset Professional Support |
|
2 | 3 | hace 6 años, 4 meses | |
import multiple instances of custom fields via wp all import
Iniciado por: Ido Angel en: Toolset Professional Support |
|
2 | 9 | hace 6 años, 4 meses | |
Create M2M related post with information from current post
Iniciado por: Ido Angel
en: Toolset Professional Support
Problem: I have two post types, Patients and Threads, in an M2M relationship. On the Patient single post, I would like to allow site Users to create a new Thread, and automatically relate it to the current Patient. I would also like to include information from the current Patient in the post body of the new Thread. Solution: It's not currently possible to create a new post and related it to another post in an M2M relationship using only one Form, so you would have to use custom code. [credform] [cred_field field="form_messages" class="alert alert-warning"] <div style="display:none;"> [cred_field field="post_title" class="form-control" output="bootstrap" value="Re: [wpv-post-title]"] [cred_field field='post_content' output='bootstrap' value="Re: [wpv-post-link]"] [cred_generic_field type='hidden' field='patient'] { "default":"[wpv-post-id]" } [/cred_generic_field] </div> [cred_field field="form_submit" output="bootstrap" value="Create Thread" class="btn btn-primary btn-lg"] [/credform] 2. Set up the Form to redirect to any other custom Page after submission. add_action('cred_save_data', 'cred_link_patient_and_thread',10,2); function cred_link_patient_and_thread($post_id, $form_data) { // if a specific form if ($form_data['id'] == 12345 ) { toolset_connect_posts( 'patient-thread', $post_id, $_POST['patient'] ); } } 5. Create an Edit Thread Form and place it in an unassigned Layout. add_filter('cred_success_redirect', 'custom_redirect_to_edit_thread',10,3); function custom_redirect_to_edit_thread($url, $post_id, $form_data) { if ($form_data['id']==12345) $redirect = get_the_permalink($post_id) . '?layout_id=67890'; return $redirect; return $url; } 7. Use the Forms API to add complex HTML to the new Thread post_content, including information from the Patient post: add_action('cred_before_save_data', 'cred_generate_new_thread_content',10,1); function cred_generate_new_thread_content($form_data) { // if a specific form if ($form_data['id']==12345) { if (isset($_POST['patient'])) { // build the post_content using the patient's information $patient = $_POST['patient']; $dob = types_render_field("date-of-birth", array("style" => "text", "id" => $patient) ); $body = "<h2>Patient: " . get_the_title( $patient ) . "</h2>"; $body .= "<div>Patient's date of birth: " . $dob . "</div>"; $_POST['post_content'] = $body; } } } Relevant Documentation: |
|
2 | 16 | hace 6 años, 4 meses | |
Can a user upload a photo from his camera?
Iniciado por: Ido Angel en: Toolset Professional Support |
|
2 | 3 | hace 6 años, 4 meses | |
category archive doesn't show the views layout i created
Iniciado por: Ido Angel en: Toolset Professional Support |
|
2 | 12 | hace 6 años, 4 meses |