Mercurial > defr > drupal > core
comparison modules/blog/blog.module @ 7:fff6d4c8c043 6.3
Drupal 6.3
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:30:28 +0100 |
parents | 2427550111ae |
children |
comparison
equal
deleted
inserted
replaced
6:2cfdc3c92142 | 7:fff6d4c8c043 |
---|---|
1 <?php | 1 <?php |
2 // $Id: blog.module,v 1.297.2.1 2008/04/09 21:11:45 goba Exp $ | 2 // $Id: blog.module,v 1.297.2.3 2008/05/19 07:27:35 goba Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * @file | 5 * @file |
6 * Enables keeping an easily and regularly updated web page or a blog. | 6 * Enables keeping an easily and regularly updated web page or a blog. |
7 */ | 7 */ |
31 */ | 31 */ |
32 function blog_access($op, $node, $account) { | 32 function blog_access($op, $node, $account) { |
33 switch ($op) { | 33 switch ($op) { |
34 case 'create': | 34 case 'create': |
35 // Anonymous users cannot post even if they have the permission. | 35 // Anonymous users cannot post even if they have the permission. |
36 return user_access('create blog entries', $account) && $account->uid; | 36 return user_access('create blog entries', $account) && $account->uid ? TRUE : NULL; |
37 case 'update': | 37 case 'update': |
38 return user_access('edit any blog entry', $account) || (user_access('edit own blog entries', $account) && ($node->uid == $account->uid)); | 38 return user_access('edit any blog entry', $account) || (user_access('edit own blog entries', $account) && ($node->uid == $account->uid)) ? TRUE : NULL; |
39 case 'delete': | 39 case 'delete': |
40 return user_access('delete any blog entry', $account) || (user_access('delete own blog entries', $account) && ($node->uid == $account->uid)); | 40 return user_access('delete any blog entry', $account) || (user_access('delete own blog entries', $account) && ($node->uid == $account->uid)) ? TRUE : NULL; |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 /** | 44 /** |
45 * Implementation of hook_user(). | 45 * Implementation of hook_user(). |
47 function blog_user($type, &$edit, &$user) { | 47 function blog_user($type, &$edit, &$user) { |
48 if ($type == 'view' && user_access('create blog entries', $user)) { | 48 if ($type == 'view' && user_access('create blog entries', $user)) { |
49 $user->content['summary']['blog'] = array( | 49 $user->content['summary']['blog'] = array( |
50 '#type' => 'user_profile_item', | 50 '#type' => 'user_profile_item', |
51 '#title' => t('Blog'), | 51 '#title' => t('Blog'), |
52 '#value' => l(t('View recent blog entries'), "blog/$user->uid", array('title' => t("Read @username's latest blog entries.", array('@username' => $user->name)))), | 52 '#value' => l(t('View recent blog entries'), "blog/$user->uid", array('attributes' => array('title' => t("Read @username's latest blog entries.", array('@username' => $user->name))))), |
53 '#attributes' => array('class' => 'blog'), | 53 '#attributes' => array('class' => 'blog'), |
54 ); | 54 ); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |