[wp-trac] [WordPress Trac] #16576: comment_form() fields being displayed only for non logged in users

WordPress Trac noreply at wordpress.org
Thu Nov 6 00:44:33 UTC 2014


#16576: comment_form() fields being displayed only for non logged in users
-------------------------------------------------+-------------------------
 Reporter:  maorb                                |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Comments                             |  Review
 Severity:  normal                               |     Version:  3.0.5
 Keywords:  dev-feedback has-patch needs-        |  Resolution:
  testing                                        |     Focuses:
-------------------------------------------------+-------------------------
Changes (by valendesigns):

 * keywords:  dev-feedback => dev-feedback has-patch needs-testing


Comment:

 I've added a patch that's a bit different than both of my previous
 suggestions.

 I moved all of the `fields` related code out of the `else` block following
 the `if ( is_user_logged_in() )` condition; it now comes directly after
 the `endif` for that code block. Then added a check for
 `is_user_logged_in()` inside the `$args['fields']` loop that will skip the
 'author', 'email', & 'url' array keys. Which means custom fields will be
 displayed to both sets of users, but the default fields will only be
 visible to those not logged in. This way we don't need any extra
 documentation or to add arguments to the `comment_form()` function.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/16576#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list