- ability to customize stream headers. (i.e. Day of the week, Date - Time is shown now, no way to change format)
- ability to choose # of days to display in activity stream (or # of items)

Comments

akalsey’s picture

Status: Active » Fixed

In the future, please create separate issues for separate requests. This makes it easier to track the requests and ensures that one doesn't fall through the cracks.

- You can now customize the headers via a theme function (in CVS version)

- The module already honors the global drupal settings for how many posts to display.

spiffyd’s picture

@akalsey

Sorry about not separating requests - will do in the future.

About # of posts display, I understand the module honors the global drupal post settings but is there a way to customize # of posts for...

- activity stream page only?
- activity stream blocks only?

akalsey’s picture

No, but as Views support leaks in (there's a patch for the 5.x branch -- #266615: Add views support) then you can do that by creating a View.

spiffyd’s picture

@akalsey,

You can now customize the headers via a theme function (in CVS version)

Can you point me in the right direction as to how I can do this?

eojthebrave’s picture

You need to override the theme_activitystream_header(&$action)function in your themes template.php file. Read more about it here. http://drupal.org/node/173880#function-override

akalsey’s picture

What you'll want to do is find the function theme_activitystream_header(&$action) and copy it into your template.php. Chagne the name of the function so that "theme_" is renamed to "yourthemename_" and then make whatever changes to the new function you wish. Upload it to your server and you'll be set.

spiffyd’s picture

@eojthebrave, @akalsey,

I cannot find function theme_activitystream_header(&$action) anywhere in any of the activity stream modules. Did you mean function theme_activitystream_item($action) from the activitystream.module? Please advise.

akalsey’s picture

In CVS it's line 285.

<?php
function theme_activitystream_header(&$action) {
  return '<h3 class="datehead">' . format_date($action->created, 'medium') . '</h3>';
}
?>
akalsey’s picture

Status: Fixed » Closed (fixed)

In 6.x Beta 1

spiffyd’s picture

As a recent Drupal transplant, I have yet discovered something that I should add to this thread...

Originally, I thought I needed to tweak the module's code to get a customized display of the stream's header's dates and times.

So it turns out Dates/Times can be shown in 3 built in formats: long, medium, short. The formats of each can be customized under "Date and Time" settings (/admin/settings/date-time). The headers in Activity Stream uses the medium format. So instead of tweaking the code, all I simply had to do was alter them in the medium format section in the Date and Times settings page!

spiffyd’s picture

I am using the Marinelli theme so I added the following to my templates.php. I changed 'medium' to 'short' but I still don't see Activity Stream reflecting the change as it should be...

<?php
function marinelli_activitystream_header(&$action) {
  return '<h3 class="datehead">' . format_date($action->created, 'short') . '</h3>';
}
?>

Suggestions?

akalsey’s picture

That should work. Either that or

<?php
function phptemplate_activitystream_header(&$action) {
  return '<h3 class="datehead">' . format_date($action->created, 'short') . '</h3>';
}
?>
spiffyd’s picture

@akalsey

I used your phptemplate version and got errors:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'marinelli_activitystream_header' was given in /home2/denislam/public_html/spiffyd/includes/theme.inc on line 597.

spiffyd’s picture

@#12... That doesn't work.

But I tried actually going into the module file and changing...

<?php
function theme_activitystream_header(&$action) {
  return '<h3 class="datehead">' . format_date($action->created, 'medium') . '</h3>';
}
?>

to...

<?php
function theme_activitystream_header(&$action) {
  return '<h3 class="datehead">' . format_date($action->created, 'short') . '</h3>';
}
?>

That didn't change anything either. I also tried clearing browers and Drupal caches. Didn't do anything... Please advise?

spiffyd’s picture

Status: Closed (fixed) » Active
akalsey’s picture

Status: Active » Closed (fixed)

Works for me using the latest release.

I created a new site on my dev server with a fresh copy of Drupal 6.4. I downloaded Activity Stream from d.o. I installed Activity Stream and set up my twitter account. Ran cron and verified my twitter updates appeared at /stream.

I copied garland to /sites/all/themes/garlandtest and went to admin/build/themes and made it the default theme. Then I copied the following code to the end of /sites/all/themes/garlandtest/template.php...

function theme_activitystream_header(&$action) {
  return '<h3 class="datehead">####' . format_date($action->created, 'medium') . '</h3>';
}

I then cleared the cache under admin/settings/performance as described at http://drupal.org/node/173880#theme-registry to rebuild the theme registry.

Loaded /stream again and verified that #### appears before the date.

spiffyd’s picture

Category: feature » bug
Status: Closed (fixed) » Active

I believe you meant using phptemplate_activitystream_header instead of theme_activitystream_header as that would cause a duplicate function calling and fatal error.

function phptemplate_activitystream_header(&$action) {
  return '<h3 class="datehead">####' . format_date($action->created, 'medium') . '</h3>';
}

But in any case, yes your modified code will result in the display of "####" in the activity stream. However, the date format still doesn't change if you modify it. Try changing 'medium' to 'short', does your format change? For me, it does nothing. Medium formatting still shows. And I tried doing this in a fresh Drupal 6.4 installation.

You can see how your date/time should be formatted under "Date/Time Settings" -- there are 3 types: short, medium, and long.

eojthebrave’s picture

"short" is an invalid argument for the format_date function. http://api.drupal.org/api/function/format_date

Try using either 'small', 'medium', or 'large' instead.

akalsey’s picture

Yes, phptemplate_activitystream_header is the correct function name. Pasted the wrong text. Sorry about that.

"Short" isn't a valid date format in Drupal. Your options are "small", "medium", "large", and "custom". Using anything other than one of these four options will result in the medium date being used. Try using "small" instead. The Drupal UI labels this format as "short" but the API calls it "small".

akalsey’s picture

Status: Active » Closed (fixed)

Looks like my post crossed paths with eojthebrave's.

Closing this issue.

spiffyd’s picture

Wow, can't believe I had this oversight...

Thanks so much eojthebrave.