• Resolved wmarsh95

    (@wmarsh95)


    What would be the right code for a plugin to get grab a person’s specific value from an ACF field added at registration for an if-then statement as well if it’s multiple choices? An example would be if there was metadata field is for a state and then person selects New Jersey then they will be added automatically to the New Jersey group. Or they can pick NJ and PA and be added to both groups.

    Right now it adds all of the options in the code.

    I’m using this as the base: https://github.com/eggemplo/Users-auto-Group

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    In short I would say that this depends on how the custom fields are stored by ACF. If they are stored as user_meta or post_meta, then you should use WordPress API functions( easier, safer, quicker ).
    If ACF stores data in its own tables in the db then it’s better to have a look at their API, if provided.

    If on the other hand, you use a third-party registration form using another plugin, then you need to hook to that and get the submitted data. From the submitted data you should then find the data needed for your implementation and move forward to groups handling.

    Once you get the metadata, it’s easy to compare the value with an already set array of your values and update the group(s) accordingly, as demonstrated in Antonio’s implementation.

    For example, I found this on ACF’s documentation, on how to retrieve a user field which might be useful.

    Kind regards,
    George

    Thread Starter wmarsh95

    (@wmarsh95)

    Thanks George! Upon looking more into your site, I noticed you have a plugin for gravity forms that would do this as well as a plugin for affiliates for formidable. Would it be possible to have a version of the gravity form plugin but with formidable?

    Thanks!

    You are welcome.

    Sorry but at the moment we only offer an integration for Gravity Forms.
    If you can fit Groups Gravity Forms integration on your setup, you already know where to find it.:)
    I will keep a note of your request but can’t give an ETA for when and if this will be implemented.

    If you still need guidance on how to implement it based on your original question, feel free to ask for more info here.

    Kind regards,
    George

    Plugin Author Kento

    (@proaktion)

    Hi guys,

    Certainly an interesting idea to integrate Groups and Formidable, thanks for the suggestion, note taken!

    As a solution to the original question, I would simply suggest to use Groups’ API once the metadata is known. The first example on the Examples documentation page shows how.

    Cheers

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add user to group via metadata’ is closed to new replies.