Hi.

I am trying to add simple link in user profiles (user/UID, e.g. user/1) for those who has access to administer users. This is code which I developed, but it makes some errors:

  function my_fixes_user($op, &$edit, &$account, $category = NULL) {
  global $user;
if (user_access('administer users')) {
  switch ($op) {
    case 'view':
       $account->content['spis_zawartosci'] = array(
          '#type'   => 'markup',
          '#value'  => '<br />'. l(t('Simple link'), 'path-to/'.$account->uid),
          '#weight' => 1
        );
      break;
    }
    
    return $account;
}

Pasted in my_fixes.module

Any ideas what's wrong with it?

Comments

jaydubb181’s picture

I created this module locally and tried it out. This works if you add a closing curly brace to the end.

function my_fixes_user($op, &$edit, &$account, $category = NULL) {
  global $user;
  if (user_access('administer users')) {
    switch ($op) {
      case 'view':
         $account->content['spis_zawartosci'] = array(
            '#type'   => 'markup',
            '#value'  => '<br />'. l(t('Simple link'), 'path-to/'.$account->uid),
            '#weight' => 1
          );
        break;
      }
     
      return $account;
  }
}
gumol’s picture

That closing curly brace was there from the beginning, but I just did not paste it.
Please check what happens when you paste this code and go to edit user page.

*My code displays the link but it is buggy, so Drupal is not working properly IMHO.

gumol’s picture

Any ideas?