Closed (fixed)
Project:
Flag Weights
Version:
6.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jun 2009 at 02:13 UTC
Updated:
9 Sep 2009 at 10:50 UTC
In flag_weights_set_flag it says $handlers instead of $handler when calling flag_weights_set_weight ( $handlers->content_type). Can't see anywhere else where $handlers is used; if this is related to how the module is used, then close this but I can't imagine how that ever worked.
In related (aka how I noticed the typo) popped out this function to flag/weight using an existing flag. (The flag using content type never worked for me btw, don't currently really see the purpose of it).
function flag_weights_set_flag_with_flag($flag_name, $content_id, $account = NULL, $weight = 0) {
$handler = flag_get_flag($flag_name) ;
$ok = $handler->flag('flag', $content_id, $account);
if ($ok && $weight != 0) {
if (!isset($account)) {
$account = $GLOBALS['user'];
}
flag_weights_set_weight($handler->fid, $handler->content_type, $content_id, $account->uid, $weight);
}
return $ok;
}
Comments
Comment #1
avpadernoComment #2
markus_petrux commentedPlease, let me know if you wish a proper patch for this.
Comment #3
lyricnz commentedApplied the handler/handlers patch to -dev.
Will consider the new function another day (setting back to "needs review"). Thanks!
Comment #4
lyricnz commentedCommitted a new method as described above. Agree that flagging by flag-name makes more sense than by content-type, but changing the API now would break anyone who is using it, in unexpected ways.
http://drupal.org/cvs?commit=256248