A frequently requested feature for Commons is the ability to post short "status update" messages and have them appear in the site's activity stream, similar to Twitter, Facebook and Google Plus.
This meta issue lays out the planned changes to Commons to provide this functionality.We can then break this down into smaller, more actionable issues. Overall, the plan is to provide a revised browsing and content creation widget for both the "What's going on" page (site homepage) and group browsing widgets. We've validated these designs with some internal usability testing at Acquia, and I hope that we'll share the results of those studies soon in a blog post.
Please note revised designs in comment #10


The change here adds consistency to the way that users browse and create post content both on the site frontage, and on group home pages.
One notable enhancement is that a simplified content creation form is presented for each group-enabled content type so that users can create new content directly from the browsing widget without the need to load a new page. Users have the option to "Go to full form" to access a new page with the complete node creation form.
For the "Post" content type, users are presented with only the Body field by default, and the activity stream entires for post creation will contain the beginning of the body of the post, making it easier to read status updates in an activity stream. Users can still use the "post" content type for longer updates, such as blog posts. Our intention here is to avoid confusion e.g. #1322322: Status messages are replacing nodes around the different content types in Commons by eliminating duplicative content types with arbitrary distinctions (e.g., blog post and discussion in Commons 2.x).
In general, it seems like the breakdown of technical tasks will include:
- Commons BW refactoring
-- Creation widget
--- API for generating simplified node form
--- API for determining which entity types should be in the widget (Sitewide, group-specific)
--Browsing widget
--- Refactor the browsing widget view
--- Indicate that old functions are deprecated.
-Posts activity stream message refactoring
-- Any other refactoring to Commons content type modules to work with the new BW
- Group homepage refactoring
- Site homepage refactoring
An interactive prototype of this functionality can be viewed at https://projects.invisionapp.com/share/UHDGZNJ2#/screens/6176006.


Comments
Comment #1
ezra-g commentedSome of this work may include Gizra folks.
Comment #2
dustin@pi commentedI closed #1930666: Support micro-blogging/status in Activity Stream as a duplicate of this one.
Comment #3
lightsurge commentedLooks good, not sure about the 'Go to full form', though. Do people really see these little UI widgets as forms, or is that more of a techy thing? If people don't see these as forms, then 'going to the full form' wouldn't make sense.
Also, it's pretty obscure.. not sure I'd see it unless I was looking for it.
Just a thought, perhaps, for the post type for example, you could rename the post button 'Quick post', and have another secondary button 'Advanced Post' which stuffs the content user has entered into the body field of the full node form and lets the user do all the advanced stuff?
Comment #4
jasonwhat commentedAgreed, I think "Full screen" or "More posting options" makes more sense.
Overall, this is definitely the right direction. Great work. Any idea on the timeframe for this to go live in Commons?
Comment #5
amitaibucommons_bw_form_field_ui_field_edit_form_alter(), on group-content nodes - "Show in Tabbed widget"field_attach_form()the node-type and include only the needed fields. We probably will need to take care of validate and submit.Comment #6
itamar commentedPatch adds the node forms to the group browsing widget.
We still need to theme it and set some fields to be shown on the form by default.
Creating a post:

Comment #7
itamar commentedRevising the previous patch; Allowing the content modules to embed the "Partial form" in their tab.
Notice it's currently implemented only for commons_posts.
Comment #8
dustin@pi commentedThat looks really good. This makes perfect for posts and will be an amazing feature ... but is a little strange for Wikis.
The way my institution is currently using the Commons 2.x wikis, each group has a wiki main page and then content arranged under that main page. We have groups for each academic program/year and the tutors structure the content by course and lecture number from the main wiki page. We use notifications for time sensitive information (i.e. the printer is being fixed, special presentation on Friday, etc.) but wikis pages are treated as permanent pages.
If you look at the screen shot posted here: http://drupal.org/node/1932528#comment-7150668 that's a pretty big page to be typing into the box.
My suggestion:
If there's agreement on this approach I'd be willing to create a patch for commons_wikis once commons_bw stabilizes.
Comment #9
ezra-g commentedThanks for this feedback, Dustin@PI.
Agreed, the current Commons BW ability to have a different view for each content type in a group is handy, especially in the event that a river of news listing isn't sufficient for a particular content type.
We're working on a revision to the design that would keep the short form above but also keep the tabbed browsing widget with a dedicated view for each tab, similar to what itamar's patch shows in comment #7.
We hope to have this design posted by end of day Monday.
Since keeping the tabbed browsing widget and extending it to the homepage would likely reduce the implementation effort here, I'm marking the issue as postponed until Monday.
Comment #10
ezra-g commentedHere are updated designs as mentioned in #9.
Setting back to "active."
Comment #11
itamar commentedUpdating the patch to the new design. Currently implemented only for posts.

Comment #12
amitaibuMinor issues:
This should be declared by each module.
Lets convert this to a "header" views handler. Less hacky.
Spaces.
GROUP_AUDIENCE_FIELD
Comment #13
itamar commentedRe-rolling;
- Adding the mini node form as a views area handler.
- Improving the theming.
Notice that the implementation is still only for posts.
Comment #14
ezra-g commentedI think this was primarily set to "needs review" for a broad validation of the approach.
This seems like a great approach. Awesome work, itamar!
I filed #1979150: Add jQuery Placeholder library to packaging whitelist to add the jQuery Placeholder library to the Drupal.org packaging whitelist so that we can include it in the next release of Commons.
To help us align on expectations for what's still "needs work" here:
A) The requirements for the library suggest that we'll either need jQuery 1.6 (and therefore Jquery update module) or to use version 1.8.7 of the Placeholder library. My general preference is to avoid jQuery update if we can, at least in the short term, since we're likely to have a reduced chance of side effects by not introducing jQuery update. I suggest we have a separate followup issue to evaluate jQuery update if that seems necessary.
B) Note that the "Posts" short form is also intended to appear on the "All" tab.
C) Refactoring of the site frontpage
D) Updating the "Post created" message type per the screenshot in the OP.
E) We'll need to provide an upgrade path for existing sites in the form of a hook_update_N() implementation to revert the relevant Views and Panels pages
F) Integrations for the other Commons group-enabled modules - See the interactive prototpye linked from the OP for which fields should be enabled for which content types.
Please note that zarabadoo will take care of any styling/themeing changes that need to happen to make this appear as expected, so feel free to disregard those bits :).
Thanks again - Excited to see this moving forward!
Comment #15
itamar commentedWork in progress.
- Adding the post form to the all tab.
- Adding the questions form.
Both 1969088-commons_profile-partial_node_form-11.patch and 1969088-commons_origins-partial_node_form-13.patch are unchanged.

Comment #16
ezra-g commentedI've been testing 15 by creating a new site-specific image gallery feature, and this approach is working spectacularly. I love how I can customize the presentation of the short form with hook_form_commons_bw_partial_node_form_alter()! Excellent work!
Comment #17
ezra-g commentedOne thing I've noticed experimenting with adding content types to the browsing widget with #15 is that if the body field isn't configured to appear in the short form, I get the following error when submitting the short form:
"EntityMetadataWrapperException: Unable to get the data property value as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 444 of /Users/ezra/Developer/htdocs/dev/acquia/commons_nightly/commons/latest-2/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc)."
Comment #18
ezra-g commentedCorrection: We actually get this error whenever the body field is blank, even if it does appear in the form. This is problematic with a content type such as an image gallery where the body isn't presented but other fields are presented.
Comment #19
cherrysuede commentedi'm looking to move my site to drupal commons - and one of the things our users do is post photos(multiple) and video (links) as posts in groups.. will that be possible with this "quick post" ?
Case is the events have "pre-event" posts and "post-event" posts - they went and want to share the things they saw... took photos etc - what you are describing here would be perfect!
Comment #20
skomorokh commentedNice! How about "Longer post..." for the expand-form link title?
Will this work without depending on commons_wysiwyg? Current dc project is for a more technical user base and we're using Markdown. Seems like it will since one of the above is using the Filtered HTML text format.
Comment #21
itamar commented- Adding the browsing widget to the homepage.
- Adding the partial form to all BW content types.
- Fixing problem described under #17.
- Updating the "created" text on nodes
Comment #22
amitaibuoff topic: ezra-g, let's talk in our scrum about the whole separation of modules, it makes it much harder to contribute and review.
Comment #23
amitaibu+ if (!empty($node->{OG_AUDIENCE_FIELD}) && $wrapper->{OG_AUDIENCE_FIELD}->count() == 1) {We can use og_is_group_content_type()
$variables['submitted'] = t('!type created @interval ago in the !group group by !user', $placeholders);Let's always show the titles of all groups. make sure to
entity_access('view'...)each title+ if (!empty($node->{OG_AUDIENCE_FIELD}) && $wrapper->{OG_AUDIENCE_FIELD}->count() == 1) {We can use og_is_group_content_type()
$variables['submitted'] = t('!type created @interval ago in the !group group by !user', $placeholders);Let's always show the titles of all groups. make sure to
entity_access('view'...)each titledrupal_css_id()
str_replace('_', '-', $bundle)
Explain why it needs to be first.
hyphen in bundle, drupal_css_id()
Save => Validate.
This should move into an info hook provided per module.
Comment #24
itamar commentedFixing #23
Comment #25
itamar commentedThere's a problem with the image ajax upload on the post field; Currently, when uploading an image with the Upload button on the "All" tab, it fails because for some reason
file_ajax_upload()expects theform_build_idof the posts form instead of the all'sform_build_id.Comment #26
itamar commentedFixing the ajax upload issue.
Avoiding rendering several copies of the same form, and instead, moving the form that needs to be duplicated from tab to tab with javascript.
Comment #27
itamar commentedMoving back to "needs work" for adding the "Refine by" checkboxes (Following/ Not following/ Featured).
Comment #28
itamar commentedBecause the filters issue as not as trivial as I expected, I'm setting this as ready and opening a new issue for the filters.
Comment #29
lightsurge commentedcheck_plain() runs htmlspecialchars() which I thought wasn't good in terms of saving node title to database?
Maybe could use
truncate_utf8(filter_var($wrapper->body->value->value(), FILTER_SANITIZE_STRING), 30, TRUE, TRUE);Comment #30
lightsurge commentedActually, auto_nodetitle.module does this
$output = preg_replace('/[\t\n\r\0\x0B]/', '', strip_tags($output));which is probably better.http://drupalcode.org/project/auto_nodetitle.git/blob/refs/heads/7.x-1.x...
Comment #31
ezra-g commented#26 doesn't apply. @itamar, can you re-roll?
Comment #32
ezra-g commentedFalse alarm, sorry about that.
Comment #33
itamar commentedRe-rolling #26. and fixing the problem of htmlentities being left encoded on posts titles.
Comment #34
ezra-g commentedThanks, itamar.
#33 resolves the issues I was having with the body field at #17.
This is close to RTBC.
A) The content creation forms are being presented to anonymous users, as shown in this screenshot.
B) When there is a form validation error on the body field, the validation error message displayed is incomplete, per the screenshot below:
C) When displaying form validation errors for forms submitted in tabs other than the "All" tab, it would be ideal to add the Quicktabs query string so that the user is presented with the form she just attempted to submit where she can correct her error. I don't see this as a blocker and would be fine addressing in a followup issue.
And, D and E from #14
For E, we also need to enable the Title module where applicable.
On a related note, this issue has been a valuable example of why #1983606: Move some of the Commons_* modules into the Commons distro repo is important. Thanks for your excellent work here despite the complexity of rolling patches to so many projects.
Comment #35
itamar commentedThis issue should be resolved with #1984824: Anonymous users are able to create group content
Comment #36
itamar commentedResolving issues B, C and D.
E:
It seems that it's not necessary to revert the views and panels; If they were not overridden, then applying the patch and clearing the cache will suffice to update them, and if they were overridden , then reverting them will delete the personal changes.
About the title module: I verified that when applying the patches on a 3.x installation and clearing the cache, I get the wanted title fields.
Comment #37
ezra-g commentedThanks, itamar. I'll review this in detail a bit later today.
I wanted to clarify what I'm referring to when I say the Post created activity stream message:
The requested change is that posts use the format "Bob posted [node title]" rather than the current "Bob created" so that posts can function more like status updates. I believe Commons already has TimeAgo formatting on the activity streams, though in my review later I'll compare the changes here to what's currently in Commons.
This is depicted in the OP screenshot:
I'm fine addressing this in a followup issue.
Comment #38
Zarabadoo commentedFrom 1969088-commons_bw-partial_node_form-36.patch:
This gives me the following error. I am running PHP 5.4, so it may not be an issue, but I figured it does not hurt to mention it.
Only variables should be passed by reference in commons_bw_handler_node_partial_form->render()Comment #39
ezra-g commentedThanks for the feedback, Zarabadoo!
Given the current pain around re-rolling here and the fact that 5.4 isn't officially recommended, I suggest we address this in a followup issue.
Comment #40
jpontani commentedThat warning isn't dependent on a specific PHP version. It's because render() calls drupal_render(), which tries to set the #printed attribute on each element to be rendered, but is unable to since the array is just the return from drupal_get_form.
To get rid of the warning, it should be something like:
Comment #41
Zarabadoo commentedThe source order of the form could use some love. I am in the process of theming and finding things are out of place without specific styling. The screens are annotated, but it mostly boils down to 3 items.
The consistency will make things easier to theme without using absolute positioning and also allow for adding wrappers where needed.
Comment #42
ezra-g commentedI think this is 98% RTBC. Commons_BW looks great and the changes are functioning as expected.
Here are the remaining issues I see, which we can address here through discussion and in new followup issues - I'd commit the relevant bits but want to get your input before doing so:
A) If we have a field_base definition for title in Commons Wikis, then we're making Commons Wikis a dependency for any other module that wishes to have a title field. Since Title module handles moving from core to FieldAPI-controlled titles, could we instead use an update hook to migrate the title field for the relevant content types? And:
B) I see that Title module's Views integration is smart enough that we don't have to use different title fields depending on where the title is stored. However, for sites that want the internationalization/multilingual benefits of Title module, as well as consistent DX, it seems to me like it's worth just standardizing on Title module for all the content types since it may later be enabled anyhow.
@itamar/amitaibu: Do you agree?
From my perspective A/B are the only things we should sort out before committing and moving onto followup issues.
Let's address the following in followup issues:
C)
Currently, Commons Groups doesn't depend on having any of the content modules enabled and in my view that should continue to be the case. Let's dynamically set these values instead of hardcoding content type names in. This could happen in a followup issue.
D) I mentioned on a call but I should have posted in the issue queue: Because we're likely to standardize on Media module for attaching images, my sense is that we should avoid introducing an image field and later removing it from the Distribution or having to migrate data. I'll take on the work of removing that field before committing, and moving it to a separate module for the project that funded this work.
E) Let's address the Posts activity stream message in a followup issue.
Leaving as "needs review" for feedback from itamar/amitaibu on A/B.
Comment #43
Zarabadoo commentedTo expand on the wiki title issues, they certainly do cause issues. If a wiki is created via the partial form, the title is missing from the teasers. If you go to the full form, there are 2 title fields.
Comment #44
itamar commentedPatch addresses point #42 A/B by moving the
title_fieldbase to commons_bw, and by creating there title instances for all content types. @ezra-g Please let me know if you find this a reasonable solution.In addition, I included the suggestion in #40, and fixed the form elements ordering according to #41.
Notice that the problem described in #43 should not happen with the
titlemodule enabled.Comment #45
itamar commentedResolving issue #42 C.
I'm uploading again all relevant patches, for the sake of having them all in one comment.
Comment #46
itamar commentedThe patch 1969088-commons_groups-partial_node_form-45.patch is wrong, and should be replaced with 1969088-commons_groups-partial_node_form-46.patch. The rest seem fine to me.
Comment #47
ezra-g commentedThanks, itamar. Can you respond to 42 A/B and 43? These were the remaining issues identified as blockers to committing.
Comment #48
itamar commented@ezra-g, both 42 A/B and 43 are addressed in the latest patches, see comment #44.
Comment #49
ezra-g commentedSorry, I missed this:
Alternatively, is there an API function or setting within Title module we could use instead to set the Title fields? The Commons content type modules currently mostly avoid dependencies on other parts of Commons, so it would be ideal to keep that pattern in place.
If not, however, commons_bw seems like a reasonable place to put the dependency.
Comment #50
itamar commented@ezra-g, @amitaibu
I believe we can use
title_field_replacement_toggle('node', $bundle, 'title')in an hook_update in each of the content modules, without the need to define the title field in the "features". Would that be better?Comment #51
ezra-g commentedtitle_field_replacement_toggle('node', $bundle, 'title') does seem preferable to me. Either in the individual modules themselves or in commons_bw.module in a hook_modules_enabled() implementation for types that will show in the widget both seem like good places to me.
Thanks!
Comment #52
ezra-g commentedApologies for the back and forth: Let's continue with #45 as-is with the title field base in commons_bw: It works great for ~95% of use cases and someone who doesn't want to use the Commons_bw() can use hook_system_info_alter() to remove the dependency.
In addition to preventing you from having to re-roll, it also makes it somewhat easier to provide support for Commons sites by checking on the status of the field. We should be able to make some assumptions about how the application works and having Title module and Commons_BW seem like reasonable ones to me.
I'll do a functional review of this on Monday morning, but I suspect it's RTBC.
Thanks, itamar!
Comment #53
itamar commentedFixing a slight problem that arose when we enabled the title field on all content type.
Comment #54
Zarabadoo commented'user-picture-available' is a class added by the theme for styling purposes and can be added in the theme. It is not critical to move it now, but it is something that I wanted to point out for future reference.
Update:
Something else that would need done here is to use
instead of #prefix and #suffix.
Comment #55
ezra-g commentedI'm experiencing exactly the same 2 problems zarabadoo described in #43.
I suspect that that somewhere in the code flow title_field_replacement_toggle() or Title module in general does something to avoid duplication with the core title field that we're not getting using the Features exporting approach. #1704536: Attach title field automatically when a new entity bundle is created may hold some clues but I haven't looked into it yet.
I re-rolled the patches to Commons_BW and Commons_site_homepage to revert their respective features. Commons_Bw also needed a hook_system_info_alter() implementation to add the field_instance lines to commons_bw.info.
This is so close!
Comment #56
ezra-g commentedLooks like the magic function we want is title_field_replacement_toggle().
Comment #57
ezra-g commentedActually, the problem here seems to be that Title module was not enabled.
I made title a dependency of Commons_bw, and added a module_enable() to commons_bw for good measure. This resolved the problems with wiki titles.
However, on the groups directory, group titles are not showing in the teasers.
Fwiw, I also noticed at admin/content that content created from the full content creation form has language set to "Language neutral" vs content submitted in the BW, which has "Undefined language ()".
Comment #58
itamar commentedAddressing latest issues, except of #54:
It's not possible to add the class in the proper way because commons origins prints the form classes separately from its attributes array.
This time I verified that everything works as I expected not only on fresh install but also when applying the patches on an existing 3.x installation.
Comment #59
itamar commentedAdding one missing patch.
Comment #60
ezra-g commentedOn an upgrading site, I still have the same problem as in #57:
Also:
This will toggle the field to the opposite of its current value. For sites that have Title module enabled already for translation, it will *disable* the field.
However, in my re-roll in #57, I found that adding a call to the Title API was wasn't necessary to resolve the issues from #43/55 - Did you find different results?
Comment #61
ezra-g commentedI'm testing on a fresh install to see if the issues with disappearing group titles happen with just Commons dev + Title module. If so, we can address in a followup.
Comment #62
ezra-g commentedIndeed, I filed #1990206: Group titles disappear from teasers when using a Title module title field as a followup. Continuing the review.
Comment #63
ezra-g commentedI brought in the commons_bw.install file from #57, removed the posts image field per 42D, committed and filed followup issues.
Excellent work, itamar!
Commits:
http://drupalcode.org/project/commons_posts.git/commit/1873eb6
http://drupalcode.org/project/commons_bw.git/commit/cdb7ca5
http://drupalcode.org/project/commons_groups.git/commit/46f3b0d
http://drupalcode.org/project/commons_events.git/commit/3ae82e3
http://drupalcode.org/project/commons_polls.git/commit/28987a5
http://drupalcode.org/project/commons_q_a.git/commit/e4cb4c8
http://drupalcode.org/project/commons_site_homepage.git/commit/eddd9ce
Followup issues:
#1990206: Group titles disappear from teasers when using a Title module title field
#1990256: Theme updates for new Browsing widget
#1990254: Empty text on site frontpage says "in this group"
#1990250: Status-like activity stream message for posts
#1990246: "node created" dsm should display after submitting node via the short form
#1990318: Browsing widget form tweaks for Commons Documents
Comment #64
ezra-g commentedAdditional followup: #1990332: Add placeholder module and library.
Comment #65
ezra-g commentedCommit for Commons Wikis: http://drupalcode.org/project/commons_wikis.git/commit/bdaf97f.
Comment #67
BarisW commentedSo glad to have this in, thanks a lot for all the work.
While we're at it; can we also tag users in status updates?
See #1993134: Add possibility to tag users in status updates
Comment #68
BarisW commentedCan someone explain me how to get this working? I've tried using 7.x-3.x-dev but I don't see this appearing.
I'm working on a large Commons 3 project and the client really wants this in.
I'm not sure if we can wait for the next release of Commons? Can someone shine a light on this?
Comment #69
ezra-g commented@BarisW , try packaging all of Commons with build-commons-dev.make, and copying the files over your existing installation. If that doesn't work, please file a new issue on the topic of testing dev updates and we'll take it up there.
Thanks!
Comment #70
Honestly Illustrated commentedComing here from a query on "drupal commons "what's going on"", and although the micro-tasks here are meant to be broken out into separate issues, the macro of this doesn't seem complete... so I'm wondering if anyone noticed that System automatically closed the issue. :)
Incidentally, I'm actually here looking for the right way to filter things out of the "what's going on" feed. Specifically, on filter criteria like content type or "publish to front page". I've found the "/activity" feed view, and that covers the home page block as well, but "what's going on" is a Panels pane that I'm not finding admin UI configuration for yet, if it exists.
Comment #71
ezra-g commentedPlease file a new support request. Thanks.
Comment #72
Honestly Illustrated commentedNo worries. I must have been tired anyway, to think this issue was related to "what's going on" just because Google said so.
#1919576: How to edit view of "What's going on" panel on homepage has already brought my #70 comment as a feature request. I'll add my related paragraph there.
Comment #72.0
Honestly Illustrated commentedUpdated designs.
Comment #72.1
ezra-g commentedMarking as read only.