summaryrefslogtreecommitdiff
path: root/modules/blog.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-12-10 20:35:20 +0000
committerDries Buytaert <dries@buytaert.net>2002-12-10 20:35:20 +0000
commit7ce686c152416dc3a240861840f9c18791e38762 (patch)
treef771ce209303d39fed6915d1f90d5fc0030e3f23 /modules/blog.module
parenteceead1819b8e480725db17816d1b2af4f3fd768 (diff)
downloadbrdo-7ce686c152416dc3a240861840f9c18791e38762.tar.gz
brdo-7ce686c152416dc3a240861840f9c18791e38762.tar.bz2
o Permission improvements:
+ Removed the "post content" permission and replaced it by more fine-grained permissions such as "maintain static pages", "maintain personal blog", "maintain stories", etc. o Usability improvements to teasers: + Teaser forms are no more. Teasers are extracted automatically but can also be instructed using a delimiter "---". Furthermore, when a post it too short for a teaser, the user won't be bother with teaser stuff anymore. + Added an option to set the teaser length, or to disable teasers all together. + When previewing a post, both the short (if any) and the full version of a post are shown. This addresses a common complaint; for example, when writing a book page there was no way you could preview the short version of your post. + Forum posts can be teasered now. This is particularly helpful in the context of drupal.org where we promote forum topics. o Bugfix: replaced all PHP short tags (<?) with long tags (<?php). o Bugfix: removed hard-coded dependence on comment module. o Bugfix: when the queue module was disabled, it was not possible to approve updated book pages. o Bugfix: applied modified version of Marco's node_teaser() fix.
Diffstat (limited to 'modules/blog.module')
-rw-r--r--modules/blog.module31
1 files changed, 18 insertions, 13 deletions
diff --git a/modules/blog.module b/modules/blog.module
index b7cdce205..14cf276b6 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -22,6 +22,10 @@ function blog_node($field) {
return $info[$field];
}
+function blog_perm() {
+ return array("maintain personal blog");
+}
+
function blog_access($op, $node) {
global $user;
@@ -30,15 +34,15 @@ function blog_access($op, $node) {
}
if ($op == "create") {
- return $user->uid;
+ return user_access("maintain personal blog") && $user->uid;
}
if ($op == "update") {
- return ($user->uid == $node->uid);
+ return user_access("maintain personal blog") && ($user->uid == $node->uid);
}
if ($op == "delete") {
- return ($user->uid == $node->uid);
+ return user_access("maintain personal blog") && ($user->uid == $node->uid);
}
}
@@ -68,10 +72,15 @@ function blog_save($op, $node) {
if ($op == "create") {
if (user_access("administer nodes")) {
- return array("body" => filter($node->body), "teaser" => filter($node->teaser));
+ /*
+ ** When an administrator creates blog entries through the admin
+ ** pages, they will not be changed unless explicitly specified.
+ */
+
+ return array();
}
else {
- return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "status" => 1, "teaser" => filter($node->teaser));
+ return array("promote" => 0, "moderate" => 1, "status" => 1);
}
}
@@ -86,7 +95,7 @@ function blog_save($op, $node) {
** pages, they will not be changed unless explicitly specified.
*/
- return array("body" => filter($node->body), "teaser" => filter($node->teaser));
+ return array();
}
else {
/*
@@ -94,7 +103,7 @@ function blog_save($op, $node) {
** and will queue it in the moderation queue for promotion.
*/
- return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "score" => 0, "teaser" => filter($node->teaser), "votes" => 0, "users" => 0);
+ return array("promote" => 0, "moderate" => 1, "score" => 0, "votes" => 0, "users" => 0);
}
}
@@ -205,10 +214,6 @@ function blog_form(&$node, &$help, &$error) {
}
}
- if ($node->teaser) {
- $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
- }
-
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
@@ -260,11 +265,11 @@ function blog_link($type, $node = 0, $main) {
$links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
}
- if ($type == "menu.create" && user_access("post content")) {
+ if ($type == "menu.create" && user_access("maintain personal blog")) {
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
}
- if ($type == "menu.view" && user_access("access content")) {
+ if ($type == "menu.view" && user_access("maintain personal blog")) {
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
}