1
boumbo
How to add password fields in the Extended Profile
  • 2007/2/15 18:09

  • boumbo

  • Just popping in

  • Posts: 37

  • Since: 2006/9/25


Hi everyone,

I am running Apache web server v2.0.52, MySQL v14.7 (Distrib 4.1.20), and XOOPS v2.2.2

My problem is with the Extended Profiles module.
I am running version: 0.1

Simply put, I cannot change my OWN password when Im logged in as an Administrator, but I can change my OWN password if I am logged in as a different Admin User.

It seems to me like a simple condition statement that was set so that the password fields do not show if you are an admin and you want to change your own pwd.

I looked up the code in forms.php in the following directory: modules/profile/include/

function getUserForm(&$user$action false) {
    global 
$xoopsConfig$xoopsModule$xoopsModuleConfig$xoopsUser;
    if (
$action === false) {
        
$action $_SERVER['REQUEST_URI'];
    }
    include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";
.
.
.
 if (
$xoopsUser->isAdmin() && $user->getVar('uid') != $xoopsUser->getVar('uid')) {
        
//If the user is an admin and is editing someone else
        
$pwd_text = new XoopsFormPassword('''password'1032);
        
$pwd_text2 = new XoopsFormPassword('''vpass'1032);
        
$pwd_tray = new XoopsFormElementTray(_PROFILE_MA_PASSWORD.''._PROFILE_MA_TYPEPASSTWICE);
        
$pwd_tray->addElement($pwd_text);
        
$pwd_tray->addElement($pwd_text2);
        
$elements[0][] = array('element' => $pwd_tray'required' => 0); //cannot set an element tray required
        
$weights[0][] = 0;
        
        
$level_radio = new XoopsFormRadio(_PROFILE_MA_ACTIVEUSER'level'$user->getVar('level'));
        
$level_radio->addOption(1_PROFILE_MA_ACTIVE);
        
$level_radio->addOption(0_PROFILE_MA_INACTIVE);
        
$level_radio->addOption(-1_PROFILE_MA_DISABLED);
        
$elements[0][] = array('element' => $level_radio'required' => 0);
        
$weights[0][] = 0;
    }

 
$elements[0][] = array('element' => new XoopsFormHidden('uid'$user->getVar('uid')), 'required' => 0);
    
$weights[0][] = 0;
    
$elements[0][] = array('element' => new XoopsFormHidden('op''save'), 'required' => 0);
    
$weights[0][] = 0;

    if (
$xoopsUser && $xoopsUser->isAdmin()) {
        
$xoopsModule->loadLanguage("admin");
.
.
.


As you can see if the user is an admin and is editing someone else he can change the password, but I want to be able to change the password if you are editing yourself as well.

I tried the following piece of code right after the if stmt:
/*    else if ($xoopsUser->isAdmin()) {
            //If the user is an admin and is editing himself
            $pwd_text = new XoopsFormPassword('', 'password', 10, 32);
            $pwd_text2 = new XoopsFormPassword('', 'vpass', 10, 32);
            $pwd_tray = new XoopsFormElementTray(_PROFILE_MA_PASSWORD.''._PROFILE_MA_TYPEPASSTWICE);
            $pwd_tray->addElement($pwd_text);
            $pwd_tray->addElement($pwd_text2);
            $elements[0][] = array('element' => $pwd_tray, 'required' => 0); //cannot set an element tray required
            $weights[0][] = 0;
            
            $level_radio = new XoopsFormRadio(_PROFILE_MA_ACTIVEUSER, 'level', $user->getVar('level'));
            $level_radio->addOption(1, _PROFILE_MA_ACTIVE);
            $level_radio->addOption(0, _PROFILE_MA_INACTIVE);
            $level_radio->addOption(-1, _PROFILE_MA_DISABLED);
            $elements[0][] = array('element' => $level_radio, 'required' => 0);
            $weights[0][] = 0;
        }


It works so much as to place the fields in the form and says that it updated the profile correctly when I change the password but when I try my new password it doesn't work, it didn't update the password :(

I tried changing the else if stmt to
($xoopsUser->isAdmin() && $user->getVar('uid') == $xoopsUser->getVar('uid'))


Doesn't update either.

Does anyone know if I should be doing any other mods in the code somewhere else?
I am not the one who installed XOOPS and this module particularly. And I don't know if the web developer changed the code explicity for security purposes or some other reason.

Any help would be appreciated!

Regards,
Patrick S.
Web Developer
Tektronix.com*/

2
boumbo
Re: How to add password fields in the Extended Profile
  • 2007/2/16 15:39

  • boumbo

  • Just popping in

  • Posts: 37

  • Since: 2006/9/25


Is there something that I can provide to make my question clearer?

3
vaughan
Re: How to add password fields in the Extended Profile
  • 2007/2/16 18:32

  • vaughan

  • Friend of XOOPS

  • Posts: 680

  • Since: 2005/11/26


xoops 2.2.2 is quite old and very buggy.

upgrading to the latest 2.2.5 rc1 will fix many bugs and security issues. hopefully the password will be 1 of the bugs that's fixed.. i should try that 1st, you might not even have to mess about with code then ;)

4
boumbo
Re: How to add password fields in the Extended Profile
  • 2007/2/16 18:50

  • boumbo

  • Just popping in

  • Posts: 37

  • Since: 2006/9/25


Quite frankly, I am new to XOOPS and Im afraid something goes wrong in the upgrade with the existing functionality that I have.

Another thing is, Im having a hard time finding precise documentation on doing a proper upgrade from 2.2.2 to 2.2.5

5
boumbo
Re: How to add password fields in the Extended Profile
  • 2007/2/20 18:21

  • boumbo

  • Just popping in

  • Posts: 37

  • Since: 2006/9/25


Is there a proper upgrade from XOOPS 2.2.2 to 2.2.5 ?

Regards,

Pat.

Login

Who's Online

183 user(s) are online (106 user(s) are browsing Support Forums)


Members: 0


Guests: 183


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits