It's pretty easy actually. Firstly, you can override any model and change
when or how it tracks activity. So, for logged_in, for example, you can
override User's update_last_login method:
def update_last_login
# don't track logins in the activity feed
# self.track_activity(:logged_in) if self.last_login_at.nil? ||
(self.last_login_at && self.last_login_at < Time.now.beginning_of_day)
self.update_attribute(:last_login_at, Time.now)
end
To add things to the activity feed, just make them acts_as_activity. For
example, check out the RSVP model, which eksatx just added:
class Rsvp < ActiveRecord::Base
acts_as_activity :user
...
end
That will create an activity whenever an RSVP is created (the :user part
tells the activity tracker which association on Rsvp is the owner). Then you
can override the _activity.html.haml, or override _unhandled_item.html.haml
to deal with your new activity type.
Good luck,
Bruno
On Fri, Jul 17, 2009 at 2:09 PM, moritz <[email protected]> wrote:
>
> What's being tracked as activity is determined by calls to the
> track_activity method. The implementation is in the activity_tracker
> plugin under the engine_plugins directory. Hopefully that gets you
> started. I'm not sure what the options are to override the plugin
> implementation. Maybe someone else can comment. I'm curious as well,
> as I had to make some modifications to the plugin.
>
> On Jul 17, 12:08 am, "James.d" <[email protected]> wrote:
> > I'm wondering if anyone can share their experience with modifying
> > what's displayed in the activities feed. There are a few items ( like
> > logged into site) that I would like to remove on my site, and also
> > would love to know what my options are for adding new features.
> >
> > Can anyone point me in the right direction?
> >
> > Thanks,
> > James
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CommunityEngine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---