Files

38 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
global $MIRAVIAWOO;
if(isset($_GET['action']) and $_GET['action'] == 'delete') {
if(current_user_can( 'manage_options' )){
MiraviaCore::delete_account(sanitize_text_field( $_GET['id'] ));
wp_safe_redirect(admin_url("admin.php?page=miravia_settings&subpage=accounts"));
}
}
$miraviaTable = new MiraviaTable();
$miraviaTable->custom_actions = array(
'delete' => sprintf('<a href="admin.php?page=%s&subpage=%s&action=%s&id=[id]">Delete</a>', sanitize_text_field($_REQUEST['page']), sanitize_text_field($_REQUEST['subpage']), 'delete'),
);
$miraviaTable->columns = [
'name' => 'Name',
'lang' => 'Language',
'userid' => 'User ID',
'created' => 'Created',
'updated' => 'Updated'
];
$miraviaTable->data_table = $accounts = MiraviaCore::get_accounts();
$miraviaTable->total_elements = count($accounts);
$miraviaTable->prepare_items();
?>
<div class="wrap">
<form method="post" action="<?php echo admin_url('admin-ajax.php?action=miravia_authorize')?>">
<h1 class="wp-heading-inline">Miravia Seller Accounts</h1>
<input type="submit" name="authorize" class="page-title-action" value="Add Account" />
</form>
<hr class="wp-header-end">
<?php
$miraviaTable->display();
?>
</div>