Configurable number of items on stream page
eojthebrave - July 28, 2008 - 04:21
| Project: | Activity Stream |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | akalsey |
| Status: | by design |
Jump to:
Description
Alright, now onto the fun stuff.
This patch adds a field to admin/settings/activitystream that allows you to configure the number of items to display on the global /stream page, and on the individual user's profile page.
As far as I can tell the only way to change this currently is by editing the module directly.
| Attachment | Size |
|---|---|
| activitystream-items_per_page.patch | 2.16 KB |

#1
Instead of adding yet another setting, I've updated the module to honor the existing Drupal setting for the number of posts to show on a page.
#2
#3
Sorry to reopen this issue...i ran into this looking for a setting to configure the number of items for the activity stream block.
I think we can live with a setting more, while it doesn't make really sense to decide the number of items in the activity stream block basing on the number of posts in the home page.
I've never used that setting as i usually need to build a custom home page, but this time i had to decide whether to build a view to use it as the home page or rebuild the activity stream block in order to have how many items i liked...I chose the first, it was easier, but it wasn't a good situation to find you in, by the way.
Thanks for this powerful module.
Da.
#4
Not going to happen. Between themes and views there's a lot of ways to create a stream page or block and show however many items you want on it. There's no need to add a setting in for it.
Heck, you could even write a tiny module to expose a block of whatever size you'd like.
<?php
// activitystream_custom.module
//
// Change the 5 where it says activitystream_get_activity(null, false, 5) to
// set the number of items to show.
function activitystream_custom_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = variable_get('activitystream_title', 'Activity Stream');
$blocks[1]['info'] = t('User\'s activity stream');
return $blocks;
}
else if ($op == 'view') {
$block = array();
switch ($delta) {
case 0:
$title = variable_get('activitystream_title', 'Activity Stream');
$block['subject'] = t($title);
$block['content'] = block_activitystream_content(0);
break;
case 1:
// basic validation
$arg = arg();
if (count($arg) == 2 && $arg[0] == 'user' && is_numeric($arg[1]) && ($user = activitystream_user_load($arg[1]))) {
$block['subject'] = t('My activity');
$block['content'] = block_activitystream_content(1, $user);
}
break;
}
return $block;
}
}
function block_activitystream_custom_content($which_block) {
switch ($which_block) {
case 0:
$items = activitystream_get_activity(null, false, 5);
return theme('activitystream', $items);
case 1:
$args = func_get_args();
$items = activitystream_get_activity($args[1], false, 5);
return theme('activitystream', $items);
}
}
?>