/** * Action method for completing the 'verify' action. This action is used adding an identity URL to a * WordPress user through the admin interface. * * @param string $identity_url verified OpenID URL */ function openid_finish_verify($identity_url) { if ($_REQUEST['action'] != 'verify') { return; } $user = wp_get_current_user(); if (empty($identity_url)) { $message = openid_message(); if (empty($message)) { openid_message('Unable to authenticate OpenID.'); } } else { if (!openid_add_identity($user->ID, $identity_url)) { openid_message(__('OpenID assertion successful, but this URL is already associated with ' . 'another user on this blog. This is probably a bug.', 'openid')); } else { openid_message(sprintf(__('Added association with OpenID: %s', 'openid'), openid_display_identity($identity_url))); openid_status('success'); // ensure that profile URL is a verified OpenID set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); require_once 'Auth/OpenID.php'; if ($GLOBALS['wp_version'] >= '2.3') { require_once ABSPATH . 'wp-admin/includes/admin.php'; } else { require_once ABSPATH . WPINC . '/registration.php'; } if (!openid_ensure_url_match($user)) { wp_update_user(array('ID' => $user->ID, 'user_url' => $identity_url)); openid_message(openid_message() . '<br />' . __('<strong>Note:</strong> For security reasons, your profile URL has been updated to match your OpenID.', 'openid')); } } } return; }
/** * Handle user management of OpenID associations. * * @submenu_page: profile.php **/ function openid_profile_panel() { global $error; if (!current_user_can('read')) { return; } $user = wp_get_current_user(); $status = openid_status(); if ('success' == $status) { echo '<div class="updated"><p><strong>' . __('Success:', 'openid') . '</strong> ' . openid_message() . '</p></div>'; } elseif ('warning' == $status) { echo '<div class="error"><p><strong>' . __('Warning:', 'openid') . '</strong> ' . openid_message() . '</p></div>'; } elseif ('error' == $status) { echo '<div class="error"><p><strong>' . __('Error:', 'openid') . '</strong> ' . openid_message() . '</p></div>'; } if (!empty($error)) { echo '<div class="error"><p><strong>' . __('Error:', 'openid') . '</strong> ' . $error . '</p></div>'; unset($error); } screen_icon('openid'); ?> <style type="text/css"> #icon-openid { background-image: url("<?php echo plugins_url('openid/f/icon.png'); ?> "); } </style> <div class="wrap"> <form action="<?php printf('%s?page=%s', $_SERVER['PHP_SELF'], $_REQUEST['page']); ?> " method="post"> <h2><?php _e('Your Verified OpenIDs', 'openid'); ?> </h2> <p><?php _e('You may associate one or more OpenIDs with your account. This will ' . 'allow you to login to WordPress with your OpenID instead of a username and password. ' . '<a href="http://openid.net/what/" target="_blank">Learn more...</a>', 'openid'); ?> </p> <div class="tablenav"> <div class="alignleft actions"> <select name="action"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?> </option> <option value="delete"><?php _e('Delete'); ?> </option> </select> <input type="submit" value="<?php _e('Apply'); ?> " name="doaction" id="doaction" class="button-secondary action" /> <?php wp_nonce_field('openid-delete_openids'); ?> </div> <div class="clear"></div> </div> <div class="clear"></div> <table class="widefat"> <thead> <tr> <th scope="col" class="check-column"><input type="checkbox" /></th> <th scope="col"><?php _e('Account', 'openid'); ?> </th> </tr> </thead> <tbody> <?php $urls = get_user_openids($user->ID); if (empty($urls)) { echo '<tr><td colspan="2">' . __('No Verified Accounts.', 'openid') . '</td></tr>'; } else { foreach ($urls as $url) { echo ' <tr> <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="' . md5($url) . '" /></th> <td>' . openid_display_identity($url) . '</td> </tr>'; } } ?> </tbody> </table> </form> <form method="post"> <table class="form-table"> <tr> <th scope="row"><label for="openid_identifier"><?php _e('Add OpenID', 'openid'); ?> </label></th> <td><input id="openid_identifier" name="openid_identifier" /></td> </tr> </table> <?php wp_nonce_field('openid-add_openid'); ?> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e('Add OpenID', 'openid'); ?> " /> <input type="hidden" name="action" value="add" > </p> </form> </div> <?php }