Page_API::delete_page( string $nonce )
Delete a Facebook Page using ajax.
Contents
Parameters
- $nonce
-
(string) (Required) The delete action nonce to check.
Return
(string) An html message for success or failure when deleting.
Source
File: src/Tribe/Meetings/Facebook/Page_API.php
public function delete_page( $nonce ) {
if ( ! $this->check_ajax_nonce( Settings::$delete_action, $nonce ) ) {
return false;
}
$local_id = tribe_get_request_var( 'local_id' );
// If local id fail the request.
if ( empty( $local_id )) {
$error_message = _x(
'The Facebook Page local id is missing and cannot be deleted.',
'Facebook Page local id missing when trying to delete error message.',
'events-virtual'
);
tribe( Template_Modifications::class )->get_settings_message_template( $error_message, 'error' );
wp_die();
}
$page_data = $this->get_page_by_id( $local_id );
if ( empty( $page_data ) ) {
$message = _x(
'No Facebook Page Found to Delete.',
'Error message if the Facebook Page was not found in the options.',
'events-virtual'
);
tribe( Template_Modifications::class )->get_settings_message_template( $message, 'error' );
wp_die();
}
$this->delete_page_by_id( $local_id );
$message = _x(
'Facebook Page Deleted.',
'Message when a Facebook Page is deleted from the options table.',
'events-virtual'
);
tribe( Template_Modifications::class )->get_settings_message_template( $message );
wp_die();
}
Changelog
| Version | Description |
|---|---|
| 1.7.0 | Introduced. |