Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Update contact
- *
- * @access public
- * @return bool
- */
- public function update_contact( $contact_id, $data ) {
- if(is_wp_error( $this->connect() ))
- return false;
- if(!isset($data['email']))
- $data['email'] = $this->get_email_from_cid($contact_id);
- $user_id = wp_fusion()->user->get_user_id( $contact_id );
- $lists = get_user_meta( $user_id, 'activecampaign_lists', true );
- if(!empty($lists)) {
- foreach((array)$lists as $list_id) {
- $data['p[' . $list_id . ']'] = $list_id;
- }
- } else {
- // In case contact has no lists, assume the first list
- $data['p[1]'] = 1;
- }
- $data['id'] = $contact_id;
- $result = $this->app->api( 'contact/edit', $data );
- if( $result->success == 1 ) {
- return true;
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement