Users their new lines. Move over their profile icons just to get their IDs (comming from the API). Supposed to be 1234 and 5678 for following statements. SET your user status as Admin. define in your private LOCAL configuration file (ie. ./include/config_local.inc.php and NEVER config_global) Like this: $conf['guest_id'] = 5678; $conf['default_user_id'] = $conf['guest_id']; $conf['webmaster_id'] = 1234; Close to be finished: Connect you with you user (1234). See in admin Identification > Users The old webmaster is an Admin The old guest is a normal registered user. Delete them (or at least change the status of the old webmaster as user). That's it. */ /* Here already in step 1 */ if (!defined('PHPWG_ROOT_PATH')) die ("Hacking attempt!"); global $conf, $row; $conf['allow_user_registration'] = false; if (!isset($conf['external_connection_api'])) die("The API parameter is NOT defined \$conf['external_connection_api']. Please see ./plugins/external_connection/main.inc.php comments."); /* step 2 (creation) */ add_event_handler('login_failure', 'try_external_identification'); function try_external_identification($username) { global $conf, $redirect_to, $remember_me; /* step 3 (call the external API) */ $external_url = sprintf($conf['external_connection_api'], addslashes($username), md5(addslashes($_POST['password']))); $fp = fopen($external_url,'r'); $d = fgets($fp); $g = split("//",$d); $userid = (int)($g[0]); //$userid=32; #for local testing fclose($fp); if ($userid > 0) { /* step 5 (register) */ $error = register_external_user($userid, $username, $_POST['password'], ''); if (empty($error)) { /* step 6 (Logon) */ log_user($userid, $remember_me); redirect(empty($redirect_to) ? make_index_url() : $redirect_to); } } /* step 4 (do nothing) */ } /* The orginal registration function has been reviewed to force an external provided id and to be able to change the pseudo (no duplicate pseudo in this particular case) */ function register_external_user($next_id, $login, $password, $mail_address, $with_notification = true, $errors = array()) { global $conf; if ($login == '') array_push($errors, l10n('reg_err_login1')); if (preg_match('/^.* $/', $login)) array_push($errors, l10n('reg_err_login2')); if (preg_match('/^ .*$/', $login)) array_push($errors, l10n('reg_err_login3')); if (get_userid($login)) array_push($errors, l10n('reg_err_login5')); $mail_error = validate_mail_address(null, $mail_address); if ('' != $mail_error) array_push($errors, $mail_error); $errors = trigger_event('register_user_check', $errors, array( 'username'=>$login, 'password'=>$password, 'email'=>$mail_address, )); // if no error until here, registration of the user if (count($errors) == 0) { $query = 'REPLACE INTO piwigo_users (id,username,password,mail_address) VALUES(' . $next_id . ',\'' . mysql_real_escape_string($login) . '\',\'' . $conf['pass_convert']($password) . '\',NULL);'; $result = pwg_query($query); // Assign by default groups $query = 'SELECT id FROM '.GROUPS_TABLE.' WHERE is_default = \''.boolean_to_string(true).'\' ORDER BY id ASC;'; $result = pwg_query($query); $inserts = array(); while ($row = mysql_fetch_array($result)) { array_push($inserts, array( 'user_id' => $next_id, 'group_id' => $row['id'] )); } if (count($inserts) != 0) { include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); mass_inserts(USER_GROUP_TABLE, array('user_id', 'group_id'), $inserts); } $num_infos = mysql_num_rows(pwg_query('SELECT user_id FROM '.USER_INFOS_TABLE.' WHERE user_id = \''.$next_id.'\'')); if ($num_infos == 0) create_user_infos($next_id); if ($with_notification and $num_infos == 0 and $conf['email_admin_on_new_user']) { include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); $admin_url = get_absolute_root_url() .'admin.php?page=user_list&username='.$login; $keyargs_content = array( get_l10n_args('User: %s', $login), get_l10n_args('Email: %s', $_POST['mail_address']), get_l10n_args('', ''), get_l10n_args('Admin: %s', $admin_url) ); pwg_mail_notification_admins( get_l10n_args('Registration of %s', $login), $keyargs_content ); } trigger_action('register_user', array( 'id'=>$next_id, 'username'=>$login, 'email'=>$mail_address, )); } return $errors; } ?>