maxm123
Forum Replies Created
-
Forum: Plugins
In reply to: [The Events Calendar] set_args @return incorrectHi Darian,
thank you for your reply! Have a good day 🙂
Forum: Plugins
In reply to: [The Events Calendar] set_args @return incorrectHi there,
we faced the same challenge, so I want to emphasize that this issue persists and contribute some details on the source of the problem. The change that introduced the typing chaos happens in Commit b428a91: Custom table repository (github).
The removal of create, save, delete (and various others) methods from the traditional interfaces in src/Tribe/Repository breaks the carefully constructed interface segregation and thus the typing of (fluent-applying) call sites. Those methods were moved to a new interface Repository_Interface in TEC\Common\Contracts which is not integrated into the type hierarchy except for a sub typing relation of the strongest interface Tribe__Repository__Interface.
Hope this helps 🙂
Forum: Plugins
In reply to: [The Events Calendar] Issue with REST-APIThe command is equivalent to the curl command
curl —-insecure —-user user:pass -X POST —-header “Content-Type: application/json” —-data ‘{…}’ https://ssv-volleyball.de/wp-json/tribe/events/v1/events
Where is- —-insecure to accept a self-signed HTTPS certificate
- —-user for basic authentication
- —-data for the POST body being set to the json object which is given above
I hope this helps 🙂
You can find the PR here.
I have further investigated this bug and it appears that there is a misunderstanding between the REST API and the rest of the plugin concerning the meaning of ‘EventHideFromUpcoming’.
Those are excerpts from some source files showing that the event is only considered hidden when ‘EventHideFromUpcoming’ isn’t present at all:
Tribe/Main.php # get_closest_event array( 'key' => '_EventHideFromUpcoming', 'compare' => 'NOT EXISTS', ), Tribe/Adjacent_Events.php # get_closest_event - the same thing [ 'key' => '_EventHideFromUpcoming', 'compare' => 'NOT EXISTS', ], Tribe/Repositories/Event.php # filter_by_hidden $this->by( (bool) $hidden ? 'meta_exists' : 'meta_not_exists', '_EventHideFromUpcoming', '#' );This works quite well for normal use of the events calendar as the HTTP request sent on save from the web UI doesn’t include the ‘EventHideFromUpcoming’ query param if it isn’t set (browsers seem to handle form ‘checkbox’ inputs like this).
But the REST API handles this field a bit differently:
Tribe/REST/V1/Endpoints/Single_Event.php: $postarr['EventHideFromUpcoming'] = tribe_is_truthy( $request['hide_from_listings'] ) ? 'yes' : false;where ‘false’ is converted to an empty string when saved to the db.
I have already written a fix for this which I’ll open a PR on Github for in a second. It modifies Tribe/REST/V1/Endpoints/Single_Event.php so that it doesn’t set ‘EventHideFromUpcoming’ on events at all.