yueprofile
Forum Replies Created
-
Forum: Plugins
In reply to: [License Manager for WooCommerce] Adding custom field to Licenses PageHow about in admin menu, which ones are for that @drazenbebic thanks
Forum: Plugins
In reply to: [License Manager for WooCommerce] Adding custom field to Licenses PageAwesome I will look into those parts
Forum: Plugins
In reply to: [License Manager for WooCommerce] Backend for more User Roles than AdminI need the same feature, but after some research, I found
this can already be done by using this 2 plugin:https://www.role-editor.com
https://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/Forum: Plugins
In reply to: [License Manager for WooCommerce] API to get order email and nameCheck here
https://ww.wp.xz.cn/support/topic/update-license-property-by-code/in the second post I responded might help.
Forum: Plugins
In reply to: [License Manager for WooCommerce] Update License property by codeI have another question regarding the programmatically update a product to sell license keys
I figure I will have to update post meta of
lmfwc_licensed_product
lmfwc_licensed_product_delivered_quantity
lmfwc_licensed_product_assigned_generator
lmfwc_licensed_product_use_generator
lmfwc_licensed_product_use_stockIs there any other things need to be updated?
And if there is a small code example would be perfect, thanks!Forum: Plugins
In reply to: [License Manager for WooCommerce] Update License property by codeHi Drazen, it works! Thanks so much.
While working with this I found the filter for rest api is a bit clunky if you want to add multiple filters to it.
In license-manager-for-woocommerce/includes/api/Setup.php
public function preResponse( $method, $route, $data)
{
return $data;
}The result of the first round of execution will be passed into the first argument of the next execution of filter. So in the next execution, the $data from the last execution were pass into the $method variable, resulting next execution have 2 $data argument, and the original value of $method is lost.
Not sure if its perfect, but my solution is to exchange position of the arguments
so that the first argument is data, and other arguments will be preserved correctly in multiple filter executionspublic function preResponse( $data, $route, $method)
{
return $data;
}Then in license-manager-for-woocommerce/includes/abstracts/RestController.php
protected function response($success, $data, $code = 200, $route)
{
return new WP_REST_Response(
array(
‘success’ => $success,
‘data’ => apply_filters(‘lmfwc_rest_api_pre_response’, $data, $route, $_SERVER[‘REQUEST_METHOD’])
),
$code
);
}But since I’m not super familiar with WordPress, you might need to investigate a bit more to see if there is unintended bugs.