| 1 |
<?php
|
| 2 |
// $Id: blog_bio.module,v 1.4 2005/04/28 08:14:21 frjo Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Author: Fredrik Jonsson <fredrik at combonet dot se>
|
| 7 |
* Enables admins to display a block with the bloggers biography.
|
| 8 |
* You may need to adjust the profile field names to your own values;
|
| 9 |
* realname, country and biography.
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_help().
|
| 14 |
*/
|
| 15 |
function blog_bio_help($section = 'admin/help#blog_bio') {
|
| 16 |
switch ($section) {
|
| 17 |
case 'admin/modules#description':
|
| 18 |
return t('Block that display the bloggers name, picture and biography.');
|
| 19 |
break;
|
| 20 |
}
|
| 21 |
}
|
| 22 |
|
| 23 |
/**
|
| 24 |
* Implementation of hook_block().
|
| 25 |
*
|
| 26 |
* Generates a block with the bloggers biography.
|
| 27 |
*/
|
| 28 |
|
| 29 |
function blog_bio_block($op = 'list', $delta = 0) {
|
| 30 |
if ($op == 'list') {
|
| 31 |
$blocks[0]['info'] = t('Blog bio');
|
| 32 |
return $blocks;
|
| 33 |
}
|
| 34 |
else if ($op == 'view') {
|
| 35 |
if (user_access('access user profiles')) {
|
| 36 |
/* if ((arg(0) == 'node') && is_numeric(arg(1)) && (arg(2) == NULL)) {*/
|
| 37 |
/* $node = node_load(arg(1));*/
|
| 38 |
/* $account = user_load(array('uid' => $node->uid));*/
|
| 39 |
/* }*/
|
| 40 |
/* else */
|
| 41 |
if (arg(0) == 'blog' && arg(1) != '') {
|
| 42 |
$uid = arg(1);
|
| 43 |
$account = user_load(array('uid' => $uid));
|
| 44 |
}
|
| 45 |
if ($account) {
|
| 46 |
$output = theme('user_picture', $account);
|
| 47 |
if (module_exist('profile')) {
|
| 48 |
$output .= $account->realname ? '<p><b>'. t('Name') .':</b><br />'. $account->realname .'</p>' : '';
|
| 49 |
$output .= $account->country ? '<p><b>'. t('Country') .':</b><br />'. $account->country .'</p>' : '';
|
| 50 |
$output .= $account->biography ? '<p><b>'. t('Biography') .':</b><br /><em>'. $account->biography .'</em></p>' : '';
|
| 51 |
}
|
| 52 |
if (module_exist('tracker')) {
|
| 53 |
$output .= '<p>'. l(t('More posts by %name', array('%name' => $account->name)), 'user/'. $account->uid . '/track') .'</p>';
|
| 54 |
}
|
| 55 |
if (module_exist('contact') && $account->contact) {
|
| 56 |
$output .= '<p>'. l(t('Contact %name', array('%name' => $account->name)), 'user/'. $account->uid .'/contact') .'</p>';
|
| 57 |
}
|
| 58 |
$output .= '<div class="more-link">'. l(t('more'), 'user/'. $account->uid) .'</div>';
|
| 59 |
|
| 60 |
$block['subject'] = t('About %name', array('%name' => $account->name));
|
| 61 |
$block['content'] = $output;
|
| 62 |
return $block;
|
| 63 |
}
|
| 64 |
}
|
| 65 |
}
|
| 66 |
}
|
| 67 |
?>
|