Closed fotiDim closed 8 years ago
Are you sure the error surfaces as a result of assigning the permission to the anonymous role? Or does it happen regardless of the permission?
Can I get a full stack trace of the error?
100% sure. It only happens on anonymous users when I give them any Avatarkit permission.
Can you suggest a way to generate the syslog?
Can you give ef02cfa a shot and see if it resolves your issue.
If you still are having issues:
Just tried ef02cfa
and it didn't solve the issue. I did what you suggested and this is the backtrace:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Database\InvalidQueryException: Query condition 'avatars_preview.uid IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 71 of core/lib/Drupal/Core/Database/Query/Condition.php).
Drupal\Core\Database\Query\Select->condition('avatars_preview.uid', Array, 'IN') (Line: 53)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 162)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 81)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 503)
Drupal\Core\Entity\EntityStorageBase->loadByProperties(Array) (Line: 116)
Drupal\avatars\Entity\AvatarPreview::getAvatarPreview(Object, Object) (Line: 140)
Drupal\avatars\AvatarManager->refreshAvatarGenerator(Object, Object, 0) (Line: 167)
Drupal\avatars\AvatarManager->refreshAllAvatars(Object) (Line: 102)
Drupal\avatars\Plugin\Field\FieldWidget\AvatarGeneratorPreviewWidget->formElement(Object, 0, Array, Array, Object) (Line: 324)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 85)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 168)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 54)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object, Object) (Line: 270)
Drupal\user\AccountForm->form(Array, Object, Object) (Line: 45)
Drupal\user\RegisterForm->form(Array, Object) (Line: 115)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 512)
Drupal\Core\Form\FormBuilder->retrieveForm('user_register_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('user_register_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 206)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 120)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 74)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Confirmed the exception is shown on the user registration form when:
Try this one.
Avatar preview will not work on the registration form because:
I advise that you hide the avatar generator field element from the user registration from.
The exception is gone now.
I would love to follow your advice but hiding the avatar generator field also hides it from logged in users. Is there a workaround for that?
Go to your user entity form display settings at /admin/config/people/accounts/form-display
You should see two tabs at the top, 'Default' and 'Register'. Just remove the form display from the 'Register' tab.
Super, that did the trick. I had to enable this setting to see the 'Register' tab:
@dpi from what I understand there is no point in giving any AvatarKit permission to anonymous users. Is that right?
Thats correct, anonymous users arn't yet supported #30
The user registration form exposed an issue because it is an in-between state. Wherein a user entity is ready to be created, but we cannot use it yet.
If I give any permission to an anonymous user I get