I want to extend weblink to do a lot of things. I have many sites that do reciprocal linking and would like to integrate this into Drupal. (Checking if their site links back, other options, etc.)

I tried to add a checkbox to the form to add the OPTION of tracking clicks

  $output .= form_checkbox(t("Track clicks?"), "track_clicks", 1, ($node->track_clicks ? $node->track_clicks : 1), t("Should we track clicks?") . ($error['track_clicks'] ? $error['track_clicks'] : ''));

and added track_clicks to the weblinks table and the update/insert code

function weblink_insert($node) {
  $lid = db_next_id('weblinks_lid');
  db_query("INSERT INTO {weblinks_node} (lid, nid) VALUES ('%d', '%d')", $lid, $node->nid);
  db_query("INSERT INTO {weblinks} (lid, url, url_md5, track_clicks) VALUES ('%d', '%s', '%s', '%d')", $lid, $node->url, md5($node->url), $node->track_clicks);
}

function weblink_update($node) {
  db_query("UPDATE {weblinks} SET url = '%s', url_md5 = '%s', track_clicks = '%d' WHERE lid = '%d'", $node->url, md5($node->url), $node->track_clicks, $node->lid);
}

but now links won't save the Link URL data! Did I do something wrong? I just need a little help to get started contributing then I'll have some good mods going.

Comments

Bèr Kessels’s picture

First of all: this does not belong in the weblinks module. sorry. Please consider adding a new module, one that tightly integrates with weblinks.
We are about to release a complete bundle of all sorts of weblinks related modulmes. if you module is good enoug, it will be included.

And secondly: the weblinks database does not have colunm track_clicks, so it cannot be stored the way you want.

Bèr Kessels’s picture