backdrop-contrib / domain

A domain-based access control system for Backdrop CMS
https://backdropcms.org/project/domain
3 stars 5 forks source link

Notice: Undefined index: domain_id in domain_get_node_defaults() (line 5046 of /app/docroot/modules/domain/domain.module). #7

Closed yorkshire-pudding closed 8 months ago

yorkshire-pudding commented 9 months ago

After applying the diff from #6 I was able to proceed past the bootstrap message.

View a node as admin.

This appears in log twice in same second

Notice: Undefined index: domain_id in domain_get_node_defaults() (line 5046 of /app/docroot/modules/domain/domain.module).

sudipto68 commented 8 months ago

I have also faced this issue. I have tried to debug and found that this block of code $_domain['domain_id'] gets value in the node edit/add form but in the case when we view the node, $_domain is getting as an empty array. So this Notice

Undefined index: domain_id

is showing on the node view page. I could solve this issue by just checking more on this block of codes(on line no 5045 in domain.module file):

if (isset($settings['DOMAIN_ACTIVE']) && !empty($_domain['domain_id'])) {
    $defaults['domain_id'][$_domain['domain_id']] = $_domain['domain_id'];
  }

But Why this is getting the value of $_domain in the node edit/add form but getting as an empty array in the node view page that is the question.

yorkshire-pudding commented 8 months ago

Thanks @sudipto68