function wpga_delete_app_password($key) { global $current_user; $passwords = $new = wpga_get_app_passwords(); if (array_key_exists($key, $passwords)) { unset($new[$key]); update_user_meta($current_user->ID, 'wpga_apps_passwords', $new, $passwords); } }
/** * Check if the current user has app passwords. * * @since 1.1.0 * @return boolean True if has app passwords */ public function has_app_passwords($user_id) { $passwords = wpga_get_app_passwords($user_id); if (empty($passwords)) { return false; } else { return true; } }
<?php $passwords = wpga_get_app_passwords(); $log = wpga_get_app_passwords_log(); $alt = 'class="alternate"'; ?> <div class="wrap"> <div class="icon32" id="icon-options-general"></div> <h2><?php _e('Authenticator Applications Passwords', 'wpga'); ?> </h2> <p><?php _e('Apps passwords allow you to grant access to your WordPress administrative functions to applications that can\'t provide a one time password. This is useful if you use the WordPress mobile app for instance.', 'wpga'); ?> </p> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <!-- main content --> <div id="post-body-content"> <div class="meta-box-sortables ui-sortable"> <div class="postbox"> <table id="wpga-passwords-list" class="widefat"> <thead> <tr> <th class="row-title"><?php _e('Description', 'wpga'); ?> </th> <th><?php