{"id":560,"date":"2022-08-30T15:03:23","date_gmt":"2022-08-30T15:03:23","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/organic-groups-organizational-problem-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:03:23","modified_gmt":"2022-08-30T15:03:23","slug":"organic-groups-organizational-problem-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/organic-groups-organizational-problem-collection-of-common-programming-errors\/","title":{"rendered":"Organic groups organizational problem-Collection of common programming errors"},"content":{"rendered":"<p>Apologies if this question has already been answered. I&#8217;m developing an emergency notification site using Drupal 7 and Organic Groups and currently it&#8217;s building-driven &#8212; i.e., the buildings are the groups which have users connected to them. They can add notes, photos, etc. and all works well.<\/p>\n<p>Now it seems that it would be better to have an event-driven system. Admins could create an event (such as a hurricane) and then assign those buildings that are in the path of the event. I&#8217;ve tried creating a new Event content type and using the Entity Reference module, linking the Building list to the Event. However, when it comes time to create a View to display the information I&#8217;m running into the following error message when I build the view relationship using Entity Reference: Referenced Entity: SQLSTATE[42S22]: Column not found: 1054 Unknown column &#8216;og_membership.field_affected_buildings_target_id&#8217; in &#8216;on clause&#8217;<\/p>\n<p>Here is my exported view (note that it doesn&#8217;t have any fields yet but it does have the broken relationship):<\/p>\n<pre><code>$view = new view();\n$view-&gt;name = 'event_list';\n$view-&gt;description = 'Displays all emergency events with affected buildings.';\n$view-&gt;tag = 'default';\n$view-&gt;base_table = 'node';\n$view-&gt;human_name = 'Event List Test';\n$view-&gt;core = 7;\n$view-&gt;api_version = '3.0';\n$view-&gt;disabled = FALSE; \/* Edit this to true to make a default view disabled initially *\/\n\n\/* Display: Master *\/\n$handler = $view-&gt;new_display('default', 'Master', 'default');\n$handler-&gt;display-&gt;display_options['title'] = 'Events';\n$handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;\n$handler-&gt;display-&gt;display_options['access']['type'] = 'perm';\n$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';\n$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';\n$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';\n$handler-&gt;display-&gt;display_options['pager']['type'] = 'full';\n$handler-&gt;display-&gt;display_options['pager']['options']['items_per_page'] = '10';\n$handler-&gt;display-&gt;display_options['style_plugin'] = 'table';\n$handler-&gt;display-&gt;display_options['style_options']['grouping'] = array(\n  0 =&gt; array(\n    'field' =&gt; 'title',\n    'rendered' =&gt; 1,\n    'rendered_strip' =&gt; 0,\n  ),\n);\n$handler-&gt;display-&gt;display_options['style_options']['columns'] = array(\n  'title' =&gt; 'title',\n  'field_address' =&gt; 'field_address',\n);\n$handler-&gt;display-&gt;display_options['style_options']['default'] = '-1';\n$handler-&gt;display-&gt;display_options['style_options']['info'] = array(\n  'title' =&gt; array(\n    'sortable' =&gt; 0,\n    'default_sort_order' =&gt; 'asc',\n    'align' =&gt; '',\n    'separator' =&gt; '',\n    'empty_column' =&gt; 0,\n  ),\n  'field_address' =&gt; array(\n    'sortable' =&gt; 0,\n    'default_sort_order' =&gt; 'asc',\n    'align' =&gt; '',\n    'separator' =&gt; '',\n    'empty_column' =&gt; 0,\n  ),\n);\n\/* Relationship: Entity Reference: Referenced Entity *\/\n$handler-&gt;display-&gt;display_options['relationships']['field_affected_buildings_target_id']['id'] = 'field_affected_buildings_target_id';\n$handler-&gt;display-&gt;display_options['relationships']['field_affected_buildings_target_id']['table'] = 'og_membership';\n$handler-&gt;display-&gt;display_options['relationships']['field_affected_buildings_target_id']['field'] = 'field_affected_buildings_target_id';\n$handler-&gt;display-&gt;display_options['relationships']['field_affected_buildings_target_id']['label'] = 'Building';\n\/* Field: Content: Title *\/\n$handler-&gt;display-&gt;display_options['fields']['title']['id'] = 'title';\n$handler-&gt;display-&gt;display_options['fields']['title']['table'] = 'node';\n$handler-&gt;display-&gt;display_options['fields']['title']['field'] = 'title';\n$handler-&gt;display-&gt;display_options['fields']['title']['label'] = '';\n$handler-&gt;display-&gt;display_options['fields']['title']['alter']['word_boundary'] = FALSE;\n$handler-&gt;display-&gt;display_options['fields']['title']['alter']['ellipsis'] = FALSE;\n\/* Sort criterion: Content: Post date *\/\n$handler-&gt;display-&gt;display_options['sorts']['created']['id'] = 'created';\n$handler-&gt;display-&gt;display_options['sorts']['created']['table'] = 'node';\n$handler-&gt;display-&gt;display_options['sorts']['created']['field'] = 'created';\n$handler-&gt;display-&gt;display_options['sorts']['created']['order'] = 'DESC';\n\/* Filter criterion: Content: Published *\/\n$handler-&gt;display-&gt;display_options['filters']['status']['id'] = 'status';\n$handler-&gt;display-&gt;display_options['filters']['status']['table'] = 'node';\n$handler-&gt;display-&gt;display_options['filters']['status']['field'] = 'status';\n$handler-&gt;display-&gt;display_options['filters']['status']['value'] = 1;\n$handler-&gt;display-&gt;display_options['filters']['status']['group'] = 1;\n$handler-&gt;display-&gt;display_options['filters']['status']['expose']['operator'] = FALSE;\n\/* Filter criterion: Content: Type *\/\n$handler-&gt;display-&gt;display_options['filters']['type']['id'] = 'type';\n$handler-&gt;display-&gt;display_options['filters']['type']['table'] = 'node';\n$handler-&gt;display-&gt;display_options['filters']['type']['field'] = 'type';\n$handler-&gt;display-&gt;display_options['filters']['type']['value'] = array(\n  'event' =&gt; 'event',\n);\n\n\/* Display: Page *\/\n$handler = $view-&gt;new_display('page', 'Page', 'page');\n$handler-&gt;display-&gt;display_options['defaults']['hide_admin_links'] = FALSE;\n$handler-&gt;display-&gt;display_options['path'] = 'events';\n<\/code><\/pre>\n<p>Thanks to anyone who can point me in the right direction!<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 20:52:06. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Apologies if this question has already been answered. I&#8217;m developing an emergency notification site using Drupal 7 and Organic Groups and currently it&#8217;s building-driven &#8212; i.e., the buildings are the groups which have users connected to them. They can add notes, photos, etc. and all works well. Now it seems that it would be better [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-560","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=560"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/560\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}