Hi

I would like to see the option, that users can add comment to some activity.
e.g. for change of facebook status.
Will be something like this possible in near future?

Thanks
Igorik
http://www.somvprahe.sk

Comments

jaydub’s picture

in near future: not likely

to get comments on activity records then realistically then activity records would be nodes and we're not going down that path just yet.

sirkitree’s picture

Status: Active » Postponed

Agreed, but we should explore this possibility in the near future.

If we saved every activity as a node, with a little extra data (cck field for the module classification?) then we could use views to display and would really cut down the code base.

igorik’s picture

Hi

Thanks for quick reply. I will be hope for developing the module this way.
Good luck and thanks for your work
Igorik

Flying Drupalist’s picture

+1 for support on this. I hope eventually everything will become nodes. :)

morbus iff’s picture

Assigned: Unassigned » morbus iff
Status: Postponed » Active

I will be working on this for a client, but I will *not* be using nodes. The plan is Facebook like replies, just a single textfield, check_plained, no input filters, etc., etc. I won't be utilizing comment.module or node.module for this functionality.

sirkitree’s picture

awesome! love to see what you come up with!

morbus iff’s picture

StatusFileSize
new3.48 KB
new27.03 KB

Here's the first draft of this. It's good enough, for me, to show to the client for feature approval.

sirkitree’s picture

Sexy! Hopefully I'll get a chance to look at this more in depth tonight or over the weekend. Thanks Morbus!!

michelle’s picture

I just gave it a whirl and it works well. Submitting the comment via ajax would be gravy but I know Morbus isn't going to do that. If you activity folks know how to add that in, that would be great. :)

Thanks, Morbus!

Michelle

gausarts’s picture

subscribe thanks

michelle’s picture

@gausarts - You can "subscribe" by trying the module out and reporting your findings. That gets you updates and is far more helpful towards actually getting this into activity.

Michelle

morbus iff’s picture

Status: Active » Needs review

Sirkitree: any comments on it?

sirkitree’s picture

Uhg, sorry, haven't gotten a chance yet. I've been swamped at work witha new launch that's been taking up all of my time. Hopefully this weekend tho (worked last weekend and supposed to have off today but find myself squashing bugs again... such is life). Soon! Promise!

Flying Drupalist’s picture

Hi Morbus Iff, thanks for the great module. The admin x now appears on a new line. Can you make it inline with the comment?

sirkitree’s picture

This is great Morbus! Seems to work very well in my limited testing and your code is very well received.

I'm not sure I want to support another submodule, so I'm debating just throwing it into our code base. ref (#361550: Planning the next version of activity (6.x-2.x))

What do you think jaydub?

michelle’s picture

I think just providing an option in settings as to whether or not to allow comments on activity makes sense. I hate that modules break into so many submodules for every little thing that could be a setting anyway. :)

Michelle

morbus iff’s picture

Sirkitree: for this to go into the core codebase (which I'm perfectly fine with and support), I think that all the theme functions should be moved into .tpl.php's. This way, we'd be able to use preprocesser functions to add the comments in, instead of my theme_registry_alter (which will cause problems with people who expect to theme theme_activity and not theme_activity_comments; Michelle ran into this.)

michelle’s picture

Definite +1 on moving to template files. It's the D6 way. :) And preprocess is so yummy.

Also, I realize you may not have time to do this all immediately but could you at least confirm that the comment storage is what you will be using so early adopters don't get burned when it becomes part of the module?

Thanks,

Michelle

sirkitree’s picture

If it goes in (and pending jaydub's feedback) I see no reason to change the storage method.

michelle’s picture

@sirkitree: Thanks. I'm working on a site right now that needs this so Morbus's timing is great. I don't mind using as yet uncommitted code as long as the data will transfer.

Michelle

walker2238’s picture

Would I be able to use this for 5x?

sirkitree’s picture

Title: let user to add comment for some activity » Activity comments
Issue tags: +activity-6.x-1-0-rc1
sirkitree’s picture

Assigned: morbus iff » sirkitree
sirkitree’s picture

StatusFileSize
new10.97 KB

Ok, here is a patch that adds this feature into the core of the module. I didn't create a .tpl file as I'm not sure of the technique, link for me?

sirkitree’s picture

Status: Needs review » Needs work

just noticed the profile page now looks silly...

sirkitree’s picture

StatusFileSize
new13.44 KB

Changing the default theme on the profile to be a table view as well, keeping it all uniform.

sirkitree’s picture

Status: Needs work » Needs review
jaydub’s picture

StatusFileSize
new17.18 KB

Ok I played around with this patch some. I made some minor and a few semi-major changes which I've noted below.

activity.install

- added an index on the activity_comments uid column. Figure there could be a reason to fetch a user's comments so having the index could be beneficial
- changed the update to 6101 from 6200. If we are targeting this for 6.1 release then should be 6101. 6200 would be an update to bring the module from 6.1 to 6.2 branch level

activity.css

- I made some changes to the location and styling of the activity record delete link which are rolled in with this since the addition of the 'Comment' link made is necessary.
- added a number of rules for individual elements of the activity comment such as comment author, comment timestamp and comment text. Overall style is moving toward a typical facebook comment.

activity.module

- I've moved the activity delete link into the $activity array that is passed around to most other functions and theme functions.
- moved the activity_comments loading out of the theme_activity function and into activity_get_activity.
- created a theme_activity_comments function to take some of the logic out of the theme_activity function.
- changed theme_activity function a bit to better place the comments link if any, the delete link if any, and the comments form if any.

activity_comments.js

- changed jQuery search to reflect change in position of the comments form.

added some code comments, modified others and removed some comments from unrelated code.

Another task we'll have to add if comments are a go is to add in comment deletion just as in activity record
deletion. that includes deleting any comments associated with an activity record when the record is deleted.

sirkitree’s picture

Wow! Awesome work, as always jaydub! I'll review this later today.

jaydub’s picture

how did the profile view look silly? I don't much like the table view there in the profile. Most other content displayed in the profile via hook_profile view $op are lists. tables are more difficult to work with when space is constrained and I think that user profile data may appear in smallish spaces such as a panel similar to a block on a sidebar.

sirkitree’s picture

StatusFileSize
new17.28 KB

Basically, the comment form was showing up and it looked all whack. So basically, instead of spending time on doing some more css to get it too look better, I took the lazy route and made it uniform to the All Activity page with a table so that it just conformed to that css.

The patch looks good, except for the last part which it looks like you used a different command to generate and it doesn't actually create the file. Here's a re-roll that does JUST that, didn't change anything else.

jaydub’s picture

I've managed to get the comments delete functionality running so I'll re re-roll with those changes at which time the basics should all be in here. We can work on the styling and other niceties later. The issue of the comments form in list-item mode vs table is simply a question of CSS rules as I checked into that. In tables, the default Drupal rules remove most margins from form elements. In list mode when you're in the #center region, there are default margins set on the form elements. The #center specifier is why the comments form looks fine on the blocks which are lists as well.

morbus iff’s picture

Why is the activity.css being added for every single page load? That's wrong.

Also, I finally figured out my self-comment: "oddly, when there are multiple forms on the page, the aid in values is always from the first rendered form...". To fix this, we would have to define our own hook_form(), and create unique forms that refer back to it. I've now down this successfully is other, non-activity, code. See http://www.computerminds.co.uk/drupal-6-multiple-instances-same-form-one....

sirkitree’s picture

StatusFileSize
new16.95 KB

Here's a re-roll with css loading in the correct places, activity_page() and hook_user() ..view..

Will look into the other but not sure it's needed to get a release out the door. Will apply to the next branch however which we want streamlined as possible. Thank you for your contributions Morbus. If you get a chance, I'd love to hear any feedback you might have on our plans for the next version, which you can see here: http://groups.drupal.org/node/19249

sirkitree’s picture

StatusFileSize
new16.96 KB

oops, js wasn't working with the new dom structure introduced. updated to use .siblings() instead of .children()

sirkitree’s picture

Status: Needs review » Reviewed & tested by the community

I'm going to rtbc this. needs to get pushed as I'm in a hurry to get a release done tonight so I can start showing work on the next branch (which is a pretty major re-write, mentioned above)...

sirkitree’s picture

Status: Reviewed & tested by the community » Fixed

committed to dev.

michelle’s picture

Cool!

Thanks,

Michelle

szy’s picture

How can I turn these horrible comment forms off? :/

I can't see an option in block settings, there is no option in module settings either.
Guys, don't force me to use comments, please...

Szy.

sirkitree’s picture

You can simply override the theme function.

Original:

/**
 * Theme function for individual activity message.
 */
function theme_activity($message, $item) {
  $output = $item['mark'] .'<span class="activity activity-module-'. $item['module'] .' activity-type-'. $item['type'] .' activity-operation-'. $item['operation'] .'">'. $message .'</span>';
  $output .= '<span class="activity-links">';

  // If logged in user, then show link to add a comment to the activity record. 
  // Click here displays the activity comment form.
  if (!user_is_anonymous()) {
    // Also note that the js looks for this specific class name 'activity-comments-click-to-show', so don't remove it
    $output .= '&nbsp;&ndash;&nbsp;<span class="activity-comments-click-to-show">'. t('Comment') .'</span>';
  }

  // If the user has permission to delete the activity record, display the delete link
  if ($item['delete-link']) {
    $output .= '&nbsp;&nbsp;'. $item['delete-link'];
  }

  $output .= '</span>';

  if (!user_is_anonymous()) {
    $output .= '<div class="activity-comments-form-hidden clear-block">'. drupal_get_form('activity_comment_form', $item['aid']) .'</div>';
  }

  $comments = theme('activity_comments', $item['comments']);
  if ($comments) {
    $output .= theme('item_list', $comments, NULL, 'ul', array('class' => 'activity-comments-list'));
  }
  return $output;
}

Change to:

/**
 * Theme function for individual activity message.
 */
function YOUR_THEME_activity($message, $item) {
  $output = $item['mark'] .'<span class="activity activity-module-'. $item['module'] .' activity-type-'. $item['type'] .' activity-operation-'. $item['operation'] .'">'. $message .'</span>';
  $output .= '<span class="activity-links">';

  // If the user has permission to delete the activity record, display the delete link
  if ($item['delete-link']) {
    $output .= '&nbsp;&nbsp;'. $item['delete-link'];
  }

  $output .= '</span>';
  return $output;
}

I realize this isn't totally ideal, but I'm trying to concentrate efforts on the next branch as much as I can.

szy’s picture

@sirkitree, thanks.

And thank you for the module itself, I really like it, as I like all the modules 'living'
on site.

But:

-> #391770: Optional use of comments

:]

Szy.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

james_sf’s picture

Status: Closed (fixed) » Needs review

Hi Sirkitree and Igorik,

I tried to run the activity_comments_3.patch against Activity 1.2, but patching resulted in several errors. Is this 3rd patch the latest, and does it work against the Activity 1.2 build?

On a related note, I'm thinking about upgrading to Activity 2. Do you have a comments solution (esp. for Facebook_Status) that works for Activity 2?

Thanks,

James

jaydub’s picture

Status: Needs review » Closed (fixed)

I think you might be confused, the 1.2 release (and actually previous releases) already have the Activity Comments feature included. You don't need to add any patch from here. As issue #37 and #42 indicate, these changes were added to the project and this issue was closed back in March.