Home › Forums › General Issues › User Relationship
Working on a site where I am creating a “foodchain”. My goal is to relate the post to other authors basically. I was able to successfully use the user field inside of a repeater to get my concept working. However the relationship picker is a nicer solution.
Also just curious how would I go about customizing the user field or rather duplicating it so that I can change the selectable value from username to a custom field value I have added ie (company name). I haven’t even looked into it at all but if you can point me in the right direction that would be clutch.
I know I say it all the time, but your plugin is so cluuutch.
Hi @afgarcia86
There is a guide in the docs that will show you how to create a new custom field and register it to your website.
You can easily copy and paste 99% of the user field code into your own field.
Without knowing how your user is attached to a ‘company’, I can’t offer any advice on your question other than use the connection to find the company and add that to the create_field $choices
Cheers
E
Thanks for the tip @elliot. I was able to successfully clone the User field and change the value output for each choice with the company custom field added to each user. This will make it easier for the website users to develop the foodchain.
What are your thoughts on adding users to the “Relationship” field? I think it would be nicer then my drop down in a repeater solution. I tried to work it out on my end but the Relationship field was pretty heavy. Just a thought, I don’t need it but it would be neat to be able to use in the future.
Hi @afgarcia86
I think a better solution will be to create a AJAX powered option for the user and post_object fields.
This will be included into the core in the near future.
Thanks
E
The topic ‘User Relationship’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.