Index: flag_content.install =================================================================== --- flag_content.install (revision 1254) +++ flag_content.install (working copy) @@ -5,7 +5,7 @@ */ function flag_content_install() { - drupal_install_schema('flag_content'); + drupal_install_schema('flag_content_mod'); } /** @@ -13,7 +13,7 @@ */ function flag_content_schema() { - $schema['flag_content'] = array( + $schema['flag_content_mod'] = array( 'fields' => array( 'fid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'defualt' => 0), 'eid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'defualt' => 0), @@ -31,5 +31,13 @@ * Implementation of hook_uninstall() */ function flag_content_uninstall() { - drupal_uninstall_schema('flag_content'); + drupal_uninstall_schema('flag_content_mod'); } +/** + * Rename the main table for flag module compatibility + */ +function flag_content_update_6005 () { + $ret = array(); + $ret[] = update_sql("ALTER TABLE {flag_content} RENAME TO flag_content_mod"); + return $ret; +} Index: flag_content.module =================================================================== --- flag_content.module (revision 1254) +++ flag_content.module (working copy) @@ -118,7 +118,7 @@ } $links = flag_content_link(FLAG_CONTENT_TYPE_USER, $account); - + foreach($links as $key => $value) { $class = $key; $title = $value['title']; @@ -127,14 +127,14 @@ } $account->content['summary']['flag_content'] = array( '#type' => 'user_profile_item', - '#title' => t('Flag user'), + '#title' => t('Flag user'), '#attributes' => array('class' => $class), '#value' => l($title, $href), ); - + break; case 'delete': - db_query("DELETE FROM {flag_content} WHERE eid = %d AND type = '%s'", $account->uid, FLAG_CONTENT_TYPE_USER); + db_query("DELETE FROM {flag_content_mod} WHERE eid = %d AND type = '%s'", $account->uid, FLAG_CONTENT_TYPE_USER); break; } } @@ -145,7 +145,7 @@ function flag_content_comment($a1, $op) { switch ($op) { case 'delete': - db_query("DELETE FROM {flag_content} WHERE eid = %d AND type = '%s'", $a1->cid, FLAG_CONTENT_TYPE_COMMENT); + db_query("DELETE FROM {flag_content_mod} WHERE eid = %d AND type = '%s'", $a1->cid, FLAG_CONTENT_TYPE_COMMENT); break; } } @@ -158,12 +158,12 @@ function flag_content_link($type, $entry = null, $teaser = false) { global $user; $links = array(); - + // Do not allow users to flag themselves. if ($type == FLAG_CONTENT_TYPE_USER && $entry->uid == $user->uid) { return $links; } - + if (user_access(FLAG_CONTENT_PERM_ADD)) { switch ($type) { case FLAG_CONTENT_TYPE_NODE: @@ -182,10 +182,10 @@ } break; } - + if (is_numeric($eid)) { $options = array('class' => 'flag_content'); - + if (!_flag_content_check($eid, $type)) { // Not already flagged, flag it for admin $links['flag_content_add'] = array( @@ -220,7 +220,7 @@ } } } - + return $links; } @@ -245,7 +245,7 @@ $path = "node/$comment->nid"; break; } - + $form['eid'] = array( '#type' => 'hidden', '#value' => $eid, @@ -271,7 +271,7 @@ $type = $form_state['values']['type']; if ($eid && $type) { // Insert the data into the table - db_query("INSERT INTO {flag_content} (fid, eid, uid, type, timestamp) VALUES (0, %d, %d, '%s', %d)", + db_query("INSERT INTO {flag_content_mod} (fid, eid, uid, type, timestamp) VALUES (0, %d, %d, '%s', %d)", $eid, $user->uid, $type, time()); // Prepare the data switch ($type) { @@ -437,7 +437,7 @@ switch ($entry->type) { case FLAG_CONTENT_TYPE_NODE: $node = node_load(array('nid' => $entry->eid)); - $title = l($node->title, 'node/'. $node->nid, array('title' => $node->title)); + $title = l($node->title, 'node/'. $node->nid, array('title' => $node->title)); $author = theme('username', user_load(array('uid' => $node->uid))); $item = t('!title - (author: !author)', array('!title' => $title, '!author' => $author)); $edit = "node/$entry->eid/edit"; @@ -484,21 +484,21 @@ } function _flag_content_unflag($eid, $type = FLAG_CONTENT_TYPE_NODE) { - db_query("DELETE FROM {flag_content} WHERE eid = %d AND type = '%s'", $eid, $type); + db_query("DELETE FROM {flag_content_mod} WHERE eid = %d AND type = '%s'", $eid, $type); } function _flag_content_get_list() { $rows = array(); - $result = db_query("SELECT * FROM {flag_content} ORDER BY timestamp ASC"); + $result = db_query("SELECT * FROM {flag_content_mod} ORDER BY timestamp ASC"); while ($row = db_fetch_object($result)) { $rows[$row->fid] = $row; } return $rows; } -function _flag_content_check($eid, $type = FLAG_CONTENT_TYPE_NODE) { +function _flag_content_check($eid, $type = FLAG_CONTENT_TYPE_NODE) { global $user; - return db_result(db_query("SELECT COUNT(*) FROM {flag_content} WHERE eid = %d AND type = '%s'", $eid, $type)); + return db_result(db_query("SELECT COUNT(*) FROM {flag_content_mod} WHERE eid = %d AND type = '%s'", $eid, $type)); }