Home › Forums › General Issues › User field, front end button add user to field and update user › Reply To: User field, front end button add user to field and update user
Initial thoughts would be needing:
– User ID for current user (you’d be updating the meta for this user with the followed user’s ID) — something like get_current_user_id()
– User ID of user being viewed (value that would be added to the meta key of the logged in user if they click the button)
With those bits of data, you could likely:
– use get_user_meta() to grab the current IDs (if any) of the field storing followed/liked users from the current logged in user
– use something like maybe array_push to add the user ID of the user being viewed to the logged in user’s followed/liked group
– update_user_meta() with the new value
If you have a function written that does this, the function could then be triggered with the button click. Not sure if any of this is helpful but hopefully 🙂
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!
© 2023 Advanced Custom Fields.