Jory Hogeveen
Forum Replies Created
-
Forum: Plugins
In reply to: [View Admin As] Use plugin on a custom role but limit on shopmanagerHi @tanasi
Sorry, I always forget to mention that filters made for this plugin should be added as a plugin or even better, as a mu-plugin. With the latter you can just put the same code in a PHP file and put it a
/wp-content/mu-plugins
.Since the code for VAA runs so early, adding it in your theme will be to late as all validations have run already.
It might be a nice addon to the plugin to be able to edit them using the UI.
Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] Use plugin on a custom role but limit on shopmanagerHi @tanasi
Thank you! And yes, this is definitely possible.
In fact, it’s always recommended to limit the capabilities if you are allowing users to create/edit users.Luckily, WordPress core has a built-in filter for this:
editable_roles
: https://developer.www.ads-software.com/reference/hooks/editable_roles/Example (see also level_# example in doc page above):
add_filter( 'editable_roles', function( $roles ) { $user = wp_get_current_user(); // Define your logic to enable/disable role edits for the current user. // For example: if ( in_array( 'seller', $user->roles ) ) { $roles = [ 'subscriber', 'editor' ]; // Only allow viewing subscriber and editor. } return $roles; } );
Note that some plugins allow you to add multiple roles to a user, this will require you to improve the code above to validate all the user roles instead of just one.
Hope this helps!
Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] Issue with url parameters for adminsAwesome, since it’s almost weekend I’ve scheduled the release for next week ??
Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] Issue with url parameters for adminsHi @johannesdb
Perfect, could you please confirm whether the patch works for you or not? If so, I will release a.s.a.p.!
Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] Issue with url parameters for adminsHi @johannesdb
You are absolutely right, this method is also run on the front-end since the default WordPress core handler only runs on the admin.
I’ve added a path to the next dev version that only runs this code if there is an actual removable get variable present in the URL (for reset purposes etc.)
Patch: https://github.com/JoryHogeveen/view-admin-as/commit/09be711b739ae205d8322c04b6347231283b60df
PR: https://github.com/JoryHogeveen/view-admin-as/pull/131
Let me know if this works for you!
Edit: Just sideinfo, it appears that your URL structure isn’t compatible with WP core query methods (in this case
remove_query_arg
or maybeesc_url
).Cheers, Jory
- This reply was modified 7 months, 1 week ago by Jory Hogeveen. Reason: Sideinfo
Hi @jazkat
Custom field are not properties of the product object. Please see core documentation on retrieving metadata: https://developer.www.ads-software.com/reference/functions/get_post_meta/
Or check the Pods functions https://docs.pods.io/code/field-functions/pods_field/
Cheers, Jory
Forum: Plugins
In reply to: [Pods SEO] WooCommerce Product Category Custom FieldHi @one3rdnerd
Sorry for my late reply.
So to be short, this plugin really needs some attention apparently since it seems that the plugin options, as well as the analysis compatibility is not up to date anymore unfortunately.I already created a patch to make the field options compatible with newer Pods versions: https://github.com/pods-framework/pods-seo/pull/20/files
Actually, it seems that all fields should be enabled by default. The options only let you exclude fields from analysis.
Unfortunately, due to high demand in support for the main plugin I cannot give you any pointers as to when the analysis part will be updated for the latest Yoast SEO versions.
Edit: please also see this page: https://yoast.com/help/add-custom-fields-to-yoast-seo-premium-plugin-settings/
It mentions that you can include fields within Yoast SEO yourself, you could try that?Cheers, Jory
- This reply was modified 7 months, 1 week ago by Jory Hogeveen.
Hi @vi54
This sounds like it might be a compatibility issue with another plugin, please verify!
https://docs.pods.io/faqs/plugin-theme-conflicts/Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] Issue with url parameters for adminsHi @johannesdb
Just a quick test before and further debugging since I have an idea what would be the cause.
Could you disable this line? https://github.com/JoryHogeveen/view-admin-as/blob/master/ui/class-ui.php#L56
You can just comment it and it should be fine. (add “//” before it).
Let me know if this changes anything!Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] Issue with url parameters for adminsHi @johannesdb
Before I dive into this, are you sure this problem is related to this plugin? Does the same thing happen when all other plugins are deactivated and you are running on a default theme?
I ask this because this plugin doesn’t modify the URL, it only registers a few plugin related keys for auto-removal which is handled by WordPress core.
Cheers, Jory
Hi @rico34
Please check the Pod access settings, it seems that you didn’t allow these manual SQL options for this post type.
Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] New User Types aren’t searchable for Shop ManagersHi?@billium99
I didn’t get a reply from you anymore so I will assume that this issue is solved.
Hit me up if you need help in the future! And of course, a nice review or contribution would be very much appreciated!Cheers, Jory
Forum: Plugins
In reply to: [Pods SEO] WooCommerce Product Category Custom FieldHi @one3rdnerd
This plugin should add an option to your fields to include it in the SEO plugin analysis, isn’t that showing or working?
Cheers, Jory
Forum: Plugins
In reply to: [View Admin As] New User Types aren’t searchable for Shop ManagersHi @billium99
Since VAA runs very early you cannot do this in your theme.
I think it’s best to either create a plugin or a mu-plugin for this with the following code:add_filter( 'editable_roles', function( $roles ) { remove_filter( 'editable_roles', 'wc_modify_editable_roles' ); return $roles; }, 1 );
Notice the “1” as a third priority parameter. This wil run this function before the one from WooCommerce so that it will always remove before it can run.
Alternatively you could also leave the WooCommerce filter as is and modify the roles which a Shop Manager can edit:
add_filter( 'woocommerce_shop_manager_editable_roles', function( $roles ) { $roles[] = 'Your role'; $roles[] = 'Your second role'; return $roles; } );
Hope this helps!
Cheers, Jory
- This reply was modified 8 months ago by Jory Hogeveen.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Website (repeatable) titleHi @mrushhcm
Ah now I understand!
In fact, I did create a Link field in the past but this was never included in Pods core because there was simply a lot more other things to do.
I have absolutely no idea if it would support the new repeater options from Pods but you could try it out. https://github.com/JoryHogeveen/pods-link-field.
See feature request/discussion here: https://github.com/pods-framework/pods/discussions/6613Unfortunately Pods doesn’t support a group field (subfield-group) so your only other (solid) option would be to define a fixed number of title and website fields.
Cheers, Jory