Drupal

It's Triumphant Tuesday! Post your recent Drupal wins and launches

Drupal - Open Source Content Platform - Tue, 11/20/2018 - 09:06

Here's your chance to brag about cool stuff you've done recently and awesome sites you've shipped. Anything happy and Drupal-related goes.

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

What is your best content workflow dev - prod?

Drupal - Open Source Content Platform - Tue, 11/20/2018 - 05:35

I found drupal.org/project/content_sync for content sync; am I right in understanding that it should work in a similar way to drupal core config management?

Are there other options and what are your opinions of them?

submitted by /u/petergus
[link] [comments]

[D7] Having trouble with Node Grants / Node Access Records

Drupal - Open Source Content Platform - Mon, 11/19/2018 - 10:06

Boss asked me to create a very restricted user role so that Mexico users only see Mexico based content. I'm at a loss as to why this code is working for site and sign but not workorder.

function my_module_node_access_records($node) { $grants = []; $nid = (int) $node->nid; switch($node->type) { /* * Any sites before nid 679149 will NOT be Mexico sites, * and don't need to be checked. For newer sites, check the country field * on the address attribute */ case "site": if($nid > 679149) { if($node->field_address['und'][0]['country'] != 'MX') { $grants[] = [ 'realm' => 'site_access', 'gid' => 120, 'grant_view' => 0, 'grant_update' => 0, 'grant_delete' => 0, 'priority' => 0, ]; } } else { $grants[] = [ 'realm' => 'site_access', 'gid' => 120, 'grant_view' => 0, 'grant_update' => 0, 'grant_delete' => 0, 'priority' => 0, ]; } break; /* * Any signs before nid 679149 will NOT be on Mexico sites, * and don't need to be checked. For newer signs, query the * field_address table to get the country */ case "sign": if($nid > 679149) { $site = (int) $node->field_site_ref['und'][0]['nid']; $country = db_query("SELECT field_address_country FROM field_data_field_address WHERE entity_id = :site", [":site" => $site])->fetchField(); if($country != 'MX') { $grants[] = [ 'realm' => 'site_access', 'gid' => 120, 'grant_view' => 0, 'grant_update' => 0, 'grant_delete' => 0, 'priority' => 0, ]; } } else { $grants[] = [ 'realm' => 'site_access', 'gid' => 120, 'grant_view' => 0, 'grant_update' => 0, 'grant_delete' => 0, 'priority' => 0, ]; } break; /* * Any work orders before nid 679149 will NOT be on Mexico sites, * and don't need to be checked. For newer work orders, query the * field_address table with a join on the site_ref table to get the country */ case "workorder": if($nid > 679149) { $sign = (int) $node->field_sign_reference['und'][0]['nid']; $country = db_query("SELECT field_address_country FROM field_data_field_address AS address INNER JOIN field_data_field_site_ref AS site ON site.field_site_ref_nid = address.entity_id WHERE site.entity_id = :sign_nid", [":sign_nid" => $sign])->fetchField(); if($country != 'MX') { $grants[] = [ 'realm' => 'site_access', 'gid' => 120, 'grant_view' => 0, 'grant_update' => 0, 'grant_delete' => 0, 'priority' => 0, ]; } } else { $grants[] = [ 'realm' => 'site_access', 'gid' => 120, 'grant_view' => 0, 'grant_update' => 0, 'grant_delete' => 0, 'priority' => 0, ]; } break; } return $grants; }

submitted by /u/humanatore
[link] [comments]

Weekly Drupal beginner questions thread

Drupal - Open Source Content Platform - Mon, 11/19/2018 - 09:06

Ask your newbie questions here! No judgement!

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

Where to get started with theming?

Drupal - Open Source Content Platform - Mon, 11/19/2018 - 08:59

i want to get into drupal theming, but I'm having trouble finding groups, books and where to begin. i would be very greatful for any kind of help, thanks!

submitted by /u/Ddemonhunter
[link] [comments]

Nginx 404's - correct way to add rewrite rules to nginx.conf for Drupal?

Drupal - Open Source Content Platform - Sun, 11/18/2018 - 12:40

Newbie trying to learn Drupal here.

I use nginx and not having much luck with rewrites. I found a Drupal nginx 'recipe' which I tried but ended up getting "Page not found" messages instead.

submitted by /u/DonovanNagel
[link] [comments]

Pages