Thursday, October 29, 2009

Re: Problems cakephp 1.2.5

i know that when i switch to cake 1.2.0 7962 Final it works just fine
when i switch to 1.2.5 it dose that here is the code when a user
register it sends email to that user

and how come it empty when i can see data stored in database

function afterSave($created) {
if ($created) {
$this->sendMail($this->id);
}

}
function sendMail($conditions = array()) {
if (is_numeric($conditions)) {
$id = $conditions;
} elseif (is_string($conditions)) {
$id = $this->field('id', array('User.email' => $conditions));
} else {
$id = $this->field('id', $conditions);
}
if (!$id) {
return false;
}
$data = array(
'id' => $id,
'email_token' => $this->generateToken(),
'email_token_expires' => date('Y-m-d H:i:s', time() + DAY)
);
if ($this->save($data)) {
$data = $this->read();
$MiEmail = ClassRegistry::init('MiEmail');
$MiEmail->create();
$MiEmail->send(array(
'from_user_id' => 0,
'to_user_id' => $this->id,
'to' => "{$data['User']['first_name']} {$data['User']
['last_name']} <{$data['User']['email']}>",
'template' => 'users/welcome',
'data' => $data,
'subject' => __('Welcome New User, true)
));
return true;
} else {
return false;
}
}


On Oct 28, 11:13 am, Miles J <mileswjohn...@gmail.com> wrote:
> Well then theres your problem. Figure out why user is empty. Should of
> probably debugged that before blaming extract.
>
> On Oct 28, 9:37 am, Sergio Silva <ssil...@gmail.com> wrote:
>
>
>
> > $data   =       array(
> >        "User" => null
> > )
>
> > User data is null!!
>
> > 2009/10/28 Simon <simon_d...@hotmail.com>:
>
> > > ___viewFn       =       "C:\xampp\htdocs\one\vendors\base\views\elements\email\html
> > > \users/welcome.ctp"
> > > $___dataForView =       array(
> > >        "content" => "",
> > >        "html" => HtmlHelper
> > > HtmlHelper::$tags = array
> > > HtmlHelper::$base = NULL
> > > HtmlHelper::$here = NULL
> > > HtmlHelper::$params = array
> > > HtmlHelper::$action = NULL
> > > HtmlHelper::$data = array
> > > HtmlHelper::$_crumbs = array
> > > HtmlHelper::$__docTypes = array
> > > HtmlHelper::$helpers = NULL
> > > HtmlHelper::$webroot = NULL
> > > HtmlHelper::$themeWeb = NULL
> > > HtmlHelper::$plugin = NULL
> > > HtmlHelper::$namedArgs = NULL
> > > HtmlHelper::$argSeparator = NULL
> > > HtmlHelper::$validationErrors = NULL
> > > HtmlHelper::$__tainted = NULL
> > > HtmlHelper::$__cleaned = NULL
> > > HtmlHelper::$_log = NULL
> > > HtmlHelper::$name = "HtmlHelper",
> > >        "session" => SessionHelper
> > > SessionHelper::$helpers = NULL
> > > SessionHelper::$__active = true
> > > SessionHelper::$valid = false
> > > SessionHelper::$error = false
> > > SessionHelper::$_userAgent = "c82e7b6a933757f629da37bc1114e73f"
> > > SessionHelper::$path = "/"
> > > SessionHelper::$lastError = NULL
> > > SessionHelper::$security = NULL
> > > SessionHelper::$time = 1256747395
> > > SessionHelper::$sessionTime = false
> > > SessionHelper::$watchKeys = array
> > > SessionHelper::$id = NULL
> > > SessionHelper::$_log = NULL
> > > SessionHelper::$base = NULL
> > > SessionHelper::$webroot = NULL
> > > SessionHelper::$here = NULL
> > > SessionHelper::$params = array
> > > SessionHelper::$action = NULL
> > > SessionHelper::$data = array
> > > SessionHelper::$themeWeb = NULL
> > > SessionHelper::$plugin = NULL
> > > )
> > > $loadHelpers    =       true
> > > $cached =       false
> > > $loadedHelpers  =       array(
> > >        "Html" => HtmlHelper
> > > HtmlHelper::$tags = array
> > > HtmlHelper::$base = NULL
> > > HtmlHelper::$here = NULL
> > > HtmlHelper::$params = array
> > > HtmlHelper::$action = NULL
> > > HtmlHelper::$data = array
> > > HtmlHelper::$_crumbs = array
> > > HtmlHelper::$__docTypes = array
> > > HtmlHelper::$helpers = NULL
> > > HtmlHelper::$webroot = NULL
> > > HtmlHelper::$themeWeb = NULL
> > > HtmlHelper::$plugin = NULL
> > > HtmlHelper::$namedArgs = NULL
> > > HtmlHelper::$argSeparator = NULL
> > > HtmlHelper::$validationErrors = NULL
> > > HtmlHelper::$__tainted = NULL
> > > HtmlHelper::$__cleaned = NULL
> > > HtmlHelper::$_log = NULL
> > > HtmlHelper::$name = "HtmlHelper",
> > >        "Session" => SessionHelper
> > > SessionHelper::$helpers = NULL
> > > SessionHelper::$__active = true
> > > SessionHelper::$valid = false
> > > SessionHelper::$error = false
> > > SessionHelper::$_userAgent = "c82e7b6a933757f629da37bc1114e73f"
> > > SessionHelper::$path = "/"
> > > SessionHelper::$lastError = NULL
> > > SessionHelper::$security = NULL
> > > SessionHelper::$time = 1256747395
> > > SessionHelper::$sessionTime = false
> > > SessionHelper::$watchKeys = array
> > > SessionHelper::$id = NULL
> > > SessionHelper::$_log = NULL
> > > SessionHelper::$base = NULL
> > > SessionHelper::$webroot = NULL
> > > SessionHelper::$here = NULL
> > > SessionHelper::$params = array
> > > SessionHelper::$action = NULL
> > > SessionHelper::$data = array
> > > SessionHelper::$themeWeb = NULL
> > > SessionHelper::$plugin = NULL
> > > )
> > > $helper =       "Session"
> > > $camelBackedHelper      =       "session"
> > > $html   =       HtmlHelper
> > > HtmlHelper::$tags = array
> > > HtmlHelper::$base = NULL
> > > HtmlHelper::$here = NULL
> > > HtmlHelper::$params = array
> > > HtmlHelper::$action = NULL
> > > HtmlHelper::$data = array
> > > HtmlHelper::$_crumbs = array
> > > HtmlHelper::$__docTypes = array
> > > HtmlHelper::$helpers = NULL
> > > HtmlHelper::$webroot = NULL
> > > HtmlHelper::$themeWeb = NULL
> > > HtmlHelper::$plugin = NULL
> > > HtmlHelper::$namedArgs = NULL
> > > HtmlHelper::$argSeparator = NULL
> > > HtmlHelper::$validationErrors = NULL
> > > HtmlHelper::$__tainted = NULL
> > > HtmlHelper::$__cleaned = NULL
> > > HtmlHelper::$_log = NULL
> > > HtmlHelper::$name = "HtmlHelper"
> > > $session        =       SessionHelper
> > > SessionHelper::$helpers = NULL
> > > SessionHelper::$__active = true
> > > SessionHelper::$valid = false
> > > SessionHelper::$error = false
> > > SessionHelper::$_userAgent = "c82e7b6a933757f629da37bc1114e73f"
> > > SessionHelper::$path = "/"
> > > SessionHelper::$lastError = NULL
> > > SessionHelper::$security = NULL
> > > SessionHelper::$time = 1256747395
> > > SessionHelper::$sessionTime = false
> > > SessionHelper::$watchKeys = array
> > > SessionHelper::$id = NULL
> > > SessionHelper::$_log = NULL
> > > SessionHelper::$base = NULL
> > > SessionHelper::$webroot = NULL
> > > SessionHelper::$here = NULL
> > > SessionHelper::$params = array
> > > SessionHelper::$action = NULL
> > > SessionHelper::$data = array
> > > SessionHelper::$themeWeb = NULL
> > > SessionHelper::$plugin = NULL
> > > $content        =       ""
> > > $data   =       array(
> > >        "User" => null
> > > )
>
> > > On Oct 28, 9:16 am, Sergio Silva <ssil...@gmail.com> wrote:
> > >> Could you paste here the content of $data['User'] using debug($data['User']) ?
>
> > >> It seems empty
>
> > >> 2009/10/28 Simon <simon_d...@hotmail.com>:
>
> > >> > extract ($data['User']) ?>
> > >> > <?php echo trim($first_name); ?>
>
> > >> > this is in email template in email i get these errors
>
> > >> > Undefined variable: first_name
> > >> > extract() [function.extract]: First argument should be an array
>
> > >> > On Oct 28, 8:56 am, Sergio Silva <ssil...@gmail.com> wrote:
> > >> >> debug($data['User']) ?
>
> > >> >> 2009/10/28 Simon <simon_d...@hotmail.com>:
>
> > >> >> > extract() [function.extract]: First argument should be an array
>
> > >> >> > it used to work with cakephp 1.2.0.7962 Final  any idea- Hide quoted text -
>
> > >> >> - Show quoted text -- Hide quoted text -
>
> > >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: