Skip to main content

Drupal | Technology Tutorials

[Solved] Drupal taxonomy alias cannot be deleted path invalid or you don't have permission

This was an unusual problem we faced in one of our digital products.

While going to the Taxonomy Terms page and changing the url, this error popped up.

Solution

1. Check your .htaccess or WAF rules

2. If there are no rules limiting access to the taxonomy page, go to the URL Alias section
/admin/config/search/path

3. Enter the taxonomy url

/taxonomy/term/your_number

4. You will see a duplicate System path like this

/taxonomy/term/your_number /taxonomy/term/

5. Delete the entry

6. Change the URL

How to renew SSL Certificate (WHM/CPanel)

1. Login as root

2. If you want to generate SSL Certificate for WHM/CPanel, manually run the following command:

/usr/local/cpanel/bin/checkallsslcerts --verbose

3. To run SSL check for all domains, run

/usr/local/cpanel/bin/autossl_check --all

4. To run SSL for one domain under a username <username>, run

/usr/local/cpanel/bin/autossl_check  --user <username>

here <username> is your home user

echo $HOME or use the pwd command to see something like

First Interaction vs Last Interaction: Best Marketing Channels

When Google introduced Attribution Modelling in their analytics, marketers learned more about Last Interactions, First Interaction and Assisted Conversions (More on this in another tutorial). But let us look at the difference between first interaction and last interaction. The Marketing channel that introduced the visitor to your website just before the conversion is categorized under Last Interaction and the channel that first introduced the visitor to your website is the First Interaction channel.

How to Migrate CSV to Node in Drupal (Migrate Source CSV)

1. To add a migrate from csv file feature in your Drupal site, you need three modules

Migrate Source CSV 
https://www.drupal.org/project/migrate_source_csv

Migrate Plus 
https://www.drupal.org/project/migrate_plus

Migrate Tools
https://www.drupal.org/project/migrate_tools

2. Install migrate_source_csv, migrate_plus and migrate_tools using composer commands from their respective project pages like:

How to Install Google Charts in Drupal

By enabling Charts module and Google Charts sub-module, Charts function won’t work out of the box in Drupal Views, Field or Node.

You must follow these five steps to download the relevant JavaScript files and add it to the libraries folder:

1.    Ensure that you have the `composer/installers` package installed - it is installed
"composer/installers": "^1.9",

2. Ensure you have an installer-paths for the drupal-library type in your composer.json file

How to Remove Missing or Invalid Module/Theme (Drupal)

Error Message: Currently using Missing or invalid module The following module is marked as installed in the core.extension configuration, but it is missing:

If you accidentally removed the module folder while the module is installed, you can remove the module/theme from the configuration file with a drush command

vendor/bin/drush config:delete core.extension module.<modulename>

In our example, the module tablefield is missing from the configuration file

How to Block ChatGPT

The Chat GPT bot comes in two variants - GPTBot and ChatGPT. You can block the two using a robots.txt directive. There are no guarantees that any of them have not captured all your content for AI training before copyright lawsuits mandated this directive. But add the following to your robots.txt file

User-agent: GPTBot

Disallow: /

User-agent: ChatGPT-User

Disallow: /

 


 

How to Ignore First Div or Class or Element in Jquery

In Drupal or any JQuery function if you want to style or list or modify any div, class or css element ignoring the first element, you should use the 'gt(0)' or the greater than (zeroth) element like below:

Drupal.behaviors.<themename> = {
   attach: function (context, settings) {
     $('img:gt(0)').on('click', function(e) {

The above code will ignore the first image that is loaded in the DOM but apply the function to all other images. 

Change the class or div by using 

# or .

htaccess rules not taken (some rules but not all) (How to Fix)

The hierarchy of the .htaccess files is taken from

1)    Apache htdocs folder (/var/www/html)
2)    Local Webserver root folder (let us say website)

If your htaccess is present in the Local Webserver root folder (website) and all the changes are not being taken or some changes are taken but not all the rules are taken

1) Go a step above the Local Webserver root folder (website) and see if there is any other .htaccess file

Drush needs a higher bootstrap level to run (How to Fix)

Drush needs a higher bootstrap level to run

Problem: With a PHP update, all drush commands stopped working

1. The obvious debugging is running the pm-update or any drush command inside a Drupal folder. If it still throws a "needs a higher bootstrap level to run," go to step 2.

2. Check all your path files

vi ~/.bashrc
vi ~/.bash_profile

bashrc is run in Linux outside shell access for all apps under your username

bash_profile is run only when you use a shell through the terminal

Copying PDF Table to MS Excel Table

First thing you need is an Adobe Acrobat Pro or any Reader version that that will allow you to copy the table with formatting

1. Select the table area in the PDF. Right Click and Copy the Table with Formatting

2. Paste it to an Excel

3. You will soon see that the pasted Table cannot be formatted. Neither can you remove the format

Error: Merged Cells Cannot be formatted

4. To fix error at 3, select the entire range of the table in the copied excel using Ctrl+1 (Control plus One)

5. Click the Alignment Tab

6. Deselect the Merge

Disable Coupon Drupal Commerce 2

Coupons should be ideally part of the Promotions in Drupal Commerce 2. But even if you have not added any promotion, a default coupon redemption field can be enabled, leading to a confusing user experience.

To avoid the coupon field from showing up

1. Go to Checkout Flows (/admin/commerce/config/checkout-flows)

2. Edit the Default Checkout Flow (/admin/commerce/config/checkout-flows/manage/default)

3. Disable the 'Coupon redemption' Field by dragging the field to the disabled sections

Clear the Cache using Drush (Cache rebuild = cr)

drush cr

Disable the Default Feed (rss.xml)

In Drupal 10, you are likely to see a default feed (rss.xml) file by visiting /rss.xml. If you don’t want everyone to access the default rss feed, you can disable it by following these steps:

1. Go to Views /admin/structure/views

2. Edit the Default Front Page View
admin/structure/views/view/frontpage

3. Disable the Feeds Tab by clicking the drop down near ‘View Feed’ and click Disable Feed.

4.Click Save

How to Integrate Webform with Mailchimp (Drupal 10)

1. Install Webform Mailchimp, Mailchimp and Webform modules using composer

https://www.drupal.org/project/webform

https://www.drupal.org/project/mailchimp

https://www.drupal.org/project/webform_mailchimp

2. Go to https://us1.admin.mailchimp.com/lists/

3. Add a New List https://us1.admin.mailchimp.com/lists/new-list/

4. List Name: <name of the list>

5. From Email and From Name

6. Campaign URL Settings.
Choose a verified Campaign URL Settings

Google Ads getting disapproved 403 Error

Error: Unable to crawl your landing page on iOS devices. HTTP error 403

Step 1: Go to robots.txt and add the followng to the top of the txt

User-agent: AdsBot-Google
Disallow:

*leave the Disallow: section blank"

Keep checking your logs for 403 errors. 

Although robots.txt is the first line of fixing bot related errors, the error could also be from rules set in the Web Application Firewall or  the .htaccess file

Step 2: Allowing Google IP's

Google Testing 3 Snippet and 2 Snippet Results

May 2022: If you have noticed the traffic from your web assets plummeting or showing strange troughs and crests patterns, it is because Google is testing a 2-snippet and a 3-snippet results page.

3-Snippet

In the 3-snippet results page, Google shows three snippets from 3 websites, allowing the user to choose a context. The snippets are shorter - just one line.

It is labeled as "From the Web," like the good old 90s phrasing. 

2-Snippet

How to Add a New User to Google Workspace when 2FA is enforced

An issue we faced while adding a new user email is that as an organization we have enforced 2FA. This would block any new user from logging in. 

To overcome this challenge. 

1. Go to https://admin.google.com/ac/security/2sv

2. Under Authentication, select New User enrollment Period as 1 day. 

3. Email the user about the policy and ensure that they set up 2FA on sign-in.