I aim to toggle the status number in the contacts table in the contact_status_id
field each time a link containing the id of the contact is clicked. The page shows no errors, but the action does not change the number. There is no validation implemented yet.
Perhaps a set of fresh eyes can spot a problem?
function inbox_toggle_number_status($id=null)
{
//Call from the inbox when the number is clicked and status toggled.
$this->User->Contact->id = $id;
if (!empty($id))
{
$current_status = $this->User->Contact->find('first', array('conditions' => array('id' => $id)));
if ($current_status['Contact']['contact_status_id'] == '1'):
$this->User->Contact->saveField('contact_status_id', '2');
exit();
elseif ($current_status['Contact']['contact_status_id'] == '2'):
$this->User->Contact->saveField('contact_status_id', '3');
exit();
elseif ($current_status['Contact']['contact_status_id'] == '3'):
$this->User->Contact->saveField('contact_status_id', '2');
exit();
else:
exit();
endif;
}
}