field[$field_name]->table != 'flag_content') { drupal_set_message(t("This handler cannot be applied to this field - use Weight!")); } // TODO: much more checking - relationship, types, fields etc, ***CURRENT_USER*** $this->field = $view->field[$field_name]; $relationship = $view->relationship['flag_content_rel']; $this->flag_id = $relationship->definition['extra'][0]['value']; $this->flag = flag_get_flag($relationship->options['flag']); } function save($nid, $value) { global $user; // assume $extra['uid] = '***CURRENT_USER***' // For global flags, use uid 0 $uid = $this->flag->global ? 0 : $user->uid; flag_weights_set_weight($this->flag_id, $this->flag->content_type, $nid, $uid, $value); } }