/[drupal]/contributions/sandbox/frjo/blog_bio/blog_bio.module
ViewVC logotype

Contents of /contributions/sandbox/frjo/blog_bio/blog_bio.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Tue Jul 28 08:37:30 2009 UTC (3 months, 4 weeks ago) by frjo
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +8 -9 lines
File MIME type: text/x-php
First commit of my hacked inline module for D6.
1 <?php
2 // $Id: blog_bio.module,v 1.1 2007/06/05 06:52:10 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_block().
14 *
15 * Generates a block with the bloggers biography.
16 */
17
18 function blog_bio_block($op = 'list', $delta = 0) {
19 if ($op == 'list') {
20 $blocks[0]['info'] = t('Blog bio');
21 return $blocks;
22 }
23 else if ($op == 'view') {
24 if (user_access('access user profiles')) {
25 // if ((arg(0) == 'node') && is_numeric(arg(1)) && (arg(2) == NULL)) {
26 // $node = node_load(arg(1));
27 // $account = user_load(array('uid' => $node->uid));
28 // }
29 // else
30 if (arg(0) == 'blog' && arg(1) != '') {
31 $uid = arg(1);
32 $account = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1));
33 }
34 if ($account) {
35 $output = theme('user_picture', $account);
36 if (module_exists('profile')) {
37 $output .= $account->realname ? '<p><b>'. t('Name') .':</b><br />'. $account->realname .'</p>' : '';
38 $output .= $account->country ? '<p><b>'. t('Country') .':</b><br />'. $account->country .'</p>' : '';
39 $output .= $account->biography ? '<p><b>'. t('Biography') .':</b><br /><em>'. $account->biography .'</em></p>' : '';
40 }
41 if (module_exists('tracker')) {
42 $output .= '<p>'. l(t('More posts by @name', array('@name' => $account->name)), 'user/'. $account->uid . '/track') .'</p>';
43 }
44 if (module_exists('contact') && $account->contact) {
45 $output .= '<p>'. l(t('Contact @name', array('@name' => $account->name)), 'user/'. $account->uid .'/contact') .'</p>';
46 }
47 $output .= '<div class="more-link">'. l(t('more'), 'user/'. $account->uid) .'</div>';
48
49 $block['subject'] = t('About @name', array('@name' => $account->name));
50 $block['content'] = $output;
51 return $block;
52 }
53 }
54 }
55 }

  ViewVC Help
Powered by ViewVC 1.1.2