public function on_after_post($values)
 {
     $values = parent::on_after_save($values);
     $data = $this->normalized_save_data;
     if (isset($data['other_perms']) and is_array($data['other_perms']) and !empty($values['name'])) {
         $module = $values['name'];
         $CI =& get_instance();
         $other_perms = $CI->fuel->permissions->create_simple_module_permissions($module, $data['other_perms']);
         $users = $CI->input->post('users');
         if (!empty($users)) {
             // get the IDS of the other perms
             $perm_ids = array();
             foreach ($other_perms as $op) {
                 $perm = $this->find_one_array(array('name' => $op['name']));
                 $perm_ids[] = $perm['id'];
             }
             // now associate the other users to those perms
             $CI->load->module_model(FUEL_FOLDER, 'fuel_users_model');
             foreach ($users as $user_id) {
                 $user = $CI->fuel_users_model->find_by_key($user_id);
                 if (isset($user->id)) {
                     $model = $user->get_permissions(TRUE);
                     $user_perms = $model->find_all_array_assoc('id');
                     $user_perm_ids = array_keys($user_perms);
                     $user->permissions = array_merge($user_perm_ids, $perm_ids);
                     $user->save();
                 }
             }
         }
     }
     return $values;
 }
 /**
  * Model hook executed right after saving
  *
  * @access	public
  * @param	array The values that were just saved
  * @return	array Returns the values that were saved
  */
 public function on_after_save($values)
 {
     parent::on_after_save($values);
     $CI =& get_instance();
     $user = $CI->fuel->auth->user_data();
     // reset session information...
     if (isset($values['id'], $user['id']) and $values['id'] == $user['id']) {
         // if (!empty($values['password']))
         // {
         // 	$CI->fuel->auth->set_user_data('password', $values['password']);
         // }
         if (!empty($values['language'])) {
             $CI->fuel->auth->set_user_data('language', $values['language']);
         }
     }
     if (!empty($this->normalized_save_data['new_password'])) {
         $this->fuel->logs->write(lang('auth_log_cms_pass_reset', $values['user_name'], $this->input->ip_address()), 'debug');
     }
     $this->_send_email($values['id']);
     return $values;
 }
 public function on_after_save($values)
 {
     parent::on_after_save($values);
     return $values;
 }
Example #4
0
 function on_after_save($values)
 {
     // if no category is selected, then we set it to the Uncategorized
     $saved_data = $this->normalized_save_data;
     if (empty($saved_data['categories'])) {
         $this->normalized_save_data['categories'] = array(1);
     }
     $values = parent::on_after_save($values);
     $CI =& get_instance();
     // remove cache
     $CI->fuel->blog->remove_cache();
     return $values;
 }