Since I got recommendation of posting this here, I'll try.

Under user profile view (www.mysite.com/user/1) , I have a field that was added by a module (Gallery).

The title of it, is Gallery2, and inside contains some information about the details of the gallery.

I'm trying to change the title of that section from Gallery2 to "My Gallery"

I've tried two things:

1. A theming on template.php:

function phptemplate_user_profile($account, $fields) {
  return str_replace('Gallery2', 'Gallery', theme_user_profile($account, $fields));
}

2. A module to change hook_profile_alter

function mytweaks_profile_alter(&$account, &$fields) {
  $fields['Gallery2'] = str_replace('Gallery2', 'Gallery', $fields['Gallery2']);
}

With both methods, I cannot manage to do this.

Does anyone has an idea of how to do it?

Thanks!

Comments

profix898’s picture

Using str_replace() on array keys wont work AFAIK. Try to use code like this ... (should also work for phptemplate_*)

function mymodule_profile_alter(&$account, &$fields) {
  if (isset($fields['Gallery2'])) {
    $fields['My Gallery'] = $fields['Gallery2'];
    unset($fields['Gallery2']);
  }
}
andydev’s picture

profix, that just work beautifully!

I spend a whole evening trying to learn how to do this :)

andydev’s picture

Status: Active » Closed (fixed)

Closing

Oliver_webmaster’s picture

Ok, but which file did you guys edit to do this? and where in that file do I add it?
Thanks!

profix898’s picture

@Oliver_webmaster: You either implement this in your own custom module or add it to the template.php file of your theme (see http://drupal.org/node/35728).