Nashaat
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Select Author changes on update although no Author selected.
Started by: Nashaat
in: Toolset Professional Support
Problem: I am using Forms to allow Users to edit a post. I would like to give them the opportunity to modify the post author, so I created a generic field that contains the author options. If the default option is selected, I would like to keep the existing post author. If another option is selected, I would like to update the author to be the selected User. My cred_save_data hook doesn't seem to work correctly because sometimes the current User becomes the post author even if nothing is selected. Solution: add_action('cred_save_data', 'my_save_data_action_select_author',10,2); function my_save_data_action_select_author($post_id, $form_data) { //create an array of values with all ID's of the Forms you want to check: $ids = array("8604","8598","8603","8599"); //Check if the current form ID is one of in the above array: if (in_array($form_data['id'], $ids) ){ $author_id = isset( $_POST['my_autor_select'] ) ? $_POST['my_autor_select'] : get_post_field( 'post_author', $post_id ); $my_post = array( 'ID' => $post_id, 'post_author' => $author_id ); // Update the post into the database wp_update_post( $my_post ); } } Relevant Documentation: |
2 | 5 | 5 years, 10 months ago | ||
Cred translation secondary languages content issue
Started by: Nashaat
in: Toolset Professional Support
Problem: When i edit the main language AR all translation content of secondary languages i have made get deleted and the original language show instead. This way all the content of secondary languages will need to be edited again which is not ok. See details here: https://toolset.com/forums/topic/cred-translation-secondary-languages-content-issue/#post-1173247 Solution: It is a custom PHP codes problem, see the solution here: https://toolset.com/forums/topic/cred-translation-secondary-languages-content-issue/#post-1175790 Relevant Documentation: |
2 | 5 | 5 years, 10 months ago | ||
Cred Form Redirection to an Edit form
Started by: Nashaat in: Toolset Professional Support |
2 | 3 | 5 years, 10 months ago | ||
Homepage showing Archive Page
Started by: Nashaat in: Toolset Professional Support |
1 | 3 | 5 years, 10 months ago | ||
Duplicate Translation for specific language with Cred form.
Started by: Nashaat
in: Toolset Professional Support
Problem: I would like to use Forms to allow Users to automatically create a duplicate post in a secondary language after creating a post in the primary language with Forms. Solution: Add this WPML hook to create a single language duplicate from the default language post: function wpml_make_post_duplicate_language( $master_post_id, $lang_to ) { global $sitepress; $master_post = get_post( $master_post_id ); if ( 'auto-draft' === $master_post->post_status || 'revision' === $master_post->post_type ) { return; } $active_langs = $sitepress->get_active_languages(); if (array_key_exists($lang_to, $active_langs)) { $trid = $sitepress->get_element_trid( $master_post->ID, 'post_' . $master_post->post_type ); $lang_from = $sitepress->get_source_language_by_trid( $trid ); if ( $lang_from == $lang_to ) { return; } $sitepress->make_duplicate( $master_post_id, $lang_to ); } } add_action( 'wpml_make_post_duplicate_lang', 'wpml_make_post_duplicate_language', 10, 2 ); Add this Forms API hook to trigger the correct WPML hook when the Form is submitted: function quick_duplicate_save_data_action( $post_id, $form_data ){ $form_langs = array( 383 => 'en', 404 => 'ru', ); if( isset( $form_langs[$form_data['id']] ) ) { global $sitepress; $lang_to = $form_langs[$form_data['id']]; do_action( 'wpml_make_post_duplicate_lang', $post_id, $lang_to ); } } add_action( 'cred_save_data', 'quick_duplicate_save_data_action', 10, 2 ); Modify the $form_langs array to support any number of secondary languages. The keys in the array should be the same as the language Form IDs. The values should be the corresponding two-letter language codes. Relevant Documentation: |
3 | 11 | 5 years, 11 months ago | ||
If Conditional not working for custom User Role & User ID
Started by: Nashaat in: Toolset Professional Support |
2 | 8 | 5 years, 11 months ago | ||
Duplicating Post to all other Secondary languages with Cred form and WPML
Started by: Nashaat
in: Toolset Professional Support
Problem: I have a form to submit a new Recipe in default language (arabic). now after submitting the form with the help of following code snippet i can confirm that on the frontend i can find the post in default language (arabic) and when i switch the language to english i can see also a post of default language has been created for english. the problem is when i edit the duplicated post that was created for english. I translate the fields to english and then submit the editing form, once the editing form is submitted, the default language disappears (no arabic version anymore, only english) Solution: You might consider to remove the a custom hidden field "_icl_lang_duplicate_of" from secindary language posts, for example: Relevant Documentation: |
2 | 13 | 5 years, 11 months ago | ||
Layouts Plugin/Elementor (SyntaxError: Unexpected token < in JSON at position 0)
Started by: Nashaat in: Toolset Professional Support |
1 | 2 | 5 years, 11 months ago | ||
WooCommerce Filtering with price range between not filtering properly
Started by: Nashaat
in: Toolset Professional Support
Problem: Solution: To achieve your goal I've added the following JS code to your view's filter section's JS box: You can find the proposed solution in this case with the following reply: Relevant Documentation: |
2 | 11 | 6 years ago | ||
Woocommerce different Prodzct Layout
Started by: Nashaat
in: Toolset Professional Support
Problem: There are some PHP errors in user's custom codes. https://toolset.com/forums/topic/woocommerce-different-prodzct-layout/#post-1137997 Solution: It is fixed by custom codes: https://toolset.com/forums/topic/woocommerce-different-prodzct-layout/#post-1141985 Relevant Documentation: |
4 | 11 | 6 years ago | ||
Assign WordPress Category automatically by selected Product Category
Started by: Nashaat
in: Toolset Professional Support
Problem: I have a Form that creates Product posts. Two taxonomies are assigned to Products: Product Categories and standard Categories. When a Product is created by Forms, Users will define the Product Categories. I would like to programmatically assign the same terms in the standard Category taxonomy. Solution: You can manipulate the terms associated with a new post created by Forms using the Forms API cred_save_data. Add this code to your child theme's functions.php file or create a new snippet in Toolset > Settings > Custom Code: add_action('cred_save_data', 'ts_copy_to_cats_from_pcats',10,2); function ts_copy_to_cats_from_pcats($post_id, $form_data) { $forms = array( 12345 ); if ( in_array( $form_data['id'], $forms ) ) { $post_terms = wp_get_object_terms($post_id, 'product_cat', array('fields' => 'slugs')); wp_set_object_terms($post_id, $post_terms, 'category', false); } } Replace 12345 with the numeric ID of the New Product Form. Relevant Documentation: |
2 | 3 | 6 years ago | ||
Views Plugin is slowing down my website hardly!
Started by: Nashaat
in: Toolset Professional Support
Problem: I have noticed since this week that my site became too slow for both admin area and frontend loading time was between 4-6 and now its at least 9-13 and sometime its stop loading and then continue after couple of second. very weird behaviour. Solution: The issue was caused by a syntax error, see details here: https://toolset.com/forums/topic/views-plugin-is-slowing-down-my-website-hardly/#post-1136833 Relevant Documentation: |
2 | 5 | 6 years ago | ||
Multistep Form with post Relationship
Started by: Nashaat in: Toolset Professional Support |
2 | 2 | 6 years ago | ||
Value of Field not showing when using Quotation mark ( " )
Started by: Nashaat in: Toolset Professional Support |
2 | 3 | 6 years ago | ||
Displaying Content Conditionally if post type is WooCommerce Product
Started by: Nashaat in: Toolset Professional Support |
2 | 6 | 6 years ago |