function commons_poll_add_flag in Drupal Commons 6.2
Add the bookmark flag to poll nodes
1 call to commons_poll_add_flag()
- commons_poll_install in modules/
features/ commons_poll/ commons_poll.install - Implementation of hook_install()
File
- modules/
features/ commons_poll/ commons_poll.install, line 14
Code
function commons_poll_add_flag() {
$fid = db_result(db_query("SELECT fid FROM {flags} WHERE name = '%s'", 'bookmarks'));
if ($fid) {
$check_sql = "SELECT fid FROM {flag_types} WHERE type = 'poll' AND fid = %d";
if (!db_result(db_query($check_sql, $fid))) {
$flag = new stdClass();
$flag->fid = $fid;
$flag->type = 'poll';
drupal_write_record('flag_types', $flag);
}
}
}