Buy Now
Sign in

WordPress bug?

Crams , February 13 2019, 19:28
Crams 38
February 13 2019, 19:28 #383867
Found this bug with CFv6 and WP 5
Not sure if it's actually a bug or a misconfiguration by yours truly but this is the deal, when the user is not logged in, the form will throw several php Notices like this:
Notice: Undefined property: stdClass::$ID in /home/user/public_html/wp-content/plugins/chronoforms6/cegcore2/libs/wordpress/app.php on line 131
Commenting the block of vars assigned to the array seems to solve the problem:
 if(empty($WP_User->data->roles) OR empty($G_User['groups']) OR (array_values($WP_User->data->roles) !== $G_User['groups']) OR empty($G_User['inheritance'])){
$user_session = array();
/* $user_session['id'] = $WP_User->data->ID;
$user_session['name'] = $WP_User->data->user_nicename;
$user_session['username'] = $WP_User->data->user_login;
$user_session['email'] = $WP_User->data->user_email;
$user_session['last_login'] = $WP_User->lastvisitDate;
$user_session['logged_in'] = (int)(bool)$WP_User->data->ID;
$user_session['guest'] = (int)!(bool)$WP_User->data->ID;
$user_session['groups'] = empty($WP_User->roles) ? array('public') : array_values($WP_User->roles);
$user_session['inheritance'] = array();
admin 28
February 19 2019, 18:49 #383979
Hi Crams,
Thank you, that was a bug!
Best regards
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!