Support

Account

Home Forums Feature Requests Support role-based conditions on user creation

Solving

Support role-based conditions on user creation

  • When adding custom fields to the user form, the role-based conditional include does not work on initial user creation. It only hides and shows after the user is created, on the edit user screen.

    Steps to Reproduce:

    1. Create a custom field group with at least one field
    2. Under Location, set User – is not equal to – Subscriber and save
    3. Click Add User
    4. Change the role – the custom field should appear and disappear based on role selection, but it doesn’t
  • Hi @Kevin

    Thanks for the bug report. This is a current limitation of ACF v4, but will be fixed in the upcoming v5!

    Thanks
    E

  • Hi, I’m trying to use this feature also. I have a simple form group with 3 fields that I want displayed when users are being created or edited based on a specific role being chosen.

    I just purchased pro the other day and 2/27/2015 and I’m on v5.1.9.1 of the pro plugin.

    The fields show up successfully on edit of a user but not on role selection while creating a user.

    My location rules are very simple:

    – User Role is equal to Agent

    No other rules, and like I said, it shows up perfectly when editing an existing user just not on creation. Please let me know if I’m doing something wrong here. Also please let me know if you need any further information.

    Thanks,

    Alan

  • Wow, I am crazy, it’s not actually showing up on the edit page either. I believe I tested this with the standard version and it worked but I hadn’t tested this on the pro version. So I can’t see my fields while on the creation or the edit page of the user. I’m guessing I’m just using the wrong location settings.

    Alan

  • We are having the same problem. The field group shows up correctly for already created users based on their role but does not show on user creation or when changing the role for an existing user.

    We are using WordPress 4.4.2 and ACF PRO 5.3.5.

    Any help will be greatly appreciated!

  • +1 for adding this feature!!

  • I have come up with a dirty solution that works by triggering an AJAX action when the role is changed, then either sets the default role (user-new.php) or updates the user’s role (user-edit.php) and finally refreshes the page.

    See here: https://gist.github.com/lewebsimple/50848bbc05ec8961bf907f5c50a9d0c3

    We really need ACF to support this OOTB, if it’s possible for dynamic category selections it should be easy to add this to the role selection as well.

  • Hi all,
    I imagine this is pretty dead, but is there any update on this feature being implemented?

  • Hey,
    we also just noticed that this is not possible yet.
    Might be a misconception but I thought it would be possible already and included in ACF.

    What’s working though is that the role based user meta fields are displayed on user creation form if theses fields are connected to the default user role.

    But, the ACF fields won’t hide or change if the user role select value changes here.
    Is this a planned feature or even worked on, maybe?

    Thanks!

  • public class RolesAccess implements Serializable {

    public String getUserPrincipalName() {
    FacesContext context = FacesContext.getCurrentInstance();
    Principal principal = context.getExternalContext().getUserPrincipal();
    if(principal == null) {
    return null;
    }
    return principal.getName();
    }

    public String getUser() {
    FacesContext context = FacesContext.getCurrentInstance();
    return context.getExternalContext().getRemoteUser();
    }

    public boolean isManager() {
    FacesContext context = FacesContext.getCurrentInstance();
    return context.getExternalContext().isUserInRole(“manager”);
    }

    }

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Support role-based conditions on user creation’ is closed to new replies.