SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | // page.php | |
3 | $pod = pods('contacts'); | |
4 | $fields = array( | |
5 | 'post_title' => array('type'=>'hidden'), | |
6 | 'first_name', | |
7 | 'last_name', | |
8 | 'email_address', | |
9 | 'phone' | |
10 | ); | |
11 | echo $pod->form( $fields ); | |
12 | ?> | |
13 | ||
14 | <?php | |
15 | // functions.php | |
16 | - | add_filter('pods_api_pre_save_pod_item_contacts', 'contact_create_title', 10, 1); |
16 | + | add_filter('pods_api_pre_save_pod_item_contacts', 'contact_create_title', 10, 2); |
17 | - | function contact_create_title($pieces) { |
17 | + | function contact_create_title($pieces, $is_new_item) { |
18 | $contact_fullname = $pieces['fields']['first_name']['value'] . ' ' . $pieces['fields']['last_name']['value']; | |
19 | $pieces['fields']['post_title']['value'] = $contact_fullname; | |
20 | ||
21 | podsDebugger::log_debug_data(print_r($pieces, TRUE)); | |
22 | ||
23 | return $pieces; | |
24 | } | |
25 | ?> |