1,
'identity_url' => urlencode( $identity_url ),
'redirect_to' => $_SESSION['openid_finish_url'],
'_wpnonce' => wp_create_nonce( 'openid_login_' . md5( $identity_url ) ),
),
$url
);
wp_safe_redirect( $url );
exit;
}
/**
* Setup OpenID errors to be displayed to the user.
*/
function openid_login_errors() {
$self = basename( $GLOBALS['pagenow'] );
if ( $self != 'wp-login.php' ) {
return;
}
if ( array_key_exists( 'openid_error', $_REQUEST ) ) {
global $error;
$error = htmlentities2( $_REQUEST['openid_error'] );
}
}
/**
* Add style and script to login page.
*/
function openid_wp_login_head() {
openid_style();
}
/**
* Add OpenID input field to wp-login.php
*
* @action: login_form
**/
function openid_wp_login_form() {
echo '
';
echo '
' . __( 'Or login using an OpenID', 'openid' ) . '
' . __( 'Learn about OpenID', 'openid' ) . '
';
}
/**
* Add information about registration to wp-login.php?action=register
*
* @action: register_form
**/
function openid_wp_register_form() {
echo '
'; //Added to fix IE problem
if ( get_option( 'openid_required_for_registration' ) ) {
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'openid-register', plugin_dir_url( __FILE__ ) . 'f/register.js', array( 'jquery' ), OPENID_PLUGIN_REVISION );
$label = __( 'Register using an OpenID:', 'openid' );
} else {
$label = __( 'Or register using an OpenID:', 'openid' );
echo '
';
echo '
';
}
echo '
' . $label . '
' . __( 'Learn about OpenID', 'openid' ) . '
';
}
/**
* Clean out registration errors that don't apply.
*/
function openid_clean_registration_errors( $errors ) {
if ( get_option( 'openid_required_for_registration' ) || ! empty( $_POST['openid_identifier'] ) ) {
$new = new WP_Error();
foreach ( $errors->get_error_codes() as $code ) {
if ( in_array( $code, array( 'empty_username', 'empty_email' ) ) ) {
continue;
}
$message = $errors->get_error_message( $code );
$data = $errors->get_error_data( $code );
$new->add( $code, $message, $data );
}
$errors = $new;
}
if ( get_option( 'openid_required_for_registration' ) && empty( $_POST['openid_identifier'] ) ) {
$errors->add( 'openid_only', __( 'ERROR : ', 'openid' ) . __( 'New users must register using OpenID.', 'openid' ) );
}
return $errors;
}
/**
* Handle WordPress registration errors.
*/
function openid_registration_errors( $errors ) {
if ( ! empty( $_POST['openid_identifier'] ) ) {
$errors->add( 'invalid_openid', __( 'ERROR : ', 'openid' ) . openid_message() );
}
return $errors;
}
/**
* Handle WordPress registrations.
*/
function openid_register_post( $username, $password, $errors ) {
if ( ! empty( $_POST['openid_identifier'] ) ) {
wp_signon();
}
}