Drupal: Assign Permissions Based on Username File

Here’s a recent scenario I encountered: a Drupal role needs to be assigned to certain users. The site is using a single sign on (SSO) system with a lot of users who could log in. But only some of those should be granted a certain permission. The list of those who can access the special permission role is automatically generated and put in place on the server on a daily basis, in a simple format with one line for each account name.

I have pulled out a generic version of this code and made it available on my GitHub.

Continue Reading Drupal: Assign Permissions Based on Username File

Drupal GitPod Container 1: .Dockerfile

GitPod is a great tool for cloud-based containers when developing. If you’re developing and want a safe and efficient cloud container to try things out, it’s a pretty good way to go. You even get 50 hours per month for free, which is pretty great if you only need occasional side project and not full-time work. It also works with Visual Studio Code – although that has not been working for me lately – so you can use it in the browser or in your desktop editor. When you browse to a or repository with the extension installed, there’s a simple button that will launch the container with that repository’s code, making it quick and easy to see how it works as well as make changes.

In this mini-series I describe how I created a generic Drupal-friendly container working with . It is available in my GitHub. Note that since is some code I may continue using over time, the code there may change beyond what is covered in this article.

Continue Reading Drupal GitPod Container 1: .Dockerfile

Drupal 7: Hide Label on Node Display

I ran into a problem on an old Drupal 7 site where labels for a custom field were displaying, even when there was no content associated with that field, creating a page that was simply a series of headers in a row. That’s not very user-friendly.

If I wanted to always hide the label for a field, that’s easy enough in the default Drupal display settings for the content type. But what about this scenario where we want to show the label when there is content and hide the label when there isn’t content?

Continue Reading Drupal 7: Hide Label on Node Display

Microsoft Teams: Search Filters

I recently was asked whether it is possible to search in Microsoft Teams for a file but only within a specific site. The short answer is yes, but that’s not the default search behaviour. When you use the search bar in Teams, it will default to all types of results across all Teams you are a member of. But then you can filter from there. This is significantly improved by some recent changes.

So, if I know I am looking for a particular file in a particular Team, I can do that this way:

Continue Reading Microsoft Teams: Search Filters

Mail Tester

A common scenario with many web services like a CRM is sending mail and realizing that it is often going to the junk of recipients.

There are several reasons why a message may go to spam. Some of those reasons come from the content of the message. Some are because of filters set up by the recipient or their email provider. And some factors come down to technical configuration on the part of the sender.

Continue Reading Mail Tester