summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2007-04-04 12:43:30 +0000
committerMax Kremmel <xing@synapse.plus.com>2007-04-04 12:43:30 +0000
commit090ebec81f631d5824c6dd0d17501f6c40468e1a (patch)
tree997d4119109a0c29c7acda2fe1526633efd45ae1
parent982f17da33e11d261150cef435e88b02d650d67e (diff)
downloadblogs-090ebec81f631d5824c6dd0d17501f6c40468e1a.tar.gz
blogs-090ebec81f631d5824c6dd0d17501f6c40468e1a.tar.bz2
blogs-090ebec81f631d5824c6dd0d17501f6c40468e1a.zip
make it possible to turn off user filtering on user homepage by setting include=all
-rw-r--r--modules/mod_last_blog_posts.php40
1 files changed, 16 insertions, 24 deletions
diff --git a/modules/mod_last_blog_posts.php b/modules/mod_last_blog_posts.php
index 3aa59b8..8cd8cf2 100644
--- a/modules/mod_last_blog_posts.php
+++ b/modules/mod_last_blog_posts.php
@@ -1,9 +1,6 @@
<?php
/**
- * Params:
- * - title : if is "title", show the title of the post, else show the date of creation
- *
- * @version $Header: /cvsroot/bitweaver/_bit_blogs/modules/mod_last_blog_posts.php,v 1.10 2007/04/03 14:45:56 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_blogs/modules/mod_last_blog_posts.php,v 1.11 2007/04/04 12:43:30 squareing Exp $
* @package blogs
* @subpackage modules
*/
@@ -11,35 +8,30 @@
/**
* required setup
*/
-if( !defined( 'MAX_BLOG_PREVIEW_LENGTH' ) ) {
- define ('MAX_BLOG_PREVIEW_LENGTH', 100);
-}
-
include_once( BLOGS_PKG_PATH.'BitBlogPost.php' );
require_once( USERS_PKG_PATH.'BitUser.php' );
// moduleParams contains lots of goodies: extract for easier handling
extract( $moduleParams );
-$listHash = array( 'user_id' => $gQueryUserId, 'sort_mode' => 'created_desc', 'max_records' => $module_rows, 'parse_data' => TRUE );
+$listHash = array(
+ 'sort_mode' => 'created_desc',
+ 'max_records' => $module_rows,
+ 'parse_data' => TRUE,
+ 'user' => ( !empty( $module_params['user'] ) ? $module_params['user'] : NULL ),
+ 'blog_id' => ( @BitBase::verifyId( $module_params['blog_id'] ) ? $module_params['blog_id'] : NULL ),
+);
-$listHash['user'] = isset($module_params['user']) ? $module_params['user']:NULL;
-if ( isset($module_params['id']) ){ $listHash['blog_id'] = $module_params['id'];}
+if(( empty( $module_params['include'] ) || $module_params['include'] != 'all' ) && !empty( $gQueryUserId )) {
+ $listHash['user_id'] = $gQueryUserId;
+}
$blogPost = new BitBlogPost();
$ranking = $blogPost->getList( $listHash );
-$maxPreviewLength = (!empty($module_params['max_preview_length']) ? $module_params['max_preview_length'] : MAX_BLOG_PREVIEW_LENGTH);
-//DEPRECATED Slated for removal -wjames5
-/*
-$user_blog_id = NULL;
-if( count( $ranking['data'] ) ) {
- $user_blog_id = $ranking['data'][0]['blog_id'];
-}
-$gBitSmarty->assign('user_blog_id', $user_blog_id);
-*/
-$gBitSmarty->assign('maxPreviewLength', $maxPreviewLength);
-$gBitSmarty->assign('modLastBlogPosts', $ranking["data"]);
-$gBitSmarty->assign('modLastBlogPostsTitle',(isset($module_params["title"])?$module_params["title"]:""));
-$gBitSmarty->assign('blogsPackageActive', $gBitSystem->isPackageActive('blogs'));
+$maxPreviewLength = ( !empty( $module_params['max_preview_length'] ) ? $module_params['max_preview_length'] : 500 );
+$gBitSmarty->assign( 'maxPreviewLength', $maxPreviewLength );
+$gBitSmarty->assign( 'modLastBlogPosts', $ranking["data"] );
+// not sure what this is, but using title doesn't work cos that will rename the moduleTitle
+//$gBitSmarty->assign( 'modLastBlogPostsTitle', ( isset( $module_params["title"] ) ? $module_params["title"]:"" ));
?>