When trying to create a new user in Drupal, og field access gets called to limit field access. This causes custom fields not to show up on the user registration form.

In og_field_access_field_access the following line is called:
if (!$id && $op == 'edit' && (og_is_group($entity_type, $entity) || og_is_group_content_type($entity_type, $bundle)))
og_is_group_content_type() evaluates to true for users, which causes the if sentence to be true when the user registration form is created.

In that if-body only users with groups can ever return true. But the user is 0, as the user is of cause not logged in, when trying to create a new user.

I would suggest a check for entity type user and then user id 0. If so skip the if sentence. Works for me in my own little patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

> Works for me in my own little patch.

What patch? ;)
Does it happen in -dev version as-well?

checker’s picture

I can reproduce the same problem in current dev version.

RoySegall’s picture

Status: Active » Needs review
FileSize
1016 bytes

If so skip the if sentence.

I think that his is what you mean by that.

Status: Needs review » Needs work

The last submitted patch, access-denied-for-fields-user-registration-form-1529776-3.patch, failed testing.

amitaibu’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, access-denied-for-fields-user-registration-form-1529776-3.patch, failed testing.

checker’s picture

Just asking if this patch grant access to all user profile fields for a anonymous user?

amitaibu’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, access-denied-for-fields-user-registration-form-1529776-3.patch, failed testing.

Taxoman’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
amitaibu’s picture

Status: Needs work » Needs review
amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

TechNikh’s picture

Status: Closed (fixed) » Active

missing fields on user creation form for admin(who doesn't have administer groups permission) http://example.com/admin/people/create

TechNikh’s picture

Issue summary: View changes

Added "This causes custom fields not to show up on the user registration form."

  • amitaibu committed f831d0f on 8.x-1.x authored by RoySegall
    Issue #1529776 by RoySegall | lund.mikkel: Fixed Access denied to fields...