-
Notifications
You must be signed in to change notification settings - Fork 652
Allow Comments to be created with a passed author_ip
#1880
Conversation
…se` method and return error if invalid
|
@WP-API/amigos thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we added ip_address as a new format in our schema, so validation could happen much earlier (and in batch)?
|
Related core ticket: https://core.trac.wordpress.org/ticket/35276 |
|
Something I've been thinking about recently with regards to whether or not fields should be editable: import / export. If someone were to build a import / export workflow based on the REST API, which seems totally reasonable to me, it seems like a reasonable assumption they should be able to update most any fields for resources. |
@danielbachhuber, can you please add those thoughts to https://core.trac.wordpress.org/ticket/35276? Additional supporting opinions will help. |
|
In WP 4.5 this will no longer be blocked on core. I will pick this back up after release. |
|
@rachelbaker & @danielbachhuber Great job on the WP-API and thank you very much for all your contributions. Our team is currently blocked on this issue (more specifically the post comment part) and we would hate to branch out and patch it on our end. Is there any timeline or progress on this issue? |
Current coverage is 93.83%@@ develop #1880 diff @@
=======================================
Files 11 13 +2
Lines 3627 3766 +139
Methods 171 183 +12
Branches 0 0
=======================================
+ Hits 3430 3534 +104
- Misses 197 232 +35
Partials 0 0
|
New function `rest_is_ip_address()` checks if a value is a valid v4 IP address. It uses regex because core cannot guarantee support for `filter_var`.
Current coverage is 94.54%@@ develop #1880 diff @@
==========================================
Files 11 11
Lines 3627 3642 +15
Methods 171 171
Messages 171 0 -171
Branches 0 0
==========================================
+ Hits 3430 3443 +13
- Misses 197 199 +2
Partials 0 0
|
|
@WP-API/amigos This PR has been refreshed and is ready for review.
|
This PR allows the
comment_author_IPvalue to be set when creating a comment. While working on this, I remembered why we don't handle this field... while withwp_insert_comment()you can as of WP 4.3 set thecomment_author_IPBUT you cannot modify this field inwp_update_comment().Questions:
comment_author_IPvalue (currently127.0.0.1)?UPDATE:
This PR has been refreshed and as of WP 4.5 the
comment_author_ipproperty can be modified. View details on the refresh: #1880 (comment)Fixes #1788