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
This commit is contained in:
Kelly Dwan 2019-11-26 12:57:14 -05:00
parent f5846c9128
commit f30324adea
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
8 changed files with 110 additions and 18 deletions

View file

@ -248,6 +248,9 @@ function get_pledge_contributors( $pledge_id, $status = 'publish', $contributor_
* @return array An array of contributor data, ready to be used in the JS templates.
*/
function get_pledge_contributors_data( $pledge_id ) {
if ( ! $pledge_id ) {
return array();
}
$contrib_data = array();
$contributors = get_pledge_contributors( $pledge_id, 'all' );