Commit graph

103 commits

Author SHA1 Message Date
Kelly Dwan
5bb70abdc2
Manage Pledge: Enable pledge admins to edit contributors from manage form (#108)
* Add contributor management to manage form
* Check `pledge_id` to prevent returning all contributors
* Return a plain text error string – this is used in an alert box, so it can't contain HTML
* Hide confirmation when pledge is a draft
* Only enqueue script if the user is authorized
2019-11-26 13:01:21 -05:00
Kelly Dwan
45c76aab9c
Manage Pledge: Save a new logo if one is uploaded
- Add logo display & field to manage form
- Save the new logo if submitted (do nothing if not)
- Delete the original logo when a new one is uploaded, checking that the attachment parent is the pledge (just in case of changes via Media Library)
2019-11-26 13:01:21 -05:00
Kelly Dwan
a794829c4d
Fix warnings on new pledge form 2019-11-25 16:49:11 -05:00
Kelly Dwan
a58b5e958c
Remove p & br tags from the input field
This does not replace the line break, so they're re-added when the value is saved.
2019-11-25 16:47:58 -05:00
Kelly Dwan
8dffcc509b
Show form content when there are form errors 2019-11-25 16:47:57 -05:00
Kelly Dwan
8b4d55782d
Enable Manage Form functionality 2019-11-25 16:47:57 -05:00
Kelly Dwan
60fd0d2fb3
Rename to subset, since context is also used elsewhere 2019-11-25 16:44:20 -05:00
Kelly Dwan
c614d63056
Fix issue with fetching data in get_pledge_meta when no submission has been POST'd 2019-11-25 16:44:20 -05:00
Kelly Dwan
bbe3d1be84
Pledges: Move parse_contributors function 2019-11-25 16:44:20 -05:00
Kelly Dwan
d9382a975a
Pledges: Move has_existing_pledge function 2019-11-25 16:42:13 -05:00
Jb Audras
0754ae0b28 Use a unique text-domain, wporg-5ftf (#110)
* Use a unique text-domain, wporg-5ftf

* Fix plugin i18n strings

* Remove unwanted text-domains from WPCS checks and fix missed old text-domains

* Remove type=array from phpcs

* Re-add type=array

* Small WPCS fix

* WPCS: replace  var with
2019-11-23 13:24:37 -05:00
Kelly Dwan
a11e3c5fa5
Manage Pledge: Update email dialog to use JS submission (#104)
Use the proper dialog behavior for submitting an email to generate a manage link.

Fixes #98.
2019-11-21 15:31:29 -05:00
Kelly Dwan
a67ef04505
Move "send mange email" code to ajax endpoint (#103)
Add an admin-ajax endpoint to request an authorized email to edit an existing pledge. The email submitted needs to match the submitted organizer email for the given pledge. If it does, an email will be sent out with the link to the pledge management form. If not, it will return an error.

See #98.
2019-11-20 18:04:40 -05:00
Kelly Dwan
82192eea4c
Manage a Pledge: Enable adding/removing contributors from wp-admin. (#99)
This updates the display of contributors into a table view, and adds the ability to add and remove contributors to existing pledges.

The display has been refactored to use JS templates & JSON contributor data– the data is output onto the page when loaded from the server, and rendered when the page finishes loading. Adding & removing contributors now submits to an admin-ajax.php endpoint, which, if successful, return the new list of contributors. This ensures the display is always up to date.

Fixes #3
2019-11-20 11:01:00 -05:00
Kelly Dwan
f32d26ef47
Organize email & authentication code (#101)
* Split Auth functionality out to new file

* Move email-related code into the email file

* Use `assertFalse` for boolean assertions

* Add `can_manage_pledge` to check user or token against a given pledge

Pulled out of e9763f6678

* Remove duplicate test
2019-11-20 10:40:45 -05:00
Kelly Dwan
03949905c0
Tests: Update infrastructure & add travis config (#100)
* Tests: Move tests infrastructure, set up travis

Consolidates the composer files so we can run install once in travis.

* Return empty array if no values are $_POST'ed to the form

Fixes an issue with tests + null values in logs

* Clean up some naming & create helper functions for tests

* Debug travis

* Remove debug

* Fix notices on form

* Turn on multisite flag
2019-11-15 17:40:53 -05:00
Kelly Dwan
5c2041442a
Remove unused file 2019-11-14 13:48:22 -05:00
Kelly Dwan
42d44f7dc9
Plugin: Fix all phpcs errors
This includes autofixes, along with some manual fixes; mostly syntax-related. Some `phpcs:ignore` comments were added for overzealous rules that don't apply.
2019-11-14 13:48:17 -05:00
Ian Dunn
2e8912e9d5 Manage Pledge: Add shortcode to email link for updating.
See #5
2019-11-12 08:35:06 -08:00
Ian Dunn
414c4809e3 Email: Allow tokens to be reused when necessary. 2019-11-12 08:35:06 -08:00
Ian Dunn
521ce58de7
Contributors: Return default array when posts empty to avoid notices.
Previously there were `undefined index` notices on `wp-admin/edit.php?post_type=5ftf_pledge` when a pledge had `0` posts in either status.
2019-11-07 16:14:27 -08:00
Ian Dunn
93d2bafd34
Pledge Form: Generate correct URL for the directory.
It's no longer a page, and instead uses the post type archive with a rewrite rule.
2019-11-07 16:14:27 -08:00
Ian Dunn
963dbd41e3
Views: Modularize success/error notices for DRYness. 2019-11-07 16:14:26 -08:00
Ian Dunn
7e89d1794a
Email: Send no-cache headers when auth token present for security. 2019-11-07 16:07:51 -08:00
Ian Dunn
18228d367c
Pledge Log: Log user of CLI actions. 2019-11-07 11:31:00 -08:00
Ian Dunn
c524d1b21b
Tests: Disable logger to avoid errors. 2019-11-07 11:16:12 -08:00
Ian Dunn
ffebacb42a
My Pledges: Rename status variable for clarity. 2019-11-07 10:08:18 -08:00
Caleb Burks
7cbe722202
My Pledges: Only trigger status changes when needed. 2019-11-07 10:08:18 -08:00
Caleb Burks
1023fdeb55
My Pledges: Verify current user is authorized to edit contribution.
Closes #90
2019-11-07 10:08:06 -08:00
Caleb Burks
8e3ba2db96
My Pledges: Append ID to nonce action to make it more unique.
Fixes #87
2019-11-06 09:02:29 -08:00
Caleb Burks
8230963ea4
My Pledges: Ensure the submitted contributor_post_id is valid.
See #87
2019-11-06 08:58:50 -08:00
Caleb Burks
c47679a5cc
My Pledges: Return early if contributor_post_id is missing.
`process_my_pledges_form()` is actually called on page load in `render_my_pledges()`.

So to prevent the unnecessary get_post() queries, let’s just return early if the form wasn’t really submitted.

See #87
2019-11-06 08:58:07 -08:00
Ian Dunn
dc8ef43ebd
Remove links to non-existent locale variants.
Fixes #76
2019-11-04 13:04:17 -06:00
Melissa Ashforth
c7e329ec32
Pledge List: Remove unused prototype.
Fixes #62
Closes #79
2019-11-03 15:14:03 -06:00
Caleb Burks
1576a18d24 Disallow create_posts for the Pledges and Contributors (#78)
Pledges and contributors should not be creatable from the normal WP UI "Add New".

Fixes #77 
Props icaleb
2019-11-03 14:21:16 -06:00
Ian Dunn
11b9bf3604
Pledge List: Sort randomly by default for fairness.
See #70
2019-11-02 13:26:22 -05:00
Ian Dunn
bac15d21fc
Pledge Form: Improve placeholders for clarity.
* Make the usernames look more like realistic usernames.
* Add placeholders where specific formats are needed.
2019-11-02 08:14:22 -05:00
Kelly Dwan
f55054f56c
My Pledge List: Add the My Pledges header to logged out views 2019-11-01 16:09:29 -05:00
Ian Dunn
fe437cc880
My Pledges: Hide menu item when logged out. 2019-11-01 15:37:49 -05:00
Ian Dunn
b3d52c8719
Pledge Meta: Clarify function/job names. 2019-11-01 04:24:11 -05:00
Ian Dunn
2686c9873b
Pledge Meta: Add cron to update all cached pledge data.
Fixes #71
2019-10-31 21:41:35 -05:00
Ian Dunn
87eb8ec43a
Pledge Log: Capture email events. 2019-10-31 20:39:57 -05:00
Ian Dunn
33d3bc1933
Pledge List: Show hours because it's a more meaningful statistic. 2019-10-31 16:27:27 -05:00
Corey McKrill
7273057950
Pledge: Update wording of pledge confirmation email 2019-10-31 14:39:17 -05:00
Corey McKrill
dd4c08d87b
Pledge form: Add ID to form messages and hash to form action
This way when the form is submitted, the page loads at the location
where the success or error message will be shown, skipping the content
above the form.

Fixes #67
2019-10-31 12:49:47 -05:00
Ian Dunn
5c50b1fcc6
My Pledges: Prompt to fill out profile data if haven't already. 2019-10-31 11:08:04 -05:00
Ian Dunn
069dcc8c20
Pledge Form: Ask for updates to w.org profiles to get needed data. 2019-10-31 07:27:58 -05:00
Ian Dunn
00e88cc2de
Pledge Form: Always insert user_login for consistency.
df78e3de80 started allowing `user_nicename`s in the form field, but we need to always create the contributor posts with the `user_login`, because there are many other places in the code that expect the `post_title` to be the `user_login` and not the `user_nicename`.

See #57
2019-10-30 23:30:34 -05:00
Ian Dunn
e61ce467cb
Pledge Form: Allow HTML within descriptions.
Fixes #63
2019-10-30 13:32:32 -07:00
Ian Dunn
782a40bcda
Pledge Form: Improve contributor username field UX. 2019-10-30 13:10:21 -07:00