long story short, the two forward tables got deleted so I had to manually rebuild them which I did, using forward.install info. They seem to be working fine and I'm not getting any sql errors when I forward a node.

When I go to the forward tracking page, the list of nodes that have been sent, by who, to who, etc is all correct but the line at the top reads: 120 emails sent to 131 recipients when it should be 1 and 1. Where is this info coming from and why would it be wrong given that both forward_log and forward_statistics table are virtually empty? I ran cron but to no avail.

on another issue...why is forward_statistics empty after I've forwarded a node? When does it get data put into it?

Comments

seanr’s picture

The totals are stored in a system variable. As for the statistics table, that should not be empty. Can you check your log for error messages? Administer->Logs->Recent log entries

esllou’s picture

I just forwarded a forum page and the mail arrived fine, the count went up to 121/132 on the forward tracking page and the time, path, type and title got added to on that page too. forward_statistics stayed empty (MySQL returned an empty result set (i.e. zero rows). (Query took 0.0003 sec)) and there were no error messages in the logs at all.

Is there no way for me to get that tracker page count correct?

esllou’s picture

I just activated a couple of the blocks and got horrible sql errors, so there is definitely something wrong with how I created that forward_statistics table. Here is the sql dump of it:

CREATE TABLE `dru_forward_statistics` (
  `nid` int(10) unsigned NOT NULL,
  `last_forward_timestamp` int(11) NOT NULL default '0',
  `forward_count` int(10) unsigned NOT NULL default '0',
  `clickthrough_count` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`nid`),
  KEY `last_forward_timestamp` (`last_forward_timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

anything look amiss?

I pasted the following sql to create it:

CREATE TABLE dru_forward_statistics (
        nid int(10) unsigned NOT NULL,
        last_forward_timestamp int(11) NOT NULL default '0',
        forward_count int(10) unsigned NOT NULL default '0',
        clickthrough_count int(10) unsigned NOT NULL default '0',
        PRIMARY KEY (nid),
        KEY (last_forward_timestamp)
      );

and nothing else. I think I'm going to have to drop both tables again and start from scratch although I don't see where I went wrong to start with. :-(

esllou’s picture

I ran this sql to build up the forward_statistics table:

INSERT INTO {forward_statistics} (nid, last_forward_timestamp, forward_count, clickthrough_count) SELECT n.nid, 0, 0, 0 FROM {node} n

now when I forward something, both forward_log and forward_statistics tables are seemingly getting updated ok. The problems are now:

1. When I activate the forward related blocks, I get:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC LIMIT 0, 5' at line 1 query: SELECT DISTINCT(node.nid), active, node.title AS node_title, node.changed AS node_changed, forward_statistics.clickthrough_count AS forward_statistics_clickthrough_count, forward_statistics.forward_count AS forward_statistics_forward_count FROM dru_node node LEFT JOIN dru_forward_statistics forward_statistics ON node.nid = forward_statistics.nid ORDER BY DESC LIMIT 0, 5 in /home/mysite/public_html/includes/database.mysql.inc on line 172.

2. When I click on a link in an e-mail I've been sent using the Forward module, I get:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC LIMIT 0, 5' at line 1 query: SELECT DISTINCT(node.nid), active, node.title AS node_title, node.changed AS node_changed, forward_statistics.clickthrough_count AS forward_statistics_clickthrough_count, forward_statistics.forward_count AS forward_statistics_forward_count FROM dru_node node LEFT JOIN dru_forward_statistics forward_statistics ON node.nid = forward_statistics.nid ORDER BY DESC LIMIT 0, 5 in /home/mysite/public_html/includes/database.mysql.inc on line 172.

At this point, I think the best thing is to start from scratch...how on earth do I force forward.install to be used. When I got into this difficulty, I deleted all the module files AND deleted both db tables, forward_log and forward_statistics. Yet, when I uploaded the module again and activated it, forward.install didn't run and there were no tables added to the db. Is there something, some flag, elsewhere on the db that tells the system the tables have already been created and there's no need to do it again?? If so, how do I switch it off/delete a value to allow forward.install to run again? Thanks.

esllou’s picture

OK, I managed to reinstall Forward and run the .install file again so everything's looking fine.

Any way I can alter those erroneous forward tracking totals:

>> The totals are stored in a system variable.

??

seanr’s picture

Status: Active » Closed (fixed)

The SQL errors you listed in #4 were a broken view (Most Active Posts, now deleted because it can't be done currently in views). Update Forward (use 5.x-dev as I haven't made a release yet) and delete that view if you've added/enabled it, and you should no longer see any errors. If you still see them after doing so, please create a new issue.

As for your last question, Drupal stores some items, like module settings, in a table in the database called variables. That is what I was using to track the total number of emails sent and number of recipients. The easiest way to reset them right now is using a PHP page (paste the below into a node with the input format set to PHP and hit preview) or using the devel module's Execute PHP block with this code:

variable_set('forward_total', 0);
variable_set('forward_recipients', 0);
esllou’s picture

thanks a lot Sean. I'll make sure I update to the latest version of Forward and get those stats re-zeroed.