See #1292118: no digests
Activity log digest module just doesn't seem to be doing anything.

Comments

ezra-g’s picture

Title: Does anybody have Activity Log Digests working? » Email digests not being sent
Category: support » bug
Priority: Normal » Major

I'm seeing the same thing on an intranet site with >100 users where nobody has received email digests since we updated from Beta1 to 2.0 of Commons.

ezra-g’s picture

I experienced a problem like this which I started troubleshooting with some wacky patches at #1257754: Users not subscribed to digest unless they submit digest settings form. However, some Commons contributed modules are ouf of sync from Drupal.org, so we should address that before extensive troubleshooting.

lightsurge’s picture

I'm now seeing this error message on every cron run which might reflect the issue:

mysqli_fetch_object() expects parameter 1 to be mysqli_result, object given in /includes/database.mysqli.inc on line 150.

However I can't find any record of digests.module calling this function. But having said that looking at the code gives me a bit of a headache.

I can't find any way to see these activity logs that Rules creates. Disappointing if the only way you can see if it's doing its job right is directly in your database.

Edit: Think I'm misunderstanding how digests and rules work after noticing that it's digests that creates the tables.

lightsurge’s picture

Ok I see now, digests.cron.inc must be calling a dodgy db_fetch_object somewhere or other... although if this is the best error message we can get, could be pretty much anywhere really ;-)

lightsurge’s picture

I hope somebody else posts here and says whether or not they have activity log digests working. Apart from server differences the only real difference between a vanilla installation of Commons I'm using is that I'm using a private file system.

lightsurge’s picture

I've been troubleshooting this and it would seem that the Rules in place to save activity in email digests don't seem to be working...

The only activity it seems to be recording is users joining groups... To test, just edit the activities view, change Activity Log: Display Type to email digests.

Also if you then pass an argument it filters out everything but activity initiated by that user, so that user/1 just shows details of the groups user 1 has joined.

I also notice this in the user profile:

Enable or disable the types of activity you would like to see when you view your activity stream.
 Joining a group
 New user relationships

If these are the only 'types' of activity allowed on the email digest display type, this might explain why there's nothing else in there.

I suppose this shouldn't necessarily explain why we're not getting digests, I suppose it should mean we'd be getting a daily digest with just details of the groups we ourselves join...

lightsurge’s picture

I'm having fun and games with this today... So, I tried regenerating activity log data. This turned everything around, suddenly all the stream logs showed were people joining groups, but the email logs showed all the right information... So I though AHAH, it must be the rule weightings... So I changed all the Email rule weightings to 1, and streams to 0.

Regenerated, and behold, it's back the way it was, with the stream showing properly and the email stream just showing groups!

For some reason Rules just stubbornly refuses to save the information in both logs, except for group joining. It's one or the other - and I don't know why :-S

The next thing to try obviously is to add another action to the stream rules, rather than have cloned rules... I'm not sure whether to try this or if something is broken and I should just calm down and wait!

lightsurge’s picture

I did try merging the email actions into the stream rules, but this didn't work either.

I also tried simply disabling all the email rules to see what would happen when I regenerated the logs, and bizarrely the email digest logs still displayed the 'User join group' messages...

If you disable all the stream rules and regenerate activity, then again the email digest logs are fine, and same as above the stream logs aren't empty, they still contain the 'User joined group' messsages.

lightsurge’s picture

There's a fix at #1292118: no digests which looks to have sorted the problem with the activity log Rules, and therefore hopefully the problem with digests (can't confirm yet).

lightsurge’s picture

It looks like this is still an issue... unless @ezra-g has had any digests since the rule was fixed?

lightsurge’s picture

#1292118: no digests

Just as an update, I'm now seeing digests sending out some information... but only to 2 (out of 50) users (despite all new content being in one group which all are members of)... and the odd behaviour gets even odder, it only sends out information belonging to the receiving user, i.e., it tells the user what they did yesterday, but nothing about what other people are doing.

So user A sees all the group status updates, nodes etc that they've submitted to a group, as well as all groups they've recently joined, but nothing of other users.

At this point for me I think digests has to go off, if digests starts sending out this meaningless information to other users, they're going to switch it off before it shows its usefulness. A great little newsletter module, shame it's not working, for intranet sites it's crucial I think because people won't bother logging in unless they know there's new relevant material on there for them to see.

frifoles’s picture

I'm also experiencing this issue on my Commons site. I don't get any cron job errors when executed manually or via poormanscron.

I'm still using the same Activity Log Email Digests module packaged with Commons 2.0.

@lightsurge, any luck getting digests to properly work on Commons?

lightsurge’s picture

@frifoles
Not at all... taking advice from #1257754: Users not subscribed to digest unless they submit digest settings form and updating to dev version of digests http://drupal.org/node/1292118#comment-5053584 my users still weren't getting (sensible) digests.

I do now have digests, but not with the digests module, instead I

  • manually patched against the latest 1.x branch of simplenews using the advice here #700308: Allow separate theming of each individual outgoing email instead of caching the prepared newsletter
  • cloned the activity stream view with filters to reduce streams to activity 'yesterday', and make the view empty if no argument
  • edited the simplenews 1.x email body theme template to impersonate the receiving user (using $account-mail given by above patch to get the uid for the receiving user through user_load) and following advice from http://drupal.org/node/218104
  • use views_embed_view to embed the cloned 'user' stream in the email body theme with $user->uid argument, as well as using the $user object to add other information to the template including name
  • because I'm using a private file system, implemented a hook_views_post_render to elimate img tags from the view
  • added a tag to the view if it was empty
  • modified simplenews.module so that it used above tag to not send out an empty email or attempt to re-spool it
  • installed latest 1.x branch simplenews scheduler
  • created newsletters based on Daily (but this setup could be adapted to also include weekly/monthly newsletters
  • installed http://drupal.org/project/simplenews_register to allow users to choose a newsletter on register
  • uninstalled digest module

I'm actually finding although this method is probably much more cpu-intensive (in terms of simplenews at least), even with my test user-base of >50 users I'm only seeing a few seconds to process all emails which I'm okay with. And I'm getting beautiful digests at last, so I'm happy, and my user-base get emailed there's new content to see, as I promised!

This will do me until the digests module is fixed.

lightsurge’s picture

@ezra-g
I'm not convinced this will be solved as part of #1256076: Activity Stream modules are out of sync with Drupal.org

omissis’s picture

Hi, is there any news about this issue? It looks like I ran into the same issue.
Thank you in advance

icecreamyou’s picture

Status: Active » Needs review

I believe this commit should fix it. Can anyone confirm? Obviously this is kind of difficult to test, but this fix gets rid of an error that stops the "send" loop from running.

ezra-g’s picture

Thanks, @IceCreamYou! I can integrate this commit into the Commons Drush make file and publish a development release of Commons this week, and test that on an actively used intranet site to see if that fixes things.

omissis’s picture

Hi, thank you! I'm going to try that patch now and report :)

omissis’s picture

well appearently it doesn't fix the problem: $messages is empty, therefore the foreach loop is stepped over and -i suppose- email ain't sent out.

As you can see from message log, the actions for "Emai: Log activity when a user sends a status message" are executed:

Status message sent
0 ms "User saves a status" has been invoked.
0.117 ms Executing the rule "Log activity when a user sends a status message" on rule set "User saves a status"
0.303 ms Condition "Status was posted as private" evaluated to FALSE.
0.453 ms Condition "User updated their own status" evaluated to FALSE.
3.971 ms Action execution: "Log activity for the recipient and @mentioned users"
87.496 ms Action execution: "Log activity for the acting user"
114.702 ms Action execution: "Log activity for members of the active group"
116.905 ms Action execution: "Show a configurable message on the site"
117.017 ms Executing the rule "Cross post on wall" on rule set "User saves a status"
117.112 ms Executing the rule "Log activity when a user saves a personal status update" on rule set "User saves a status"
117.251 ms Condition "User updated their own status" evaluated to FALSE.
117.315 ms Executing the rule "Log activity when a user sends a private message" on rule set "User saves a status"
117.443 ms Condition "Status was posted as private" evaluated to FALSE.
117.505 ms Executing the rule "Email: Log activity when a user saves a personal status update" on rule set "User saves a status"
117.633 ms Condition "User updated their own status" evaluated to FALSE.
117.695 ms Executing the rule "Email: Log activity when a user sends a private message" on rule set "User saves a status"
117.824 ms Condition "User updated their own status" evaluated to FALSE.
117.936 ms Condition "Status was posted as private" evaluated to FALSE.
117.998 ms Executing the rule "Email: Log activity when a user sends a status message" on rule set "User saves a status"
118.127 ms Condition "User updated their own status" evaluated to FALSE.
118.238 ms Condition "Status was posted as private" evaluated to FALSE.
120.83 ms Action execution: "Log activity for the recipient and @mentioned users"
137.69 ms Action execution: "Log activity for the acting user"
152.448 ms Action execution: "Log activity for members of the active group"

154.547 ms Evaluation of "User saves a status" has been finished.

lightsurge’s picture

@omissis did you test this in combination with the patch at #1259944: Add a "send digest emails now" button which enables you to trigger the message send process? Otherwise, digests might think it's already sent messages out. (also note that IceCreamYou mentioned the latest dev version of Activity Logs could cause issues with tokens, but if not using dev you will still need the fix to Activity Logs at http://drupal.org/node/1292118#comment-5053584 as part of getting the email Rules working....)

omissis’s picture

uhm I see, no I haven't used those patches, I'll take a look thank you :)

icecreamyou’s picture

As lightsurge noted, you probably just didn't have any activity to send. During cron, digests looks for activity from the previous day, so any activity you generated today wouldn't be sent in a digest. If you apply the patch in #1259944: Add a "send digest emails now" button, you can test that you're getting emails by sending messages that include the current day's activity, although that doesn't really help determine whether this issue is fixed. :-) And of course you should be using the dev versions of both Activity Log and Digests to test.

lightsurge’s picture

I'm not in a position to test this.. but, as a potential alternative that would also add additional newsletter features to Commons, there's some interesting developments going on at simplenews, if they could be backported:

http://drupal.org/node/700308#comment-5363988

I've been using a patched version of simplenews to send out activity log digests for a while, the advantage is it gives you much more flexibility over your digests' look and additional content.

Enideo’s picture

Just to say the patch at #16 worked for me on Drupal Commons 2.x

icecreamyou’s picture

Status: Needs review » Fixed

In that case let's mark this fixed. My test sites are local and not running cron but when I force Digests to run it does seem to send correctly.

frifoles’s picture

@Enideo, did you apply any other patches and/or upgrade any of the existing contrib modules (Activity Log, Digests, etc.)?

I applied the patch myself, so I'll just have to wait and see tomorrow.

Enideo’s picture

Status: Fixed » Active

Oh hi, sorry for the delay, not on drupal.org every day.

I have applied the following patches to the same version used by commons (6.x-beta1):
table prefixes #1273288: Activity stream incompatible with table prefixes
FBSS + Activity Log problem #1338586: FBSS + Activity Log problem
empty statuses #1297902: Blank or default text for status updates showing as template code in stream
and regenerating for og #1344950: Regenerating activity messages does not remove old entries for users joining an organic group
(I tried the 6.x-dev version before but got lots of tokens errors so reverted back and used patches..)

Unfortunately, the email digests only worked for the first day, and may have been missing some items.
Nothing in my logs to report.
If you want me to add lines for watchdog please say.
For now (for me) this isn't an urgent issue although this function would be nice.

Thanks

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)

Are you still having this issue on a fresh install or update to the latest Commons nightly dev snapshot?

Enideo’s picture

I'm afraid I cannot say myself. My site is currently in beta, has over a hundred active users and is for a paying client. As it's fairly customised, I can't risk the update to a dev version in case of module version conflicts.
For now, I don't even have a staging solution in place for these kind of trials..

Would love to know if anyone could confirm the dev version works for them! Can also provide more details about my setup if that would help

Enideo’s picture

Version: » 6.x-2.4
Status: Postponed (maintainer needs more info) » Fixed

After updating to 2.6, this issue has been resolved for my site.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.