rico34
Forum Replies Created
-
Hi,
yes, but I went the custom code way and did not use the pods option field for that because I couldn’t find a way to get it working by using it.
Here’s the code I’ve used:
add_action('save_post', 'sync_relationship_field_with_taxonomy', 10, 3);
function sync_relationship_field_with_taxonomy($post_id) {
if (get_post_type($post_id) != 'your_post_type_name') {
return;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
if (wp_is_post_revision($post_id)) return;
$relationship_field = get_post_meta($post_id, 'your_pods_custom_field', true);
if (!empty($relationship_field)) {
// Sync the term to the taxonomy
$result = wp_set_post_terms($post_id, array($relationship_field), 'your_custom_taxonomy');
} else {
// Clear the taxonomy terms if no term is selected
$result = wp_set_post_terms($post_id, array(), 'your_custom_taxonomy')
}
}In my case I am using a custom field with radio buttons because I want the user to be able to choose only one option. So only one term of the custom taxonomy should be set.
This code works for my case. But I’m not sure if this is the best way to do that or if there are some flaws in that. I’m still testing things out.@pdclark is this a problem that the pods project can fix or is working on fixing?
I have just encountered the same problem which unfortunately I was not aware of before. For me and my website users it is important to know if the Block Editor will work together with the correct validation of required fields in the near future. People are getting used to use the Block Editor. So switching every website where I use custom fields back to the Tiny MCE editor is hard to explain to regular users.
I have not looked too much into the alternative suggested solution by using dfv-js-api. But an information on the future of this problem would be very much appreciated.It was version 4.0.23
Thanks a lot for your fast response! ??Hi Jory,
thanks a lot for your great explanation and answer! Very much appreciated!
Pods is a great plugin. Thank you very much for your work and support!
Hi Jory,
thanks a lot for your quick reponse! Very much appreciated.
I changed the setting under ‘Pods Admin’>’Settings’>’Allow SQL clauses to be used in Dynamic Features’ to ‘Restricted – Enable Simple SQL…’.
Now it works. But since I don’t want to give all content creators this SQL abilities, I will turn this off again. So to get my Pods template to show the content with an orderby sort I have to create and somehow use it with a custom php template I guess. Is my assumption correct?
Thank you,
ricoI have moved this to:
https://github.com/pods-framework/pods/issues/7290I just noticed something weird that makes the whole thing work with my previous created page and ‘Pods single item’-block.
On the page where I inserted the ‘Pods single item’-block under this blocks options on the right panel, initially I left the ‘SLUG OR ID’ field empty. Now when I put in anything random like ‘asdf123’ the content shows up.
Is this supposed to work like that? What’s the purpose of the block-options-field ‘SLUG OR ID’ if I can put any random stuff in there?
Kind regards
rico34I just tested some settings and I saw that in the Capabilites plugin the setting for the user role didn’t have ‘Media’ > ‘Edit’ acitvated. So I just turned it on and now the issue with the “spinning wheel” is resolved.
The settings from the Permissions plugin and the Capabilites plugin offer similar options for media files, which makes it a bit confusing and not that easy to set up.
I want to achieve that a user role can edit but not delete the media files from other users if the media file is attached to an editable post. But as soon as I activate ‘Allow editing other users uploads if attached to an editable post’ the user role is able to not only edit but also to delete, regardless of what is set up in the Capabilites plugin settings. Maybe there’s a way to achieve this? Or should I start a new thread?
Thanks a lot for your help and your great plugins!
Hi @rizaardiyanto,
I have recorded my screen so you can see it:
https://www.loom.com/share/75a1cecd743c495bb22a224fe12b1183?sid=37d89b7f-aea8-4ce5-92d5-861943a3e41f
Hi,
sorry, it took me a while to try it out. I just tried it and unfortunately it still is not working. I have installed PublishPress Permissions 3.11.1 and PublishPress Capabilities 2.10.0.
@kevinb I have installed the latest Permissions plugin version (3.10.0) and Capabilities (2.9.1), but the problem is still the same.
The issue is not resolved.
Hi @rizaardiyanto,
thank you very much. This is great!
Thanks a lot for your help and the great support!
Thanks a lot!