It would be good if the Mollom module provided it's own little block that showed it's statistics and could help improve the visibility of the Mollom service. The Mollom stats module does a lot of this, but it adds its own token replacement. I think it would be good to add a basic
Mollom block and only if the user has token installed (which is a good chunk of sites), be able to edit the text of the block.

CommentFileSizeAuthor
#8 localhost_1244598094991.png53.71 KBDave Reid
#8 423918-block.patch7.14 KBDave Reid
#4 comment-count-block.png4.6 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Garrett Albright’s picture

Hi. Creator of Mollom Stats here.

No objections from my direction. Feel free to steal the code outright if so inclined. It would be nice to see the list of modules I'm maintaining actually shrink for once…

Anonymous’s picture

Since Mollom is free for up to 100 posts per day, it would be nice to have a block for admins where they can easily monitor how many posts Mollom has processed and how much credit is left. Right now I'm querying the database for the number of posts in the last 24 hrs and displaying the result in a custom block for admins. Needless to say, our number might not be exactly the same as your in-house statistics and we might get into trouble in the 90+ zone.

Dries’s picture

The Mollom graph should provide you these statistics ... ?

Anonymous’s picture

FileSize
4.6 KB

Right now it's June 3rd 3:50 p.m. CET. On the sites that I manage the last dot on the Mollom graph is June 2nd.

Moreover, it's a little hard to monitor a site by having to go to the Mollom page and hover over the graph with the mouse. I need the number printed in really BIG letters for the admins so they can't miss it. See the enclosed image. (I guess we'd better stop fooling around and finally take out a paid subscription... :)

Garrett Albright’s picture

Edith, this is really off the topic of this issue, but…

There are calls in the API to get the number of accepted and rejected posts for "yesterday" and "today," so coding a block to do what you're asking should be fairly simple. There's a few things I'm not sure of, though - if a post is rejected initially but the user then successfully fills out the captcha, does that count as both an accepted and a rejected post, or just an accepted one? Does it count as two points against your 100-point limit, or just one? Also, by whose time zone are "yesterday" and "today" calculated? - so there's no solid indication as to what the numbers really mean… but numbers are there. If you have a programmer, have them look at the API guide and perhaps also peek at MolStats' code for inspiration. If you don't have a programmer, perhaps consider contacting the brilliant yet humble creator of MolStats by email and perhaps a deal can be worked out.

…Though if you're going to pay anything, it would probably be best to just pay for a premium Mollom account…

Dries’s picture

Mollom uses 'sessions'. As a result, if a post is rejected initially but the user then successfully fills out the captcha, that counts as 1 accepted and 0 rejected.

Anonymous’s picture

Edith, this is really off the topic of this issue,

Erm, yes. The two blocks would serve completely different purposes. Created a new issue for my feature request: #482252: Add a block for Mollom Free users to show available remaining legitimate posts

Dave Reid’s picture

Status: Active » Needs review
FileSize
7.14 KB
53.71 KB

Here's my first (rough) attempt at a basic stats block. It'll take a little bit of polish with some of the internal functions, but it works. Also attaching a screenshot of the block.

Garrett Albright’s picture

The patch seems to include some other stuff in it. I also notice that it makes seven queries against Mollom's servers up to every five minutes, whereas mine made two every 24 hours… I think you ought at least to make it so it only makes the queries if a stats block is visible. As it is, every Drupal Mollom installation in the world is going to be making those queries whether they're showing the block or not.

Dave Reid’s picture

There's not anything extra besides some extra trailing spaces that my IDE auto-corrected. Everything else is essential to the patch.

That is a good point about fetching stats every 5 minutes (to be fair, I did admit it's rough at this point!). :) Maybe it should be a configurable interval with sane limits. I also have taken a re-look over the Molstats code and don't see how the stats are not fetched during cron if the block is not enabled. Not sure how that cron workflow would go exactly.

Garrett Albright’s picture

I also have taken a re-look over the Molstats code and don't see how the stats are not fetched during cron if the block is not enabled.

Well, I didn't say MolStats did that. In theory, if someone's not using MolStats, they just disable the whole darn module, or not install it in the first place. But that's not an option if you're adding this feature to the Mollom module as a whole.

Perhaps instead of checking to see if the block is in use, it would be easier just to have a check box on the Mollom config page which, when checked, enables the stat fetching as well as makes the block appear on the block listing page.

Dries’s picture

Some feedback:

1. Instead of calling + if (_mollom_verify_key(FALSE)) {, I'd just check whether Mollom keys have been configured. It is not practical to wrap every outbound call to Mollom in a _mollom_verify_key. That wouldn't scale. This would also allow us to remove the $show_message = TRUE parameter from _mollom_verify_key().

2. I wouldn't make the refresh interval configurable. Let's just pick a sane default; e.g. every 2 hours?

3. last @total_days. should be last @total_days days?

4. Instead of showing + $block = '<p>' . t('Error contacting Mollom servers for statistics.') . '</p>';, I'd simply hide the block?

5. It seems like we're retrieving more statistics than we're using.

Dries’s picture

Status: Needs review » Needs work
Dave Reid’s picture

I cleaned up the coding fixes separately and also committed the statistics-fetching API in #536144: Add a mollom_get_statistics() to fetch API statistics which will fetch at a no more frequently that 60 minutes. Seems pretty reasonable considering some site admins may want to keep tabs on the number of ham messages on a free subscription.

dag-’s picture

I'd vote for having Mollom stats block in Mollom as well. I have been using Mollom Stats (molstats) now for a long time and it's a clever way of promoting Mollom as well as shows the advantages of Mollom.

I looked at the screenshot and I would prefer not having a button in the block, or at least make it optional. I personally prefer to keep my blog free from too much 'distractions'. A link to Mollom (like in molstats) I would prefer most.

Nevertheless, thanks for making my life easier :-)

fizk’s picture

What is the current status of this issue?