Revision: 52
http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=52&view=rev
Author: axelseaa
Date: 2008-06-30 15:39:21 -0700 (Mon, 30 Jun 2008)
Log Message:
-----------
fix for bug #2003216 - has_cap() error still appears in a few places, finished updating to return new wp_user or wp_error object
Modified Paths:
--------------
trunk/ldap/lib/wpmu_ldap.functions.php
Modified: trunk/ldap/lib/wpmu_ldap.functions.php
===================================================================
--- trunk/ldap/lib/wpmu_ldap.functions.php 2008-06-30 22:37:53 UTC (rev 51)
+++ trunk/ldap/lib/wpmu_ldap.functions.php 2008-06-30 22:39:21 UTC (rev 52)
@@ -19,8 +19,7 @@
$user_id = wpmu_create_user( $newUserName, $sPassword, $ldapUserData[LDAP_INDEX_EMAIL] );
if ( $user_id === false ) {
- $error = __('<strong>Error</strong>: Account creation failed - contact your administrator.');
- return false;
+ return new WP_Error('ldapcreate_failed', __('<strong>ERROR</strong>: Account creation from LDAP failed.'));
}
//Update their first and last name from ldap
@@ -50,15 +49,15 @@
$blog_id = wpmu_create_blog($newdomain, $path, $newUserName . "'s blog", $user_id, $meta);
if ( is_a($blog_id, "WP_Error") ) {
- $error = __('<strong>Error</strong>: Blog creation failed - contact your administrator.');
- return false;
+ return new WP_Error('blogcreate_failed', __('<strong>ERROR</strong>: Blog creation from LDAP failed.'));
}
do_action('wpmu_activate_blog', $blog_id, $user_id, $newUserPassword, $newUserName . "'s blog", $meta);
}
//Must recreated the login object for our shiny NEW users.
- return get_userdatabylogin($newUserName);
+ #return get_userdatabylogin($newUserName);
+ return new WP_User($user_id);
}
@@ -85,7 +84,6 @@
$errors->add('unknown_error',__('<strong>ERROR</strong>: Unknown error in LDAP Authentication.'));
return array('result' => false,'errors' => $errors);
}
-
}
/**
@@ -109,25 +107,17 @@
// Make the WP users automatically if we're configured to do so
if ($ldapCreateAcct ) {
- $loginObj = wpmuLdapCreateWPUserFromLdap($loginUserName, $loginPassword, $userDataArray);
- // If the account creation failed, the login process needs to fail.
- if ( $loginObj === false ) {
- echo "Failed!";
- return false;
- }
-
//Setup redirection to user's home directory.
if (!strpos($_REQUEST['redirect_to'], $loginUserName)) {
$_REQUEST['redirect_to'] = $loginUserName . "/" . $_REQUEST['redirect_to'];
}
-
- return new WP_User($loginObj->ID);
+
+ return wpmuLdapCreateWPUserFromLdap($loginUserName, $loginPassword, $userDataArray);
}
// but if not configured to create 'em, exit with an error
else {
- $error = __('<strong>Error</strong>: A blogging account does not exist - contact your administrator.');
- return false;
+ return new WP_Error('account_noexist', __('<strong>ERROR</strong>: A blogging account does not exist - contact your administrator.'));
}
}
@@ -137,16 +127,14 @@
// At this point we must have a login object, but just in case something went wrong
if (!$loginObj) {
- $error = __('<strong>Error</strong>: Unknown error in LDAP Authentication.');
- return false;
+ return new WP_Error('unknown_error', __('<strong>ERROR</strong>: Unknown error in LDAP Authentication.'));
}
// Since the login was successful, lets set a meta object to know we are using ldap
$ldapMeta = get_usermeta($loginObj->ID,'ldap_login');
if ($ldapMeta != 'true') {
if (!update_usermeta($loginObj->ID, 'ldap_login', 'true')) {
- $error = __('<strong>Error</strong>: Error updating user meta information.');
- return false;
+ return new WP_Error('update_usermeta', __('<strong>ERROR</strong>: Error updating user meta information.'));
}
}
@@ -156,8 +144,7 @@
$details = get_blog_details( $primary_blog );
if( is_object( $details ) ) {
if( $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) {
- $error = __('<strong>Error</strong>: Blog suspended.');
- return false;
+ return new WP_Error('blog_suspended', __('<strong>ERROR</strong>: Blog suspended.'));
}
}
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|