Username Password
Bookmark and Share

Come back already!

Add this Workflow Activity to your site to make WebGUI beg users to come back and re-visit your site. File under ACME::EvilInventions.

View a screenshot here

Sends custom emails to users on your site who haven't logged in for a certain number of days. You can configure:

  • Which group of users to check for inactivity (choosing Registered Users will include everyone on your site)
  • How many days of not logging in will trigger an email
  • The email subject and message (using the Rich Text Editor of course)

So that you don't annoy users too much only a single email is sent to a user when their inactive streak reaches the specified number of days. If they blatantly ignore your email and don't log back in we don't send them any more emails (unless of course you set up a 3 day activity, a 4 day activity, a 5 day act.. did I say that?)


Follow the standard workflow activity installation procedure, namely:

  1. Copy the activity ( to /data/WebGUI/lib/WebGUI/Workflow/Activity/
  2. Add "WebGUI::Workflow::Activity::SdhInactivityReminder" to the "workflowActivities"-> "None" section of your webgui site config file (be careful with commas when adding to the "workflowActivities" list)
  3. Restart webgui

And then add the activity to one of the workflows on your site:

  1. Create a new Workflow or select an existing workflow (Daily Maintenance Tasks is probably the most logical one to use)
  2. Add the new Activity you will see in the list (titled SdhInactivityReminder) to your Workflow
  3. Customise your email subject & message, group to process and number of days
  4. Wait for the activity to run, or if you're impatient use the Scheduler to trigger an immediate run.

TIP: If you set your log-level to INFO instead of WARN (in /data/etc/log.conf) you'll be able to see proof that users in the group you selected are being spammed ;)


This code was developed using TestDrivenDevelopment, hence the presence of a test file. The tests create a dummy workflow, an instance of this activity, and a test user with some fake login entries, and then triggers the activity with different parameter combinations, checking that emails are sent/not sent correctly (any emails that are sent are pulled back out of the emailQueue before they can be really sent). For want of a better place, I keep this file in /data/WebGUI/t/Asset/Wobject/ (WebGUI core doesn't have a subfolder for Workflow Activity tests yet). If you want to run the tests, create a batch file called webgui-test along the lines of:

 export WEBGUI_CONFIG=/data/WebGUI/etc/myconfigfile.conf
 cd /data/WebGUI/t
 echo "Checking syntax:"
 /data/wre/prereqs/perl/bin/perl -c Asset/Wobject/$1.t && echo && echo "Running Tests:" &&  /data/wre/prereqs/perl/bin/prove $2 Asset/Wobject/$1.t $3

And run the tests with the command:

 ./webgui-test SdhInactivityReminder -v

You should see the following output:

Checking syntax:
Asset/Wobject/SdhInactivityReminder.t syntax OK

Running Tests:
# Create test workflow and activity
ok 1 - Create workflow
ok 2 - The object isa WebGUI::Workflow
ok 3 - use WebGUI::Workflow::Activity::SdhInactivityReminder;
ok 4 - Create activity
ok 5 - The object isa WebGUI::Workflow::Activity::SdhInactivityReminder
ok 6 - Activity has an ID
ok 7 - Workflow has one activity
# Create test user, last login 4 days ago
ok 8 - The object isa WebGUI::User
# Set to remind after 3 days
ok 9 - Email handled correctly (expectEmail=0)
# Set to remind after 4 days
ok 10 - Email handled correctly (expectEmail=1)
# Set to remind after 5 days
ok 11 - Email handled correctly (expectEmail=0)
All tests successful.
Files=1, Tests=11,  1 wallclock secs ( 0.30 cusr +  0.14 csys =  0.44 CPU)

The test file contains some of the test helper methods from my Wg automated testing library (which lets you do things like test wobjects by simulating a user clicking through your site, filling out fields etc..). I've only included methods such as addUser, addWorkflow and addActivity. The entire library will hopefully be cleaned up and released at some point.

--Patrick (patspam) 

System Requirements

Please be advised: this contribution was tested with something older than WebGUI 7.5. When this contribution was uploaded there was no field for the author to fill out regarding it's requirements.

4koen: "Does this work with WebGUI 7.5?"
3patspam: "Should do, but I haven't upgraded the site that's using it yet.. will report back when I eventually upgrade it!"
No Support Offered
Statistics Downloads: 840
Views: 5325
Rating: 4
Updated: 9/5/2008
Keywords acme
NavigationMore from patspam
Back to the Bazaar
© 2022 Plain Black Corporation | All Rights Reserved