1

I'm making a multi-site setup using the same install and the same database, basing it off domains. I'm trying to programmatically alter the site_name variable so that it displays a different site name based on the domain being used.

I am using 3 different methods to achieve this at the same time, however even that is not bullet-proof. Certain instances (i.e. some administration pages, user login, or user profile edit) still display the default site name in the page title (or elsewhere).

I am doing the following:

  • $conf['site_name'] = $my_title; in settings.php
  • $vars['site_name'] = $my_title; in my theme's hook_preprocess_page
  • using hook_tokens_alter in a custom module to change the [site:name] token to $my_title

Despite all these measures, it seems I did not enforce the site name change in a bulletproof way. Is there a better method I have missed?

Worth mentioning: I am using the Metatag module, which seems to alter page titles on a fundamental level. I am not sure if this is related to my problem.

2 Answers 2

1

From PHP code, it's just:

variable_set('site_name', 'My Site Name');

If it doesn't work, clear you caches, restart your memcached if you're using it or check if you didn't export it into Features or hardcoded into your settings file.

One-time go is via drush:

drush -y vset site_name "My Site Name"

To check if the value was changed:

drush vget site_name
3

What is the value for the site_name variable in the variables table? (e.g. what's the output of variable_get('site_name')?)

If it's overridden from the value that you set in your settings file, reset it like so:

variable_set('site_name', $my_title)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.