This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » User management plugins » updateObject not working in sfGuardUserProfileForm
updateObject not working in sfGuardUserProfileForm [message #63551] Tue, 21 October 2008 06:02
jjkaye  is currently offline jjkaye
Messages: 1
Registered: June 2008
Junior Member
Hi, I'm not sure if anyone has run across this issue...

public function updateObject()
  {

    $object = parent::updateObject();

    if($object->getProfile()->getProfileImage()) 
    {
      $object->getProfile()->setProfileImage(str_replace(sfConfig::get('sf_upload_dir').'/', '/uploads/', $objectgetProfile()->getProfileImage()));
    } else {
      $object->getProfile()->setProfileImage($this->checkForExistingFile());
    }

    return $object;
  }


public function doSave($con = null)
  {

    if($file = $this->getProfileImage()) 
    {
      
      $filename = $this->getValue('username').$file->getExtension($file->getOriginalExtension());
      $file->save(sfConfig::get('sf_upload_dir').'/'.$filename);
    }
    
    return parent::doSave($con);
  }


public function checkForExistingFile()
  {
    if(is_null($v = sfGuardUserProfilePeer::retrieveByPk($this->object->getPrimaryKey()))) {
      return false;
    } else {
      return $v->getProfileImage() ? $v->getProfileImage() : null;
    }
  }


This is the code that I'm using to upload a file using the sfGuardUserProfile. I'm using a near replica of this code to also handle a file upload for a lightweight blog that module that I wrote.

This code executes perfectly in the other module, however within the sfGuardUserProfileForm.class.php it's as if it does not exist. I have tried just putting "echo" statements in the code just to see if it's getting called. None of these functions are getting called and I'm wondering if anyone has run into a similar issue when trying to use updateObject, on a sfGuardUserProfile object in conjunction with sfGuardPlugin.

Ideas???

Thanks.

-j.j.
Previous Topic:propel:build-sql don't generate sql file for sfGuardPlugin
Next Topic:sfGuard for frontend and backend
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software