mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 18:05:45 +03:00
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:
parent
286e6d55ef
commit
544fe39199
8 changed files with 110 additions and 18 deletions
|
@ -8,7 +8,8 @@ namespace WordPressDotOrg\FiveForTheFuture\Endpoints;
|
|||
use WordPressDotOrg\FiveForTheFuture\{ Auth, Contributor, Email };
|
||||
use const WordPressDotOrg\FiveForTheFuture\PledgeMeta\META_PREFIX;
|
||||
|
||||
add_action( 'wp_ajax_manage-contributors', __NAMESPACE__ . '\manage_contributors_handler' );
|
||||
add_action( 'wp_ajax_manage-contributors', __NAMESPACE__ . '\manage_contributors_handler' );
|
||||
add_action( 'wp_ajax_nopriv_manage-contributors', __NAMESPACE__ . '\manage_contributors_handler' );
|
||||
|
||||
add_action( 'wp_ajax_send-manage-email', __NAMESPACE__ . '\send_manage_email_handler' );
|
||||
add_action( 'wp_ajax_nopriv_send-manage-email', __NAMESPACE__ . '\send_manage_email_handler' );
|
||||
|
@ -29,7 +30,7 @@ function manage_contributors_handler() {
|
|||
if ( is_wp_error( $authenticated ) ) {
|
||||
wp_die( wp_json_encode( [
|
||||
'success' => false,
|
||||
'message' => $authenticated->get_error_message(),
|
||||
'message' => __( 'Sorry, you don\'t have permissions to do that.', 'wporg-5ftf' ),
|
||||
] ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue