summaryrefslogtreecommitdiff
path: root/modules/blog.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-10-26 15:17:26 +0000
committerDries Buytaert <dries@buytaert.net>2002-10-26 15:17:26 +0000
commit8d103a08984ac2de72d756eb5c5c8d23061ab028 (patch)
treee8cb8b9b2f071a9b7bd2e222d8183e5c27ad6683 /modules/blog.module
parent2ec14f35ac7d5600e6d03b5cf79f717f43d1cfab (diff)
downloadbrdo-8d103a08984ac2de72d756eb5c5c8d23061ab028.tar.gz
brdo-8d103a08984ac2de72d756eb5c5c8d23061ab028.tar.bz2
- Committed Marco's block rewrite:
+ Blocks are not longer called if not rendered: major performance improvement. + Fixed some bugs (preview option was broken, path option was broken). + Removed "ascii"-type blocks. + Added permission to for "PHP blocks" + ... NOTES: + You'll want to run "update.php": ALTER TABLE blocks DROP remove; ALTER TABLE blocks DROP name; + You'll want to update your custom modules as well as the modules in the contrib repository. Block function should now read: function *_block($op = "list", $delta = 0) { if ($op == "list") { return array of block infos } else { return subject and content of $delta block } }
Diffstat (limited to 'modules/blog.module')
-rw-r--r--modules/blog.module33
1 files changed, 16 insertions, 17 deletions
diff --git a/modules/blog.module b/modules/blog.module
index 0869fe19e..9d698c44b 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -332,25 +332,24 @@ function blog_link($type, $node = 0, $main) {
return $links ? $links : array();
}
-function blog_block() {
+function blog_block($op = "list", $delta = 0) {
global $user;
-
- $result = db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
-
- if (user_access("access content")) {
- while ($node = db_fetch_object($result)) {
- $output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n";
+ if ($op == "list") {
+ $blocks[0]["info"] = t("User blogs");
+ return $blocks;
+ }
+ else {
+ if (user_access("access content")) {
+ $result = db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
+ while ($node = db_fetch_object($result)) {
+ $output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n";
+ }
+ $output .= "<br /><div align=\"right\">". lm(t("more"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))) ."</div>";
+ $block["content"] = $output;
+ $block["subject"] = t("User blogs");
}
- $output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))) ."</div>";
- $block[0]["content"] = $output;
+ return $block;
}
-
-
- $block[0]["subject"] = t("User blogs");
- $block[0]["info"] = t("User blogs");
- $block[0]["link"] = drupal_url(array("mod" => "blog"), "module");
-
- return $block;
}
-?>
+?> \ No newline at end of file