Download & Extend

Configurable number of items on stream page

Project:Activity Stream
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:akalsey
Status:closed (works as designed)

Issue Summary

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.

AttachmentSize
activitystream-items_per_page.patch2.16 KB

Comments

#1

Assigned to:Anonymous» akalsey
Status:needs review» fixed

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

Status:fixed» closed (fixed)

#3

Status:closed (fixed)» active

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

Status:active» closed (works as designed)

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);
  }
}
?>

#5

Unfortunately neither the patch nor the module is working for me. The patch is not applyable, perhaps it was made for a different version.:

root@Jimbo:/var/www/drupal/sites/all/modules/activitystream# patch activitystream.module activitystream-items_per_page.patch
patching file activitystream.module
Hunk #1 FAILED at 223.
Hunk #2 FAILED at 327.
2 out of 2 hunks FAILED -- saving rejects to file activitystream.module.rej

The module doesnt really work too. I copied the above code into a module file and created info file as well. I am able to activate the modules and the users activity stream block. But the Block it self is not working . doesnt appear on the site.
Somebody can help or knows an more easier way to get more then 10 activity stream items visible?
Shnifti

#6

Have you tried using Views? Activity Stream fields are all exposed to Views so you can build a block or a page with a wide variety of sorting and content options.