Module

Archived
Forum
(read-only)


For official support, visit the official support site »

Threaded Comments

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy

     

Submit errors, missing post fields

Support Request

mahernet
mahernet

Hi Yuri, also running into issues when submitting comments without the location, url, etc.

This is also the case for logged in users where only the comment field is submitted, everything else is left out.

The comment goes through but displays the following error when omitting the URL field for example.

[code[
A PHP Error was encountered

Severity: Notice

Message: Undefined index: url

Filename: threaded_comments/mod.threaded_comments.php

Line Number: 723

mahernet
# 1
mahernet

Yuri, here is the fix I applied which takes care of unset post data when creating the cookie. Here is the conditional with the included check (copied from the submit function.

if ($IN->post('save_info'))
        
{        
            
            
/*Check for valid post data or else fallback to session data*/
         
if ($SESS->userdata['member_id']==0)
         
{
             $name 
$this->EE->input->post('name'true);
             
$email =  $this->EE->input->post('email'true);
             
$url =  (isset($_POST['url'])) ? $this->EE->input->post('url'true) : '';
             
$location =  (isset($_POST['location']))?$this->EE->input->post('location'true):'';
         
}
         
else
         
{
             $name 
= ($SESS->userdata['screen_name']!='') ? $SESS->userdata['screen_name'$SESS->userdata['username']!='';
             
$email $SESS->userdata['email'];
             
$url $SESS->userdata['url'];
             
$location $SESS->userdata['location'];
         
}
        
            $FNS
->set_cookie('save_info',   'yes',              60*60*24*365);
            
$FNS->set_cookie('my_name',     $name,     60*60*24*365);
            
$FNS->set_cookie('my_email',   $email,    60*60*24*365);
            
$FNS->set_cookie('my_url',     $url,      60*60*24*365);
            
$FNS->set_cookie('my_location'$location60*60*24*365);
        
}
        
else
        
{
   $FNS
->set_cookie('save_info',   'no'60*60*24*365);
   
$FNS->set_cookie('my_name',     '');
   
$FNS->set_cookie('my_email',    '');
   
$FNS->set_cookie('my_url',      '');
   
$FNS->set_cookie('my_location''');