Twitter module compatible with domain access ?

pedrosp - October 22, 2009 - 14:05
Project:Twitter
Version:6.x-2.6
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm using Domain Access to manage several domains, and I wanted to use the twitter module.
The twitter setup global account should set a different twitter account for each domain, but I can't see how to setup, each time I change from any domain, changes are rolled out for all domains.
I tried to use the Domain_prefix (copy, create) to see if I could split the info, but same results.

Are both modules compatible?
Anyone using both modules with differents twitter account ?

Thanks,
Pedro.

#1

pedrosp - October 25, 2009 - 11:44
Category:bug report» feature request

Solution thanks to agentrickard in #612562: Twitter module: how to manage separate global accounts for each domain?
Proposal to add as a patch or evolution in Twitter module

When you install the http://drupal.org/project/domain module and active the (included) "Domain Conf" submodule, each domain as his own settings page.
Using the Domain_Conf hook, you can add new parameters from contributed modules in those settings pages.

Just create a domain_conf.inc file, place it in the following directory: sites/all/modules/domain/domain_conf , and copy the following code:

<?php
/**
* Implements hook_domainconf() to add the setup of a global twitter account per domain.
*/

function twitter_domainconf() {
 
$form['twitter'] = array(
   
'#type' => 'fieldset',
   
'#title' => t('Twitter Global Account'),
   
'#description' => t('A site-wide Twitter account to use as the default when tweets are posted. This is useful for single-user blogs or sites where many users post to a single shared Twitter account.'),
   
'#collapsible' => TRUE,
   
'#collapsed' => FALSE,

  );

 
$form['twitter']['twitter_global_name'] = array(
   
'#type' => 'textfield',
   
'#title' => t('Twitter Domain User name'),
   
'#default_value' => variable_get('twitter_global_name', NULL),
  );
 
 
$form['twitter']['twitter_global_password'] = array(
   
'#type' => 'password',
   
'#title' => t('Password'),
   
'#description' => t("If your Twitter account is protected, or you wish to post to Twitter from Drupal, you must enter the Twitter account's password."),
   
'#default_value' => variable_get('twitter_global_password', NULL),
  );

 
$form['twitter']['twitter_default_format'] = array(
   
'#type' => 'textfield',
   
'#title' => t('Default format string'),
   
'#maxlength' => 140,
   
'#description' => t('The given text will be posted to twitter.com. You can use !url, !url-alias, !tinyurl, !title, and !user as replacement text.'),
   
'#default_value' => variable_get('twitter_default_format', 'New post: !title !tinyurl'),
  );

  return
$form;
}
?>

That's it. You can ad in the same file, several hooks for others modules, see the example in #612562: Twitter module: how to manage separate global accounts for each domain? how to add a hook also for Google Analytics module.

 
 

Drupal is a registered trademark of Dries Buytaert.