Thanks for this great module. How about porting to D7?

Comments

Scott Reynolds’s picture

Porting this will require a significant effort. Token module has been rolled into core, but it has a different syntax and it tackles some of the difficulties that we worked around. It will take a careful hand to port this bad boy.

Bilmar’s picture

subscribing - I look forward to helping with testing as D7 version is developed.
Thanks very much in advance!

likewhoa’s picture

subscribing!

BenK’s picture

Subscribing...

spacereactor’s picture

subscribing

johngriffin’s picture

We can help with development and testing once there is a d7 branch underway

Scott Reynolds’s picture

Drupal 7 branch will have to be drastically different. The database layout will be identical, but the code base will need to change greatly. Because of the three main components

  1. Event system provided by Trigger
  2. Token system provided by Token
  3. Views

The first two changed drastically.

sirkitree’s picture

/me wonders if it would be better to use a different event system... we found a few pitfalls with actions and triggers and i'm wondering if this might be more suited for messaging/notifications instead...

Scott Reynolds’s picture

Ahh big no on notifications / messaging. Im am a co maintainer of those projects now but no. I think it would be a mistake.

I started a port last night: http://github.com/SupermanScott/Activity

I really like this, it removes cruft that we had before around 'types' and 'type check'. It encapsulates logic into handlers that can do new and interesting things with them. It only works for node_insert right now and it only records, there is no Views integration, but that is a straight forward port.

The api looks like this

/**
 * Implementation of hook_activity_api().
 */
function node_activity_api() {
  return array(
    'api' => '3-alpha',
    'realms' => array('node_author' => 'Node Author'),
    'hooks' => array(
      'node_insert' => array(
        'batch' => TRUE,
        'handler' => 'NodeActivityActionHandler',
        'name' => 'Node Insert',
      ),
    ),
  );
}

Essentially, a handler is tied to a hook. You can use the same handler for as many hooks as you want, and thats the plan for NodeActivityActionHandler. It will be 'batchable' for everything but node_update.

The activity_action_handlers.inc is worth a good read through.

Scott Reynolds’s picture

Just pushed another change. The api looks like this now

/**
 * Implementation of hook_activity_api().
 */
function node_activity_api() {
  return array(
    'api' => '3-alpha',
    'realms' => array(
      'node_author' => array(
        'name' => 'Node Author',
      ),
    ),
    'hooks' => array(
      'node_insert' => array(
        'batch' => TRUE,
        'handler' => 'NodeActivityActionHandler',
        'name' => 'Node Insert',
      ),
    ),
    'file' => drupal_get_path('module', 'activity') . '/modules/node.activity.inc',
  );
}

The activity_access table is now properly written too. So I think I have the API in place for recording actions around the Trigger / Actions system. I hope to start building out the user and comment stuff soon. Doing that might show some holes in the system.

I think this hook_activity_api() provides enough metadata.

Once I have it stable and in place, I will introduce Batch updating and redoing messages. Should be really easy with the new handler system.

Scott Reynolds’s picture

Pushed a bunch of updates and stuff. I have all the node operations working now, and I added token stuffs. The new Token api is awesome. To wet your whiskers a bit

[current-user:activity-profile-link] updated [node:activity-node-link] by [node:author:activity-profile-link]

node -> author -> activity-profile-link. O man, does that make life so much easier. We can now officially handle user flagging, user voting.

With hook_hook_info: http://api.drupal.org/api/function/hook_hook_info/7 there really isn't much need for the 'file' attribute in the api hook in my previous comment. It is required for Activity implementing the node / user / comment stuff, but normal modules won't need it.

Scott Reynolds’s picture

More changes have been pushed to Github. Notable bugs
1.) Viewing a node semantics are wrong.
2.) Several of the menu callbacks don't work properly
3.) Still links to admin/build/activity.
4.) When you create a new template, you will get a bunch of warning messages about unset variables. This is because options and the templates don't default properly. This probably should be part of a constructor.

Scott Reynolds’s picture

ooo check this out:
http://skitch.com/supermanscott/dfhn4/test-messages

You can test your messages before saving them. So you can test them on existing nodes / users / comments etc.

Scott Reynolds’s picture

woot! and you can now update existing messages: http://skitch.com/supermanscott/dfhen/update-existing

So you change the template after a few weeks and click that button. The old messages are transformed into the new system.

When you update a node, all messages associated with that node are regenerated. Same for comments.

When you update a user, all their activities are regenerated.

Those last one is too aggressive might just adjust it to 'if the name changed'.

rjbrown99’s picture

#14 is awesome - love those features and it will save me a lot of really crazy-looking SQL statements that I have been using to update previous activity messages. Are you planning to include those in 6.x-2.x-dev as well or are they requiring the new D7 features?

Scott Reynolds’s picture

These new features are taken from this work here which I would love a review: #463854: Generate activity on a current site. I want to commit that patch but not without other people giving it a try.

These exact changes require an api change so they don't belong in the 2.x series. Maybe, if someone is willing, a 3.x series. The reason really is because with D7, php5 is required so I can do things like abstract classes. But if you give the issue above a review, I think you can start avoiding those ungodly SQL queries you are running ;-)

ronald_istos’s picture

Hi scott forked your Activity project on github and playing around with it. Great stuff!

Looks like a few things are missing (like comment.activity.inc) that the module is looking for. Is that intentional - should I just comment out comment_activity_api function for the time being or could you add those in your rep?

Thanks,

Ronald

ps: after playing a but around with it I should actually be able to offer something useful rather than just more questions!

Scott Reynolds’s picture

Looks like a few things are missing (like comment.activity.inc)

It isn't needed. Drupal is able to autoload the classes from activity_action_handlers.inc just fine.

It might produce some warnings though.

BenK’s picture

Hey Scott,

I started testing your latest code from Github and noticed that all of the module configuration options are only showing up for the admin user (User #1). I'm also not seeing any permissions supplied by the module on the site permissions page.

Have you not got around to adding permissions yet or is there some other bug at work here?

Thanks,
Ben

BenK’s picture

Also, would you like bug reports added to this thread or would you prefer them somewhere else?

Cheers,
Ben

Scott Reynolds’s picture

I would like it in this thread for a little while. I really should just roll it into D.o

Scott Reynolds’s picture

Made another major update: https://github.com/SupermanScott/Activity

Now I think it is API complete, and it does everything that 2.x does (+ MORE!). It is now just a matter of fixing the bugs that don't work and creating the implementations for other modules. This time around, Activity should maintain the api for the other modules because A.) I ended up writing them anyways B.) People come here for support for them and C.) Keeps me in touch with everything that is going on.

Major feature
- When creating a new template for node insert, user register and comment insert you can click "Save and Create" which will take the template you just created and create Activities that happened in the past. I think this is a major usability win

Regressions
- Views changed how it does query substitutions AGAIN. So Views handlers are busted.

NathanM’s picture

Subscribing.

mike503’s picture

Subscribing, hard to tell what status this is in really. Any idea of a "I'd say 40% done before we can release an alpha" or anything? :)

Scott Reynolds’s picture

The current code: https://github.com/SupermanScott/Activity/ (direct download: https://github.com/SupermanScott/Activity/tarball/master) works for all node, comment and user activities. You have to apply one patch for relationship handling: #1011266: Error getting relationship handler label from non-object. (or apply this: https://github.com/SupermanScott/Activity/blob/master/views_1011266_admi...) but it works with the latest Views.

Over 80% test coverage (i believe) on the recording side of things. There isn't an upgrade path yet, but it should be really simple.

Any idea of a "I'd say 40% done before we can release an alpha" or anything? :)

I hate doing that at work, fat chance of me doing that for my fun on my own time stuff :-P

edit:o and the whole activity_username thing needs to be updated. It works, but D7 provides interesting things for the name handling. Also, would like to start work on advanced help integration.

edit Forgot to mention, Token isn't required anymore, but creating messages without it is pretty hard.

Scott Reynolds’s picture

I believe the only thing remaining is the upgrade path now. Please check it out via the links in the previous post and report any bugs.

Activity comments are ugly, but I think the markup is sane enough to allow some proper theming.

edit: And the Views patch mentioned previously was committed today. so Views 7-3 should work nicely with the current Activity.

Valeratal’s picture

Subscribing

snupy’s picture

Subscribing

sw3b’s picture

Subscribe

jennifermontes’s picture

Subscribe

Scott Reynolds’s picture

No need to subscribe fellas, try it out from github.

ryivhnn’s picture

So seeing as there's no 7 branch here do we have to post issues/patches/etc in github? I'm currently having fun with another silly "Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given" type error, seems like the Activity themed stuff doesn't work :) Am working on it (very slowly, still learning).

jennifermontes’s picture

I just tried your patch and it works like a charm.

danielm’s picture

Subscribe

jennifermontes’s picture

Title: Please port to Drupal 7 » Port Activity to Drupal 7

Changed the thread title to make it easier to keep track of.

Shadlington’s picture

Soooo... How about a release on d.o?

jarush’s picture

Thanks
Subscribe.

dgastudio’s picture

+1

salimai’s picture

Aside from a couple warning messages already mentioned, the version on github is working great! Don't hesitate to use it simply because it isn't on d.o.

My only bug report is that the update and regenerate messages operations do not appear to be available for all hooks. I have not extensively tested this, but I have been unable to get those operations to work with the Node Update hook. This can be worked around, however, so it is nowhere near critical. Great module!

Shadlington’s picture

Still, if there was a 7.x branch we could file issues for it, download with drush, etc.
Its not going to stop me trying it out (I intend to try activity 7.x sometime over the next few weeks and I'll use it in whatever state it is then) but it would still be more convenient.

Scott Reynolds’s picture

My only bug report is that the update and regenerate messages operations do not appear to be available for all hooks.

That is because not all hooks can do these things. They have to have an atomic record outside of Activity (i.e. comment insert has a record in the comment table, where node update doesn't have a record, as the 'log' of updates doesn't exist).

ngstigator’s picture

Subscribe

Scott Reynolds’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Active » Closed (fixed)