phpScheduleIt
May 19, 2013, 12:03:21 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: admin add user function - passing incorrect user name back  (Read 6184 times)
emonsta
Newbie
*

Karma: 0
Posts: 13


« on: May 14, 2006, 08:03:54 PM »

Hello

I am currently trying to get add and edit user profile functionality working for the admin. i've been using some of the beta code. am running into a couple of problems.
At present i have the page opening correctly, data being saved etc. but i get the following error messages upon submission of new user

Warning: sprintf() [function.sprintf]: Too few arguments in /home/mississa/public_html/phpScheduleIt/config/langs.php(219) : eval()'d code on line 20

Warning: sprintf() [function.sprintf]: Too few arguments in /home/mississa/public_html/phpScheduleIt/config/langs.php(219) : eval()'d code on line 16

I'm not sure what they mean, but they're not stopping the data entry process. still get the You have Successfully Registered! message. however, upon clicking Continue, the page then displays the new users name in the Welcome header, instead of the admin's name.  here is the code from the Auth.class.php file. Can you give me some ideas as to what i do to change that? and also, if those error messages are not connected to this problem, what they mean? thanks!


if (!$adminCreated) {
       If the user wants to set a cookie, set it
       for their ID and fname.  Expires in 30 days (2592000 seconds)
      if (isset($data['setCookie'])) {
         setcookie('ID', $id, time() + 2592000, '/');
      }
      }
      // If it is the admin, set session variable
      if ($data['emailaddress'] == $adminemail) {
         $_SESSION['sessionAdmin'] = $adminemail;
      }

      // Set other session variables
      $_SESSION['sessionID'] = $id;
      $_SESSION['sessionName'] = $data['fname'];

      // Write log file
      CmnFns::write_log('New user registered. Data provided: fname- ' . $data['fname'] . ' lname- ' . $data['lname']. ' address- ' . $data['address']. ' suburb- ' . $data['suburb']. ' state- ' . $data['state']. ' postcode- ' . $data['postcode']
                  . ' email- '. $data['emailaddress'] . ' hm_ph- ' . $data['hm_ph']. ' wk_ph- ' . $data['wk_ph']. ' phone- ' . $data['phone'] . ' institution- ' . $data['institution']
                  . ' position- ' . $data['position']. ' art_form- ' . $data['art_form']. ' promo- ' . $data['promo']. ' is_member- ' . $data['is_member'] . ' member_date- ' . $data['member_date'], $id);
      
      if( !$conf['ldap']['authentication'] ) {
      $url = 'ctrlpnl.php';
      if ($adminCreated){
            $url = 'ctrlpnl_admin.php?tool=users';
            }
        CmnFns::redirect($url, 1, false);
        $link = CmnFns::getNewLink();
      
        $this->success = translate('You have successfully registered') . '<br/>' . $link->getLink($url, translate('Continue'));
      } else {
          // return DB id from entry created if using LDAP
          return $id;
      }
Logged
emonsta
Newbie
*

Karma: 0
Posts: 13


« Reply #1 on: May 14, 2006, 11:41:28 PM »

i've got the edit users screen to come up ok and pass the right memberid to the page, but when i try to update a profile, it tells me that the email address is already in use. i get the same error if i try to edit from the My Profile link too.
have checked the Auth.class.php file and nothing is amiss with the check_all_values function. any thoughts?

thanks
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #2 on: May 15, 2006, 09:48:35 AM »

For your first issue, it is just a matter of how many %s characters and how many actual substitue words.  These should always be equal.

The 2nd issue sounds like a bug that was found in the beta1 release.  The fix is committed to the projects Subversion repository (if you wanted to grab the updated code) and will be released in beta2/rc1.
Logged
emonsta
Newbie
*

Karma: 0
Posts: 13


« Reply #3 on: May 16, 2006, 02:05:44 AM »

hey
thanks for that. found the right snippet and its fixed now.
one thing is still bugging me though...  when i register a user or edit a profile as the Admin it works fine, but the username in the Welcome Back message (and in the My Profile selection) changes to the newly registered or updated user's details. somehow the session name is being taken from the new user instead of remaining the Admin, though the privileges remain the administrators.  Which bit of code whould i be looking at to check this?

thanks for all your help Nick
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #4 on: May 16, 2006, 09:37:00 AM »

Hmm, that's not supposed to happen.  I'll check this out.
Logged
emonsta
Newbie
*

Karma: 0
Posts: 13


« Reply #5 on: May 16, 2006, 06:38:33 PM »

thanks Nick

it's about 99% likely its something i've forgotten to change when updating with the beta code. i'm also just taking the code for add and edit members functionality without any of the group stuff or other new features. (v tight deadline, no time to add new functionality now  Sad  ) its probably a case of i haven't taken enough code, or i've switched something off that should be on. i can see that it works fine on your beta demo. i just don't know what controls the session name so if you can give an idea of where that process starts and ends, i can probably find the error.

cheers Smiley
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #6 on: May 17, 2006, 08:50:20 AM »

Ah, you backported this stuff to 1.1?  Just make sure that all of the Auth classes are also copied over.  That's where the name is set.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!