You are here

function fasttoggle_user in Fasttoggle 6

Same name and namespace in other branches
  1. 5 fasttoggle.module \fasttoggle_user()

Implementation of hook_user().

Add togglable links to user pages.

File

./fasttoggle.module, line 112
Enables fast toggling of binary or not so binary settings.

Code

function fasttoggle_user($op, &$edit, &$account) {
  if ($op == 'view') {
    $links = fasttoggle_link('user', $account, TRUE);
    if (!empty($links['fasttoggle_status'])) {
      $link = $links['fasttoggle_status'];
      $account->content['fasttoggle'] = array(
        '#value' => t('Status') . ': ' . l($link['title'], $link['href'], $link),
      );
      unset($links['fasttoggle_status']);
    }
    if (!empty($links)) {
      foreach ($links as $name => $link) {
        $account->content[$name] = array(
          '#value' => t('Role') . ': ' . l($link['title'], $link['href'], $link),
        );
      }
    }
  }
}