lewismcarey / User-Field-ACF-Add-on

User Field Add on for Advanced Custom Fields
40 stars 19 forks source link

Problems to show users in admin #1

Closed eonlova closed 12 years ago

eonlova commented 12 years ago

Got this problem to show all users in my panel in admin, when "Filter by role" is set to "-All-" or when I select them all. In my panel, the administrators will show up.

What I have done is: In my functions.php I have this code

if(function_exists('register_field')) { register_field('Users_field', dirname(File) . '/admin/acf_addon/users_field.php'); }

When I have my Custom Field I add a field and choose 'User' as 'Field Type'. Mark all and save. And when I look at the posts panel only administrators will show up.

How ever I try to change the 'Filter by Role'-option only the ones that are Administrators will be displayed and selectable.

lewismcarey commented 12 years ago

Thanks for highlighting this. I am unable to recreate this however. Using -ALL- or selecting them all manually, all show up!

How many users do you have as other roles? Just checking you don't just have administrators ; ) Can you display any users of other roles. E.G. Does filtering to just Editors work at all? Have you any other plugins that could be causing a conflict? Does it show the role 'titles' in the option dropdown (Editor, Author etc). Which values have you selected (Allow Null, Multiple Values)? Finally, what version of WP and ACF are you running?

eonlova commented 12 years ago

1) No there is only me who is admin, but there is about 30 other users who is subscrbers, have test to change those to other roles width no effort. 2) Nope, just administrators 3) Might be so, have about 16 other plugins that are active 4) Just 'Administrators' no other 5) Allow null - [YES], Select multiple values? - [YES] 6) WP version 3.3.1 ACF version 3.1.4

lewismcarey commented 12 years ago

Thank you for getting back to me. I have installed this on a fresh installation and still can't replicate your problem.

What happens if you have two administrators. Does it show two administrators? Do you have any custom user roles or all just the default ones? Are you able to look at the HTML of the select field - does it appear broken? Can you get it to work on a second installation? Have you tried deactivating other plugins?

I'll try and output some information to a test version of the plugin so you can install that and let me know what it says.

eonlova commented 12 years ago

Could it be a problem that I use a custom post type? Can't see any other problems.

lewismcarey commented 12 years ago

Can you add to line 194-196 and send me a screenshot of the output (just above the select field @ page)

echo "<pre>";
print_r($field);
echo "</pre>";  
eonlova commented 12 years ago

Have sent you the pic.

Took a look at the code, shall it be like this?


 select id="fields[field_4f54c7717222d][]" class="users_field" name="fields[field_4f54c7717222d][]"  multiple="multiple" size="5"

I think the select-id and select-name looks funny with those brackets

lewismcarey commented 12 years ago

It appears I was translating the user role before passing it through as an argument to get the users from that role. That's why you had an issue and I didn't.

Can you fetch the latest commit and confirm it now works please.

Thank you for your patience and help solving this one.

eonlova commented 12 years ago

Great!

Now it works perfectly!!!