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 » support » symfony 1.3 and 1.4 » Impossible to write a simple : setIsActivated() function
icon8.gif  Impossible to write a simple : setIsActivated() function [message #103444] Tue, 03 August 2010 02:22 Go to previous message
anxious  is currently offline anxious
Messages: 38
Registered: June 2010
Location: France
Member
Hello, it's been 1h30 that we're working on a SIMPLE function that do not work Very Happy

I'm on the backend, and i need to validate offers to make them appear public on the wesite. (plus, it send a mail to alert the user)

either it doesn't save (i click on activate, then save, it doesn't send the mail and it doesn't save the is_activated = true.



public function setIsActivated($value)
	{

	  if ($value == false)
	  {

	    sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');

	    $email = $this->getSfGuardUser()->getProfile()->getEmail();
	    $message = sfContext::getInstance()->getMailer()->compose(
	                            'no-reply@site.com',
	                            $email,
	                            'your offer has been published / votre offre à été publiée',
	                            get_partial('newsletter/activation_offre')
	    );

	    $message->setContentType('text/html');

	    sfContext::getInstance()->getMailer()->send($message);
			$this->isActivated = true;
			$this->save();
	  } else {

	 	$this->isActivated = false;
		$this->save();
		}
	}




Thanks for your help !


[Updated on: Tue, 03 August 2010 14:31]

Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:problem by accessing the module-index
Goto Forum:

  

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