at the moment with the structure of my site the only place that I would need to make this change is when a user wants to add a user to their buddylist (buddy/add/*) and when a user is informed that someone added them to their buddylist. I don't know how to make patches, and at the moment I don't have a lot of time to finish this, so I don't mind (although I have read several comments that this is not recomended) changing the code of the module, after all I'm just replacing a word. Any help please???

Comments

vm’s picture

investigate the path.module to change the path from buddy to something else, although I don't believe you can use contact, unless you change the default contact path also.

investigate the locale.module for changing the terms using a site specific language file you create which will alter buddylist to contact list.

mr.andrey’s picture

Here are some instructions if you're not familiar with the locale module:

Add a language in admin/settings/locale/language/add -> Custom Language
Language code: en-custom
Language name in English: English - Custom

In admin/settings/locale, make "en-custom" the default and disable "en"

Now we need to create a custom buddylist language file:
Download the latest package, and look in the /po directory for .pot file
Rename the file to en.po and edit the following:

#: buddylist.module:14
msgid "Buddy"
msgstr "Friend"

#: buddylist.module:17
msgid "Buddies"
msgstr "Friends"

#: buddylist.module:18
msgid "buddy of"
msgstr "Friend of"

#: buddylist.module:19
msgid "Buddylist"
msgstr "Friends list"

#: buddylist.module:82
msgid "%buddies"
msgstr "Friends"

#: buddylist.module:83
msgid "%buddyof"
msgstr "Friend of"

#: buddylist.module:91
msgid "%buddylist"
msgstr "Friends list"

#: buddylist.module:487;533
msgid "%buddy"
msgstr "Friend"

#: buddylist.module:13;29;694 contrib/buddylistinvite/buddylistinvite.module:9
msgid "buddy"
msgstr "Friend"

#: buddylist.module:15;947;951;0 contrib/buddylistinvite/buddylistinvite.module:7;12
msgid "buddylist"
msgstr "Friends list"

#: buddylist.module:16 contrib/buddylistinvite/buddylistinvite.module:30;48
msgid "buddies"
msgstr "Friends"

Click on Import (admin/settings/locale/language/import)
Select en.po as the "Language file" and import it into "English - Custom"
You will probably get an error about plural stuff, that's ok, you didn't fill it out in the .po file.

Cheers,
Andrey.

mr.andrey’s picture

Oh, and you might want to familiarize yourself with Locale module first. If you keep importing the same file, it will keep creating new things and your locale will be cluttered with useless strings.

ipwa’s picture

Hey thanks a lot guys, it sounds like this was exactly what I needed! I don't have time this week to try it out because I have to present my dissertation, but I'll give it a go next weekend. Thanks a lot!!!!

dldege’s picture

if you want to change buddy/add path to contact/add check out the function custom_rewrite_url(). You can put this function in your settings.php and globally change the paths that map to buddy list paths.

Here's an example that changes all buddylist/ paths to network/

function custom_url_rewrite($op, $result, $path) {
  switch ($op) {
    case 'source' :
      if (strpos($path, 'network') === 0) {
        //drupal_set_message('custom_url_rewrite ===>' . $op . ' ===> ' . str_replace('network', 'buddylist', $path) . ' ===> ' . $path);
        return str_replace('network', 'buddylist', $path);
      }
      if ($path == 'user/password') return 'user';
    break;
    case 'alias' :
      if (strpos($path, 'buddylist') === 0) {
        //drupal_set_message('custom_url_rewrite ===>' . $op . ' ===> ' . str_replace('buddylist', 'network', $path) . ' ===> ' . $path);
        return str_replace('buddylist', 'network', $path);
      }
      if ($path == 'user/password') return 'user';
    break;
  };
  
  return $result;
}

If you want to change actual text messages and other stuff from buddy list to contact list and buddy to contact then you can provide new words for the buddylist_translation() function by setting the variable also in settings.php.

/**
 * returns an array of common translation placeholders
 */
function buddylist_translation() {
  $translations = array(
    '@buddy' => t('buddy'),
    '@Buddy' => t('Buddy'),

    '@buddylist' => t('buddylist'),
    '@Buddylist' => t('Buddylist'),

    '@buddies' => t('buddies'),
    '@Buddies' => t('Buddies'),

    '@buddyof' => t('buddy of'),
    '@Buddyof' => t('Buddy of'),
  );
  return variable_get('buddylist_translation', $translations);
}
ipwa’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Project and Drupal version is unsupported.