Commit graph

152 commits

Author SHA1 Message Date
Ian Dunn 2880d80e12
Contributors: Don't send inactivity emails to banned users.
Fixes #221
2023-02-28 16:36:49 -08:00
Ian Dunn 04413b9f6c
Tests: Make test token 32 characters to match valid length 2022-09-13 11:53:26 -07:00
Ian Dunn ec8c052204
Migrate to latest set_up() methods
See https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/
2022-09-13 11:53:26 -07:00
Ian Dunn 0e88966246
Add code coverage report 2022-09-13 11:53:26 -07:00
Ian Dunn 0964167f12 Apply coding standards 2022-08-29 16:21:06 -07:00
Ian Dunn 32b738d95f Contributors: Add user data for users that don't have expected meta.
Some users don't have any of the expected meta fields. The previous commit caused them to be skipped, resulting in distorted stats.
2022-08-29 16:21:06 -07:00
Ian Dunn 5f1d091185 Stats: Add stats for the % of contributors that are active. 2022-08-29 16:21:06 -07:00
Ian Dunn 0be2f859f9 Tests: Modularize database fixtures for reuse. 2022-08-29 16:21:06 -07:00
Ian Dunn c9783a17f5 Contributors: Move user_registered check to pruning function.
That allows `add_user_data_to_xprofile()` to be reused in other contexts.

`user_login` was removed from the `SELECT` because it wasn't being used.
2022-08-29 16:21:06 -07:00
Ian Dunn 9c0d1371f3 Contributors: Apply ?? before array cast, to avoid PHP notice.
See 8c28881
2022-08-29 16:21:06 -07:00
Ian Dunn cd36902bb5 Contributors: Standardize on team_names field for consistency. 2022-08-29 16:21:06 -07:00
Ian Dunn ccad917c00 Contributors: Modularize activity detection for reuse. 2022-08-29 16:21:06 -07:00
Dion Hulse 44e9daccd9
Harden endpoint against junk inputs.
This avoids a PHP Notice when the `pledge_id` is invalid, or not a valid pledge.
2022-08-25 17:59:36 +10:00
Ian Dunn 574ab7fd4e
Pledges: Email companies every 6 months to update pledges.
Fixes #211
2022-08-16 14:25:44 -07:00
Ian Dunn 8c28881812
Contributors: Apply ?? before array cast, to avoid PHP notice.
Previously the `$user->team_names` would be cast to an array before the null coalescing operator executed. If the `team_names` field wasn't set in the database, PHP would throw an error before trying to apply the null coalescing operator.
2022-08-15 10:54:11 -07:00
Ian Dunn 993bd53765
Email: Check first name exists before using.
The previous check worked when the field existed as an empty string, but threw a notice when it didn't exist.
2022-08-10 11:41:14 -07:00
Ian Dunn 4dc03ada83 Email: Set From header to bounce@ to reduce confusion
Sometimes we do want folks to reply to messages, and the `donotreply` address contradicts that. `bounce@` has a similar meaning, but is less known. `bounce@` has the advantage of matching the `Return-Path`, which may reduce the chance of a message being flagged as spam for forging the `From` header.

See https://github.com/WordPress/five-for-the-future/pull/206#discussion_r938418815
2022-08-10 10:25:29 -07:00
Ian Dunn a8ce296de5 Add cron job to send emails to inactive contributors. 2022-08-10 10:25:29 -07:00
Ian Dunn a271a3f1d6 Add email that is sent to inactive contributors. 2022-08-10 10:25:29 -07:00
Ian Dunn 9e4d322b3d
Stats: Add self-sponsored hours and contributor counts.
Fixes #124

Some variables/keys to clarify their names, or makes them less verbose. See #198, #200.
2022-08-03 15:53:34 -07:00
Ian Dunn 967718263f
Stats: Store in MC instead of post type
Fixes #200
Fixes #198
2022-08-03 09:29:49 -07:00
Ian Dunn 2b17844c96
Stats: Clarify confusing "sponsored" stats
This removes the `_total_sponsored_hours` and `_total_sponsored_contributors` stats because they're not reliable or meaningfullly different from the "pledged" stats. That effectively reverts most of c1ce72d447.

The remaining variables were renamed for clarity.

See #198

This will be further clarified by #200, because it will change the labels that are displayed to viewers.
2022-08-02 16:58:51 -07:00
Ian Dunn bb0216adc6
Replace deprecated SANITIZE_STRING filter with UNSAFE_RAW.
`FILTER_UNSAFE_RAW` doesn't strip HTML tags like `FILTER_SANITIZE_STRING` did, but some of these are being run through `sanitize_text_field` as well, and the others aren't being output or saved to the database.

See https://stackoverflow.com/a/69207369/450127
2022-07-19 11:03:35 -07:00
Ian Dunn 87979f588f
Update to PHPUnit 9 for PHP 8 compatibility 2022-07-19 09:33:34 -07:00
Ian Dunn 428cde283c
Contributors: Clear object cache when resetting profile data.
BuddyPress sets it infinitely, so for some users it would be awhile before it would be pushed out organically.
2022-05-03 12:36:16 -07:00
Ian Dunn c6d7bbb7c1
Contributors: Reset profile hours when pledge deactivated.
See https://github.com/WordPress/five-for-the-future/issues/169
2022-05-02 14:22:26 -07:00
Ian Dunn 834c62c0d0
Plugin: Minor cleanup 2022-04-28 09:34:14 -07:00
Ian Dunn 53ae291a53
Apply coding standards 2022-04-28 06:51:16 -07:00
Ian Dunn 82c8c9aec6
Email: Update Reply-To address to new mailbox. 2022-04-28 06:35:33 -07:00
Ian Dunn 5d8b056798
Manage Pledge: Normalize addresses to lowercase for comparison.
Fixes #141
2022-03-28 14:17:29 -07:00
Corey McKrill 174a0381d6
Theme: Add support for Openverse team, fix Themes Team badge
This syncs `r17406-dotorg` to the canonical Git repo.
2022-03-18 12:42:05 -07:00
Corey McKrill a545168ef2
Contributors: Prevent adding to a pledge twice.
This syncs `r17275-dotorg` to the canonical Git repo.
2022-03-18 12:42:05 -07:00
Ian Dunn d22f13f2c1
Pledge: Log the reason why a pledge was deactivated. 2022-03-18 12:42:05 -07:00
Ian Dunn 13a417ce8e
Apply coding standards. 2020-11-13 12:24:03 -08:00
Ian Dunn c1ce72d447
Track number of sponsored contributors and hours. 2020-11-13 12:24:02 -08:00
Ian Dunn 7464a9e585
Stats: Display snapshot times as dates for readability.
Eventually should be charts, etc. In the meantime, though, dates are more useful than timestamps.
2020-11-10 08:34:59 -08:00
Dion Hulse d835246f3f
When a pledge has no contributors, return zero contributors/hours
This avoids a PHP Notice during the cron task to update the contributor/hour counters.

By returning 0 here we have "valid" metadata attached to the pledge posts, which removes the need for further logic there.

Closes #151
2020-10-07 13:46:00 +10:00
Kelly Dwan 2d8932cbd5
Manage Pledge: Add more information to the manage link email (#138) 2019-12-20 17:20:24 -05:00
Kelly Dwan a70212bc22
Pledge List: Add sorting by total contributor count (#133)
Add a "Total Contributors" option to the sorting menu on the pledge list. This will sort the list from most confirmed contributors to least.

Fixes #94
2019-12-16 17:48:33 -05:00
Kelly Dwan 183f7a95bc
Manage Pledge: Notify removed contributors (#109)
If a contributor is removed from a pledge, they should be notified of the change. This will send an email to any confirmed contributors letting them know.
2019-12-16 17:33:43 -05:00
Kelly Dwan 3b97459b15
Pledge List: Change list order hourly (#132)
Using a seed for the RAND function, based on the date & time, will randomize the list every hour, while keeping the order consistent across any pagination. This also removes the increase to posts_per_page, since pagination is functional again.

Fixes #70
2019-12-13 15:41:00 -05:00
Kelly Dwan a91c2733d2
Pledge Management: Add "request link" form to the manage pledge (#126)
When a pledge is selected but the auth token is missing/incorrect, show the email form. Like on the pledge page, submitting the correct email will trigger a new auth token + link to be emailed to the pledge manager. This makes for a clearer path for re-requesting a valid link.

Fixes #114
2019-12-11 16:12:23 -05:00
Kelly Dwan a5d4228c6d
My Pledges: Add an edit link to take you to your profile (#128) 2019-12-11 16:11:41 -05:00
Kelly Dwan 636753bb00
My Pledges: Require profile to be filled out before confirming a pledge (#127)
This will disable the "join organization" button until the profile is complete, and add a second warning message to explicitly tell the user why the button is disabled.
2019-12-11 16:11:13 -05:00
Kelly Dwan bdbf6d573e
Pledge Management: Allow pledge admins to remove the pledge (#123)
* Rename generic "frontend" file to dialog

* Add a "remove pledge" action

* Process pledge deactivation

* Trigger an email on user-initiated pledge deactivation

* Show an error when trying to manage a deactivated pledge

* Add a label for "deactivated" pledges
2019-12-10 14:07:48 -05:00
Kelly Dwan 619af97bd1
Forms: Use button class directly on buttons for consistent display
Adding the `button` mixin into `input[type="submit"] caused conflicts with the other button classes (`.button-primary`) due to specificity. The button classes should be used on all buttons instead. This also updates which button on the Manage Pledge form is the "primary" action, since it's easy to skip the Update button when it's not primary.
2019-12-09 11:15:39 -05:00
Ian Dunn fda5842e86
Regularly store stats snapshots to track historical trends.
Fixes #37
2019-12-06 08:03:54 -08:00
Ian Dunn 24a73b6324
Use FIELD_IDS instead of hardcoding for DRYness. 2019-12-05 15:01:40 -08:00
Kelly Dwan 8807efb96d
Pledges: Add UI for setting "deactivated" status (#115)
This adds the ability to deactivate/reactivate pledges from the wp-admin list table. Once deactivated, the pledge is removed from the "published" list, as if it were trashed. It is not rendered in the frontend pledge list either. You can still access the edit screen, but no edits can be made (saving the pledge is disabled by JS, as otherwise it would reactivate itself). This way we can remove a pledge, but still see the activity log.

Fixes #112
2019-12-05 13:20:11 -05:00
Ian Dunn e4deb6809a
Apply coding standards 2019-12-03 12:09:35 -08:00