davidZ-4
In den letzten 30 Tagen erstellte Support-Threads: 0
Lieblings-Forenthemen
This user has no favorite topics.
Forum Topics Created
Status | Thema | Supporter | Stimmen | Artikel | Aktualität |
---|---|---|---|---|---|
Create membership with 2 types of users, Super user can manage his clients only
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 2 | vor 7 Jahren, 1 Monat | ||
using in types_render_usermeta a custom function.php cause HTTP 500 error
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 3 | vor 7 Jahren, 1 Monat | ||
Get birth date year using php and calculate current age
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 3 | vor 7 Jahren, 1 Monat | ||
Change field type for the field – not working
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 3 | vor 7 Jahren, 1 Monat | ||
multi layer memrbeship where top layer can create users and both manage same CPT
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 3 | vor 7 Jahren, 1 Monat | ||
Sum radio values using 'Value to show' insted of 'Custom field content' in php
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 15 | vor 7 Jahren, 1 Monat | ||
set multiple parents to a child automaticaly
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 7 | vor 7 Jahren, 1 Monat | ||
calculate a value using custom post fileds from two or more post types
Gestartet von: davidZ-4 in: Toolset Professional Support |
1 | 2 | vor 7 Jahren, 1 Monat | ||
Auto create and change post title from author name and post last modified date
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 7 | vor 7 Jahren, 2 Monaten | ||
display CRED new post form inside view wpv-items-not-found not working
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 3 | vor 7 Jahren, 2 Monaten | ||
Display numeric value as currency
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 6 | vor 7 Jahren, 2 Monaten | ||
accordion in Cred Form and in in views
Gestartet von: davidZ-4 in: Toolset Professional Support |
2 | 7 | vor 7 Jahren, 2 Monaten | ||
Calculate value of a custom field based on other custom fields values
1
2
Gestartet von: davidZ-4
in: Toolset Professional Support
Problem: Solution: function calculate_fields( $post_ID ) { if ( get_post_type( $post_ID ) == 'net-worth' ) { $total_assets = $total_liabilities = 0; // Assets $cash_on_hand = get_post_meta($post_ID, 'wpcf-ass-cash-on-hand', true); $checking_accounts = get_post_meta($post_ID, 'wpcf-ass-checking-accounts', true); $money_market_acc = get_post_meta($post_ID, 'wpcf-ass-money-market-accounts', true); // Libilities $credit_cards = get_post_meta($post_ID, 'wpcf-lib-credit-cards', true); $home_mortgages = get_post_meta($post_ID, 'wpcf-lib-home-mortgages', true); // Total Assets $total_assets = $cash_on_hand + $checking_accounts + $money_market_acc; update_post_meta( $post_ID, 'wpcf-total-assets', $total_assets ); // Total Liabilities $total_liabilities = $credit_cards + $home_mortgages; update_post_meta( $post_ID, 'wpcf-total-liabilities', $total_liabilities ); // Net Worth $net_worth = $total_assets - $total_liabilities; update_post_meta( $post_ID, 'wpcf-net-worth', $net_worth ); } } add_action( 'save_post', 'calculate_fields', 99 ); We need to add cred hook to call the calculation function. I have added the following code in custom functions.php file, and it is working as expected, see attached screenshot: https://cdn.toolset.com/wp-content/uploads/2017/09/569909-fields_calculated.png?x41285 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']==1337) { calculate_fields( $post_id ); } } |
2 | 17 | vor 7 Jahren, 2 Monaten |