Skip to content

Commit 81c4841

Browse files
committed
Merge branch 'release/3.0.0'
2 parents f4c03af + ad55c26 commit 81c4841

File tree

8 files changed

+136
-78
lines changed

8 files changed

+136
-78
lines changed

AUTHORS.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Change Log
22
All notable changes to the REDCap Warn Users of Pending Suspension project will be documented in this file.
33

4+
# warn_users_of_pending_suspension 3.0.0 (released 2026-01-05)
5+
- Make extend_suspension_time() optional (@pbchase, #26, #28)
6+
- Replace AUTHORS.md with CITATION.cff (@pbchase, #25, #27, #28)
7+
48
# warn_users_of_pending_suspension 2.0.5 (released 2025-12-12)
59
- Add VERSION (@pbchase)
610
- Do not log the event (@pbchase, #24)

CITATION.cff

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This CITATION.cff file was generated with cffinit.
2+
# Visit https://bit.ly/cffinit to generate yours today!
3+
4+
cff-version: 1.2.0
5+
title: REDCap Warn Users of Pending Suspension
6+
message:
7+
If you use this software, please cite it using the metadata
8+
in CITATIONS.cff or https://doi.org/10.5281/zenodo.3634733
9+
type: software
10+
authors:
11+
- family-names: Chase
12+
given-names: Philip B
13+
email: pbc@ufl.edu
14+
affiliation: University of Florida
15+
orcid: https://orcid.org/0000-0002-5318-9420
16+
- family-names: Chesney
17+
given-names: Kyle
18+
affiliation: University of Florida
19+
orcid: https://orcid.org/0000-0002-0479-7251
20+
- family-names: Stoffs
21+
given-names: Taryn L
22+
email: tls@ufl.edu
23+
affiliation: University of Florida
24+
orcid: https://orcid.org/0000-0002-0830-8179
25+
- family-names: Gotti
26+
given-names: Marly
27+
affiliation: Apple, Inc.
28+
- family-names: Bember
29+
given-names: Tiago
30+
affiliation: Howard Hughes Medical Institute
31+
- family-names: Barnes
32+
given-names: Christopher P
33+
email: cpb@ufl.edu
34+
affiliation: University of Florida
35+
orcid: https://orcid.org/0000-0001-7114-1992
36+
repository-code:
37+
https://github.com/ctsit/warn_users_of_pending_suspension
38+
url:
39+
https://github.com/ctsit/warn_users_of_pending_suspension
40+
abstract:
41+
A REDCap external module that will warn users of pending suspensions and provide an easy opportunity to extend the life of REDCap accounts.
42+
keywords:
43+
- redcap
44+
- "redcap repo"
45+
- "redcap external module"
46+
identifiers:
47+
- type: doi
48+
value: 10.5281/zenodo.3561122
49+
license: Apache-2.0
50+
version: 3.0.0
51+
date-released: '2026-01-05'

README.md

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@
44

55
A REDCap external module that will warn users of pending suspensions and provide an easy opportunity to extend the life of REDCap accounts.
66

7-
## Prerequisites
8-
- REDCap >= 8.0.3
7+
## Installation
8+
- Obtain this module from the Consortium [REDCap Repo](https://redcap.vumc.org/consortium/modules/index.php) from the REDCap Control Center.
99

10-
## Easy Installation
11-
- Obtain this module from the Consortium [REDCap Repo](https://redcap.vanderbilt.edu/consortium/modules/index.php) from the control center.
10+
## REDCap Requirements
1211

13-
## Manual Installation
14-
- Clone this repo into to `<redcap-root>/modules/warn_users_of_pending_suspension_v<version_number>`.
15-
- Go to **Control Center > External Modules** and enable Warn Users of Pending Suspension.
12+
Warn Users of Pending Suspension (WUPS) is dependent upon REDCap's normal _Auto-suspend users after period of inactivity_ feature being enabled. WUPS does not suspend accounts it only _warns_ of pending suspending via emails.
1613

17-
## REDCap Requirements
14+
## Breaking Change in Version 3.0.0
1815

19-
WUPS is dependent upon REDCap's normal _Auto-suspend users after period of inactivity_ feature being enabled. WUPS does not suspend accounts it only _warns_ of pending suspending via emails.
16+
If your system uses a single signon configuration that bypasses the REDCap Login page, you might need to turn on `Update user_lastlogin on main REDCap pages` in the WUPS system configuration after you upgrade to Version 3.x. See the [Updating user_lastlogin](#updating-user_lastlogin) section below.
2017

2118
## Configuration
2219

@@ -47,13 +44,23 @@ If the email address is blank in either case, emails will not be sent and the cr
4744

4845
10, 12, 20
4946

47+
## Updating user_lastlogin
48+
49+
As of version 3.0.0, WUPS no longer sets the `user_lastlogin` column in the `redcap_user_information` table by default. Sites using single signon systems that bypass the REDCap Login page, might need to set `Update user_lastlogin on main REDCap pages` in the WUPS system configuration. This option will update the `user_lastlogin` column in the `redcap_user_information` table any time a user accesses the _Home_ page or the _My Projects_ page. To determine if your system needs this feature, upgrade to WUPS 3.x, logout of REDCap, login, then run this SQL query:
50+
51+
```sql
52+
select username, user_lastlogin
53+
from redcap_user_information
54+
order by user_lastlogin desc;
55+
```
5056

57+
Your username should be near the top of the list, `user_lastlogin` should reflect the precise time of your login. If `user_lastlogin` is not updating, access the system configuration of the WUPS module and check `Update user_lastlogin on main REDCap pages`.
5158

52-
## How to Implement WUPS and Account Suspensions
59+
## How to Implement WUPS
5360

5461
Implementing WUPS and/or activating REDCap account suspensions can require some careful planning to avoid annoying your users who have not logged in recently. If you have never used account suspension on your REDCap host, activating it will cause all accounts that have not logged in within the _Period of inactivity_ to be suspended within 24 hours. If those people want their accounts reenabled they will have to ask the REDCap admin to reenable them. That generates the kind of help desk workload WUPS was designed to _prevent_.
5562

56-
To avoid the chaos of hundreds of accounts getting prematurely suspended, you can run a few SQL queries to adjust the last login dates and last activity dates for your REDCap users. Done correctly, you can use WUPS to warn these users of the pending suspension, allow interested REDCap users to renew their account, and let the rest suspend normally.
63+
To avoid the chaos of hundreds of accounts getting prematurely suspended, you can run a few SQL queries to adjust the last login dates for your REDCap users. Done correctly, you can use WUPS to warn these users of the pending suspension, allow interested REDCap users to renew their account, and let the rest suspend normally.
5764

5865
The first step is to configure WUPS' _Days Before Suspension_. In this example, we'll use `30, 15, 7, 3, 1`, but only the highest number affects our work. We've also set _Period of inactivity_ to 180 days. We want everyone who is approaching their date of suspension to receive every warning WUPS is configured to provide. To achieve that, _no one_ is allowed to be within 30 days of suspension when WUPS is turned on. This requires some accounts have their date of last login changed.
5966

@@ -82,34 +89,6 @@ With that temporary table created, it is a simple matter to change `user_lastlog
8289

8390
This will make the WUPS warnings start in 0-30 days. If the warnings are unheeded, account suspensions will happen in 30-60 days.
8491

92+
## Contributing
8593

86-
## Developer testing techniques
87-
88-
To test WUPS, you need to turn on a few REDCap features it interacts with. You need to turn on "Auto-suspend users after period of inactivity" in Control Center, User Settings. For our tests we also set "Period of inactivity" to 30 days. A lazy developer might just want to run this SQL to make that happen:
89-
90-
update redcap_config set value="all" where field_name = "suspend_users_inactive_type";
91-
update redcap_config set value="1" where field_name = "suspend_users_inactive_send_email";
92-
update redcap_config set value="30" where field_name = "suspend_users_inactive_days";
93-
94-
This module has to be configured before you can do anything with it. The instructions that follow assume the module has been configured as described in _Email Configuration Example_ above. The _Days Before Suspension_ setting of `10, 12, 20` is especially important. As this tool sends emails, also make sure the field that will be used for the **Sender Email** address is configured correctly in your module configuration.
95-
96-
You'll need some test users. Assuming you have a set of test users `alice`, `bob`, `carol`, and `dan` you can configure them to receive alerts _today_ by adjusting their `user_lastlogin` date as follows:
97-
98-
update redcap_user_information set user_lastlogin = date_add(now(), interval -10 day) where username='alice';
99-
update redcap_user_information set user_lastlogin = date_add(now(), interval -18 day) where username='bob';
100-
update redcap_user_information set user_lastlogin = date_add(now(), interval -10 day) where username='carol';
101-
update redcap_user_information set user_lastlogin = date_add(now(), interval -20 day) where username='dan';
102-
103-
If you are testing REDCap under [redcap-docker-compose](https://github.com/123andy/redcap-docker-compose), the automatic table-based user creation tools can make these users for you. If you are testing under a [redcap_deployment](https://github.com/ctsit/redcap_deployment) Vagrant VM, the above set of test users can be created via the SQL file at [https://github.com/ctsit/redcap_deployment/blob/master/deploy/files/test\_with\_table\_based\_authentication.sql](https://github.com/ctsit/redcap_deployment/blob/master/deploy/files/test_with_table_based_authentication.sql). People testing in other environments will need to design their own set of test cases.
104-
105-
To get the alerts from these test users, you'll want to update their email addresses with _your_ email address. e.g.,
106-
107-
update redcap_user_information set user_email = 'you@example.org' where username in ("alice", "bob", "carol", "dan");
108-
109-
The final step to facilitate testing is to adjust the frequency of the cron job. The external module framework monitors the cron configuration settings in a module's `config.json`. If you change the cron frequency in that file to 60 seconds, the EM framework will, shortly thereafter, do the same to the module's cron job:
110-
111-
"cron_frequency": "60",
112-
113-
Turn that value back down to `86400` (that's the number of seconds in one day) when you are done to get back to the normal configuration.
114-
115-
All of these SQL commands and more are rolled up in [developer_testing_commands.sql](developer_testing_commands.sql). Open this file in your favorite SQL tool and run the commands one section at a time to see the relevant database state.
94+
Software developers who want to contribute to WUPS should read [Developer testing techniques](./developer_testing.md)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.5
1+
3.0.0
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
<?php
22
/**
33
* @file
4-
* Provides ExternalModule class for SuspensionWarning.
4+
* Provides ExternalModule class for WarnUsersOfPendingSuspension.
55
*/
66

7-
namespace SuspensionWarning\ExternalModule;
7+
namespace UF_CTSI\WarnUsersOfPendingSuspension;
88

99
use ExternalModules\AbstractExternalModule;
1010
use REDCap;
1111
use Logging;
1212

1313
/**
14-
* ExternalModule class for SuspensionWarning.
14+
* ExternalModule class for WarnUsersOfPendingSuspension.
1515
*/
16-
class ExternalModule extends AbstractExternalModule {
16+
class WarnUsersOfPendingSuspension extends AbstractExternalModule {
1717
/**
1818
* @inheritdoc
1919
*/
20-
function redcap_every_page_top($project_id)
20+
function redcap_every_page_top($project_id = null)
2121
{
22-
$is_on_log_page = preg_match("/(redcap\/\z|\/index.php\?action=myprojects\z)/", PAGE);
22+
# Check if we are on the index page and there are no parameters
23+
# If so, extend the suspension time for the user
24+
# Otherwise, do nothing and return
25+
$is_on_index = preg_match("/index.php\z/", PAGE_FULL);
26+
$no_parameters = (count($_GET) == 0);
2327

24-
$is_on_homepage = preg_match("/\/index.php\z/", PAGE);
25-
26-
if ($is_on_log_page || $is_on_homepage) {
28+
if ($is_on_index && $no_parameters) {
2729
if(defined('USERID') && !empty(USERID)){
28-
$this->extend_suspension_time(USERID);
30+
$wups_update_user_lastlogin = $this->getSystemSetting('wups_update_user_lastlogin');
31+
if($wups_update_user_lastlogin) {
32+
$this->extend_suspension_time(USERID);
33+
}
2934
}
30-
}
35+
} else {
36+
return;
37+
}
3138
}
3239

3340
function extend_suspension_time($username='')

config.json

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
{
22
"name": "Warn Users of Pending Suspension",
3-
"namespace": "SuspensionWarning\\ExternalModule",
3+
"namespace": "UF_CTSI\\WarnUsersOfPendingSuspension",
44
"description": "A REDCap external module that will warn users of pending suspensions and provide an easy opportunity to extend the life of REDCap accounts.",
5+
56
"permissions": [
67
"redcap_every_page_top"
78
],
89
"enable-every-page-hooks-on-system-pages": true,
910
"authors": [
1011
{
11-
"name": "Philip Chase",
12-
"email": "pbc@ufl.edu",
13-
"institution": "University of Florida - CTSI"
14-
},
15-
{
16-
"name": "Taryn Stoffs",
17-
"email": "tls@ufl.edu",
18-
"institution": "University of Florida - CTSI"
19-
},
20-
{
21-
"name": "Kyle Chesney",
22-
"email": "kyle.chesney@ufl.edu",
12+
"name": "University of Florida CTS-IT",
13+
"email": "CTSIT-REDCAP-MODULE-SUPPO@LISTS.UFL.EDU",
2314
"institution": "University of Florida - CTSI"
2415
}
2516
],
2617
"system-settings" : [
18+
{
19+
"key": "wups_update_user_lastlogin",
20+
"name": "Update user_lastlogin on main REDCap pages",
21+
"required": false,
22+
"type": "checkbox",
23+
"repeatable": false
24+
},
2725
{
2826
"key": "use_wups_sender",
2927
"name": "Use Custom Email Sender",
@@ -74,9 +72,5 @@
7472
"cron_frequency": "86400",
7573
"cron_max_run_time": "1200"
7674
}
77-
],
78-
"compatibility": {
79-
"redcap-version-min": "8.0.3",
80-
"redcap-version-max": ""
81-
}
75+
]
8276
}

developer_testing.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Developer testing techniques
2+
3+
To test WUPS, you need to turn on a few REDCap features it interacts with. You need to turn on "Auto-suspend users after period of inactivity" in Control Center, User Settings. For our tests we also set "Period of inactivity" to 30 days. A lazy developer might just want to run this SQL to make that happen:
4+
5+
update redcap_config set value="all" where field_name = "suspend_users_inactive_type";
6+
update redcap_config set value="1" where field_name = "suspend_users_inactive_send_email";
7+
update redcap_config set value="30" where field_name = "suspend_users_inactive_days";
8+
9+
This module has to be configured before you can do anything with it. The instructions that follow assume the module has been configured as described in _Email Configuration Example_ above. The _Days Before Suspension_ setting of `10, 12, 20` is especially important. As this tool sends emails, also make sure the field that will be used for the **Sender Email** address is configured correctly in your module configuration.
10+
11+
You'll need some test users. Assuming you have a set of test users `alice`, `bob`, `carol`, and `dan` you can configure them to receive alerts _today_ by adjusting their `user_lastlogin` date as follows:
12+
13+
update redcap_user_information set user_lastlogin = date_add(now(), interval -10 day) where username='alice';
14+
update redcap_user_information set user_lastlogin = date_add(now(), interval -18 day) where username='bob';
15+
update redcap_user_information set user_lastlogin = date_add(now(), interval -10 day) where username='carol';
16+
update redcap_user_information set user_lastlogin = date_add(now(), interval -20 day) where username='dan';
17+
18+
If you are testing REDCap under [redcap-docker-compose](https://github.com/123andy/redcap-docker-compose), the automatic table-based user creation tools can make these users for you. If you are testing under a [redcap_deployment](https://github.com/ctsit/redcap_deployment) Vagrant VM, the above set of test users can be created via the SQL file at [https://github.com/ctsit/redcap_deployment/blob/master/deploy/files/test\_with\_table\_based\_authentication.sql](https://github.com/ctsit/redcap_deployment/blob/master/deploy/files/test_with_table_based_authentication.sql). People testing in other environments will need to design their own set of test cases.
19+
20+
To get the alerts from these test users, you'll want to update their email addresses with _your_ email address. e.g.,
21+
22+
update redcap_user_information set user_email = 'you@example.org' where username in ("alice", "bob", "carol", "dan");
23+
24+
The final step to facilitate testing is to adjust the frequency of the cron job. The external module framework monitors the cron configuration settings in a module's `config.json`. If you change the cron frequency in that file to 60 seconds, the EM framework will, shortly thereafter, do the same to the module's cron job:
25+
26+
"cron_frequency": "60",
27+
28+
Turn that value back down to `86400` (that's the number of seconds in one day) when you are done to get back to the normal configuration.
29+
30+
All of these SQL commands and more are rolled up in [developer_testing_commands.sql](developer_testing_commands.sql). Open this file in your favorite SQL tool and run the commands one section at a time to see the relevant database state.

0 commit comments

Comments
 (0)