• Resolved wmassjunction

    (@wmassjunction)


    I can’t seem to establish a bidirectional relationship between a field assigned to a CPT and a user. The brief documentation on your website seems to imply this is possible. However the field on the CPT does not display user names but everything else it could possibly connect to. User also doesn’t show up in the Post Type filter which I guess I don’t assume it would. The field on the user form/profile does show the selected posts. So relationship works one way but not both.

    Is this possible to accomplish? I have several other relationships set up without a problem.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    Yes, you can setup a Bidirectional setting between a User Field & a Post Object Field (or Relationship Field). Here is a video demo: https://i.imgur.com/fcmVwA7.mp4

    In order to make it works correctly, the User Field has to be displayed on the Page Screen, and the Post Object Field has to be displayed on the User Screen. Here are the Field Groups Json export from the demo video:

    If it still doesn’t works, then I would recommend to setup a clean WordPress install on your local environment with only ACF Pro & ACF Extended plugins, and test that simple bidirectional setting just like in the video. If it works on the clean install, then you probably have third party plugin/code that interfere with the Bidirectional Logic.

    In order to find what is causing the issue, you should clone your website on a local environment, so you can make make tests with peace of mind. I would recommend the Duplicator plugin, which is awesome & easy.

    Once installed, test your scenario without touching plugins, so you can confirm it’s not a production server problem. If the problem persists, disable all ACF plugins first, and test again. If it still persists, disable all plugins. And finally, if the problem is still there, switch to the native WP Twenty Twenty One theme.

    Hope it helps!

    Have a nice day.

    Regards.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Any news? Have you been able to test it?

    Regards.

    Thread Starter wmassjunction

    (@wmassjunction)

    Sorry, I didn’t get an email about your response for some reason.

    I have fields set to show on both the CPT and the User. The field on the User is able to read the field from the CPT fine but the field on the CPT doesn’t read the user. I haven’t tried it on a page so maybe it’s an issue with CPTs?

    All other relationships work fine between multiple CPTs, posts, pages, etc. It’s only the one connected to the User that I’ve had issues with.

    I guess I’ll make a clone and try to diagnose the issue when I have some time to spare.

    Thanks for your timely response

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    To make sure your setup is correct, can you please share some details about your setup (Name, Field Type, Location), provide some screenshots, or Json export the Field Groups? Do you have the same fields configuration as I have in my example (Post Object Field on User screen + User Field on Post Type screen)?

    Also, have you been able to reproduce the simple setup I’ve shown in the video, on a fresh WP install (in order to avoid any potential compatibility issues)?

    Regards.

    Thread Starter wmassjunction

    (@wmassjunction)

    It would actually be helpful if you could share screenshots of that install’s field groups settings. As I said the field in the CPT doesn’t show users at all. It shows posts, pages, settings, etc. Everything but Users. The one on the user page shows the CPTs that I’ve connected.

    I have been using relationship fields for awhile now with no issues. Every other field works fine on the site. It’s only the one between the User and CPT that has caused a problem. I also tried to set one up between a page and a user and that didn’t work either.

    The field that is supposed to display the users is called “Managing Member” with the slug of entity_managing_member the field on the CPT is called “Business or Organization You Represent” with a slug of member_entity

    They are both set to Post ID and bidirectional although I tried Post Object too. I have no filters set on the CPT field and only a post type filter set on the User field.

    I tried disabling User Role Editor thinking maybe that was causing a conflict but that didn’t help.

    I don’t really have time to set up a new install and do massive testing right now. I guess I’ll just keep using my workaround if you don’t have any ideas of how to quickly fix it.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the information. It looks like the problem come from the fact that you’re not using a “User” field on the Post Type screen.

    If you’re using a “Post Object” field there, it can not display users, since it’s a field that only display posts. You have to be sure to be using a “User” field type on the Post Type screen, and a “Post Object” field on the User screen, as explained in my previous answer.

    Here are the screenshots of the field groups:

    You’ll also find the Field Group json export, that you can import from the “Custom Fields > Tools” menu to have the correct field groups configured out of the box:

    Can you please confirm that you’re using the right Field Types on the right Screen?

    Regards.

    Thread Starter wmassjunction

    (@wmassjunction)

    That worked, thanks. I didn’t even realize there was a separate User Field. I misunderstood the documentation about bidirectional relationships. I didn’t realize that the User field and the Relationship field interacted with each other.

    Thanks for the clarification. I love the plugin but it would be helpful to have more documentation if you ever get a chance to add it.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I’m glad to hear that it works as expected ??

    I’ll try to add more use cases in the future.

    Have a nice day!

    Regards.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Bidirectional Relationships Btw Users and CPT’ is closed to new replies.