Last active
December 18, 2015 16:09
-
-
Save objectivehtml/5809638 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->EE->load->driver('channel_data'); | |
$entries = $this->EE->channel_data->get_channel_entries($channel_id); | |
foreach($entries->row() as $row) | |
{ | |
$member = $this->EE->channel_data->get_member_entries($row->author_id); | |
$data_map = array( | |
'landscapes_1' => array( | |
'your_member_field_1' => 'some value 1', | |
'your_member_field_2' => 'some value 2', | |
'your_member_field_3' => 'some value 3', | |
'your_member_field_4' => 'some value 4' | |
), | |
'landscapes_2' => array( | |
'your_member_field_1' => 'some value 1', | |
'your_member_field_2' => 'some value 2', | |
'your_member_field_3' => 'some value 3', | |
'your_member_field_4' => 'some value 4' | |
) | |
); | |
$post_data = array(); | |
foreach($fields as $field => $data) | |
{ | |
$field_data = array(); | |
foreach($data as $index => $value) | |
{ | |
if($member->row($index) == 'Yes') | |
{ | |
$field_data[] = $value; | |
} | |
} | |
$field = $this->EE->channel_data->get_field_by_name($field); | |
if($field->num_rows() > 0) | |
{ | |
$post_data['field_id_'.$field->field_id] = implode('|', $field_data); | |
} | |
} | |
$this->EE->db->where('entry_id' => $row->entry_id); | |
$this->EE->db->update('channel_data', $post_data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment