mibuthu / wp-comment-guestbook

Wordpress Plugin to add a guestbook site which uses the wordpress integrated comments
https://wordpress.org/plugins/comment-guestbook/
4 stars 3 forks source link

eval()'d issue #34

Closed Thanerik closed 8 years ago

Thanerik commented 9 years ago

I began to receive those PHP notice issues:

[23-Aug-2015 18:48:43 UTC] PHP Notice:  Undefined variable: commenter in /var/www/www.dovania.dk/www/wp-content/plugins/comment-guestbook/includes/comments-functions.php(244) : eval()'d code on line 4
[23-Aug-2015 18:48:43 UTC] PHP Notice:  Undefined variable: commenter in /var/www/www.dovania.dk/www/wp-content/plugins/comment-guestbook/includes/comments-functions.php(244) : eval()'d code on line 8

I don't know where I should look at in the code to solve the error.

mibuthu commented 8 years ago

see also https://wordpress.org/support/topic/evald-issue?replies=3#post-7650618

mibuthu commented 8 years ago

It seems that you have an invalid value in the option "Comment form args" (see Settings -> Guestbook -> Comment-form settings -> Comment form args) Have you changed something there? Can you please provide the option text?

Thanerik commented 8 years ago

Yes, my option text is such:

array(
  'fields' => apply_filters( 'comment_form_default_fields', array(
    'author' => '<div class="form-wrap"><label for="author">Dit navn <span class="req-symbol">*</span></label><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .'" /></div>',
    'email' => '<div class="form-wrap"><label for="email">Din email <span class="req-symbol">*</span></label><input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .'" size="30" /></div>',
  )),
  'comment_field' => '<div class="form-wrap"><label for="comment">' . _x( 'Comment', 'noun' ) . ' <span class="req-symbol">*</span></label><textarea id="comment" name="comment" aria-required="true"></textarea></div>',
  'comment_notes_before' => '<p class="mini">I henhold til offentlighedsloven vil anonyme indlæg blive slettet - og det samme gælder indlæg, der ikke overholder en sober tone. Din email adresse vil ikke blive offentliggjort. Krævede felter er markeret med *</p>',
  'comment_notes_after' => '',
  'class_submit' => 'btn-dovania btn-commentar',
  'title_reply' => '<h2>Skriv en indlæg</h2>'
)

I haven't changed anything there, but maybe there are some error in my option args?

mibuthu commented 8 years ago

The problem is, that a variable with the name $commenter is not available. From where do you have this code?

Thanerik commented 8 years ago

Now I see! I used the same code as that from the comment template in the regular commentar-section in my site. It defined that $commenter = wp_get_current_commenter();.

$comment->comment_author and $comment->comment_author_email doesn't work, because $comment is not defined either...

Thanerik commented 8 years ago

But it's not that important to gathering the users informations from the cookie anyway. So I'm dropping the value inserting code, and just start the form blank.