The current follow.api.php file is incorrect and can lead anyone trying to add his/her own networks down the path of frustration and resentment :)

It should read:

/**
 * Alter the available networks to the Follow module.
 *
 * @param $networks
 *   Associative array of networks that are available.
 * @param $uid
 *   The User ID of the networks to be displayed. If 0 is provided, will be the
 *   networks for the website rather then an individual user.
 */
function hook_follow_networks_alter(&$networks, $uid = 0) {
  // Add a network.
  $networks[$uid]['mailinglist'] = array(
    'title' => t('Mailing List'),
    'domain' => 'mailinglist.domain.com',
  );

  // Replace Twitter with Identi.ca
  unset($networks[$uid]['twitter']);
  $networks[$uid]['identica'] = array(
    'title' => t('Identi.ca'),
    'domain' => 'identi.ca',
  );
}

Patch below.

CommentFileSizeAuthor
follow_api_updated.patch652 bytesperusio

Comments

stefanx’s picture

Please excuse my ignorance I still don't understand what to do. How can I, a Drupal newbie, enable Identi.ca and a Mailinglist in Follow module?

perusio’s picture

Create your own module, let's call it, foobar. Then add the code in foobar.module:

/**
 * Alter the available networks to the Follow module.
 *
 * @param $networks
 *   Associative array of networks that are available.
 * @param $uid
 *   The User ID of the networks to be displayed. If 0 is provided, will be the
 *   networks for the website rather then an individual user.
 */
function foobar_follow_networks_alter(&$networks, $uid = 0) {
  // Add a network.
  $networks[$uid]['mailinglist'] = array(
    'title' => t('Mailing List'),
    'domain' => 'mailinglist.domain.com',
  );

  // Replace Twitter with Identi.ca
  unset($networks[$uid]['twitter']);
  $networks[$uid]['identica'] = array(
    'title' => t('Identi.ca'),
    'domain' => 'identi.ca',
  );
}

Enable the module and you're done.

stefanx’s picture

I intent to add Identi.ca in addition to Twitter, not replacing it. In this case, I assume I have to remove the line "unset($networks[$uid]['twitter']);". Correct?

Ahhh, create an own module! :-) I did so, installed and enabled the module successfully. But no mailinglist and identi.ca links are displayed. :-( Any idea?

Here is the content of my .info file:

name = MyFollow
description = Follow mailing list and Identi.ca
core = 7.x
dependencies[] = follow
perusio’s picture

This should work (myfollow.module):

/**
 * Alter the available networks to the Follow module.
 *
 * @param $networks
 *   Associative array of networks that are available.
 * @param $uid
 *   The User ID of the networks to be displayed. If 0 is provided, will be the
 *   networks for the website rather then an individual user.
 */
function myfollow_follow_networks_alter(&$networks, $uid = 0) {
  // Add a network.
  $networks[$uid]['mailinglist'] = array(
    'title' => t('Mailing List'),
    'domain' => 'mailinglist.domain.com',
  );

  // Add Identi.ca to the list of networks.
  $networks[$uid]['identica'] = array(
    'title' => t('Identi.ca'),
    'domain' => 'identi.ca',
  );
}

And the info file (myfollow.info):

name = MyFollow
description = Follow mailing list and Identi.ca
core = 7.x
dependencies[] = follow
files[] = myfollow.module
stefanx’s picture

Thanks a lot for your support. This works. :-)

In order to display icons, I will add the following code to follow.css and add the icons into the folders.

a.follow-link-identica {
background-image: url(icons/small/icon-identica.png);
}
a.follow-link-mailinglist {
background-image: url(icons/small/icon-mailinglist.png);
}

Hope it is sufficient.

What I don't understand is why identi.ca and mailinglist support are not included in the module by default. Since you already wrote the code, why not integrate it into the module by default and make user's life easier. :-)

Chris Charlton’s picture

The patch provided (above #1) works as expected.

rogert’s picture

The patch supplied works.

q0rban’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.