Create recent posts & comments block for Sfx's new Homepage

VERIFIED FIXED in 3.0

Status

Websites Graveyard
spreadfirefox.com
--
blocker
VERIFIED FIXED
9 years ago
7 years ago

People

(Reporter: Mary, Assigned: Paul Booker)

Tracking

unspecified
x86
All

Details

(URL)

Attachments

(4 attachments, 6 obsolete attachments)

(Reporter)

Description

9 years ago
This will need to aggregate recent posts & replies from all groups and display them on the news and events page.

Paul (I believe) suggested the simplefeed module which converts aggregated content to nodes so that you can post further comments.
(Assignee)

Comment 1

9 years ago
Taking this one.
Assignee: nobody → paul
(Assignee)

Comment 2

9 years ago
We can do this with help of the views module.
(Reporter)

Comment 3

9 years ago
Created attachment 361825 [details]
Image of "Recent Discussions" Block

Hey Paul:  Here is an image of what the recent conversation block would look like.
(Reporter)

Comment 4

9 years ago
I added the image of the block for reference.  Right now it has a link to "+ View all postings" that the designer had put in.  Would this be a challenge to have all comments/discussions aggregated on to what page that people could navigate to?

This would really help in that people really still aren't sure where to go to converse.  I could see this sub group having:

* A title for each post
* Group/Project where it was posted from
* First 2 sentences

Let me know.
(Assignee)

Comment 5

9 years ago
Yes, i should be able to get that done for the week ending 27th February
(Assignee)

Comment 6

9 years ago
I was able to create two page/block views that allow you to show separately recent group nodes posted in a users subscribed groups and recent group comments posted in a users subscribed groups, but not both together.

Will these be ok ? I guess two blocks can be made to look as one, thinking that might be easier 

I'll add the views here for later reference ...

$view = new stdClass(); $view->name = 'sfx_og_recent_posts'; $view->description = 'Shows all activity in subscribed groups.'; $view->access = array ( 0 => '2', ); $view->view_args_php = ''; $view->page = TRUE; $view->page_title = 'Recent posts in my groups'; $view->page_header = ''; $view->page_header_format = '3'; $view->page_footer = ''; $view->page_footer_format = '1'; $view->page_empty = '

There are no posts in your subscribed groups.

'; $view->page_empty_format = '1'; $view->page_type = 'table'; $view->url = 'group/posts'; $view->use_pager = TRUE; $view->nodes_per_page = '25'; $view->menu = TRUE; $view->menu_title = 'My recent'; $view->menu_tab = TRUE; $view->menu_tab_weight = '0'; $view->menu_tab_default = FALSE; $view->menu_tab_default_parent = NULL; $view->menu_tab_default_parent_type = 'tab'; $view->menu_parent_tab_weight = '0'; $view->menu_parent_title = ''; $view->block = TRUE; $view->block_title = 'Recent group posts in subscribed groups'; $view->block_header = ''; $view->block_header_format = '1'; $view->block_footer = ''; $view->block_footer_format = '1'; $view->block_empty = ''; $view->block_empty_format = '1'; $view->block_type = 'list'; $view->nodes_per_block = '3'; $view->block_more = FALSE; $view->block_use_page_header = FALSE; $view->block_use_page_footer = FALSE; $view->block_use_page_empty = FALSE; $view->sort = array( array( 'tablename' => 'node', 'field' => 'nid', 'sortorder' => 'DESC', 'options' => '', ), ); $view->argument = array( array( 'type' => 'rss_feed', 'argdefault' => '2', 'title' => '', 'options' => '', 'wildcard' => '', 'wildcard_substitution' => '', ), ); $view->field = array( array( 'tablename' => 'node', 'field' => 'type', 'label' => 'Type', 'sortable' => '1', ), array( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink_with_mark', 'sortable' => '1', 'options' => 'link', ), array( 'tablename' => 'users', 'field' => 'name', 'label' => 'Author', 'sortable' => '1', ), array( 'tablename' => 'node_comment_statistics', 'field' => 'comment_count', 'label' => 'Replies', 'handler' => 'views_handler_comments_with_new', 'sortable' => '1', ), array( 'tablename' => 'node', 'field' => 'created', 'label' => 'Last post', 'handler' => 'views_handler_field_since', 'defaultsort' => 'DESC', ), ); $view->filter = array( array( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array( 'tablename' => 'og_uid_node', 'field' => 'currentuid', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_USER***', ), ); $view->exposed_filter = array( ); $view->requires = array(node, users, node_comment_statistics, og_uid_node); $views[$view->name] = $view;

$view = new stdClass(); $view->name = 'sfx_og_recent_comments'; $view->description = 'Display recent comments block in a group'; $view->access = array ( ); $view->view_args_php = ''; $view->page = TRUE; $view->page_title = 'Recent group comments in subscribed groups'; $view->page_header = ''; $view->page_header_format = '1'; $view->page_footer = ''; $view->page_footer_format = '1'; $view->page_empty = ''; $view->page_empty_format = '1'; $view->page_type = 'table'; $view->url = 'group/comments'; $view->use_pager = TRUE; $view->nodes_per_page = '25'; $view->block = TRUE; $view->block_title = 'Recent group comments in subscribed groups'; $view->block_header = ''; $view->block_header_format = '1'; $view->block_footer = ''; $view->block_footer_format = '1'; $view->block_empty = ''; $view->block_empty_format = '1'; $view->block_type = 'list'; $view->nodes_per_block = '3'; $view->block_more = FALSE; $view->block_use_page_header = FALSE; $view->block_use_page_footer = FALSE; $view->block_use_page_empty = FALSE; $view->sort = array( array( 'tablename' => 'comments', 'field' => 'timestamp', 'sortorder' => 'DESC', 'options' => 'normal', ), ); $view->argument = array( ); $view->field = array( array( 'tablename' => 'comments', 'field' => 'subject', 'label' => '', 'handler' => 'views_handler_field_commentlink', 'options' => 'link', ), array( 'tablename' => 'comments', 'field' => 'name', 'label' => '', ), ); $view->filter = array( array( 'tablename' => 'node_comment_statistics', 'field' => 'comment_count', 'operator' => '>=', 'options' => '', 'value' => '1', ), array( 'tablename' => 'comments', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '0', ), array( 'tablename' => 'og_uid_node', 'field' => 'currentuid', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_USER***', ), ); $view->exposed_filter = array( ); $view->requires = array(comments, node_comment_statistics, og_uid_node); $views[$view->name] = $view;
Target Milestone: --- → 3.0
(Reporter)

Updated

9 years ago
Blocks: 478829
(Reporter)

Comment 7

9 years ago
Ideally, it would be both comments and posts.  Also, how does it work if
someone isn't logged in?  This is on the home page so I forsee not many people
logging in first.
(Assignee)

Comment 8

9 years ago
How about we try to implement a tabbed block solution showing recent posts / recent comments. Doing this should be a lot simpler to implement.

If someone is not logged in then we will need to show some other content.

I'll upload some images so you can see where things are at .
(Assignee)

Comment 9

9 years ago
Created attachment 362924 [details]
View page of group posts
(Assignee)

Comment 10

9 years ago
Created attachment 362925 [details]
View page of group comments
(Assignee)

Comment 11

9 years ago
Created attachment 362927 [details]
View page of group posts / comments blocks

Thinking we could have these blocked rendered in tabs and use CSS to hide some of the content displayed that we want to see in the page view but not the block view
(Reporter)

Comment 12

9 years ago
Eek - couple of problems here:

* I thought that we had resolved the issue with being able to see comments whether or not you subscribe to a group.  Can you verify this?

* Not being able to see the comments in that block on the homepage unless you are signed in sorta defeats the purpose.  We wanted this to show people that were visiting the site there is activity on site.  Any way we can allow comment & post viewing without being logged in?
(Assignee)

Comment 13

9 years ago
* I thought that we had resolved the issue with being able to see comments
whether or not you subscribe to a group.  Can you verify this?

My understanding was that you would only be able to see group posts / comments as non members if the group was public . So public group nodes and all comments should be visible to anonymous users ?

* Not being able to see the comments in that block on the homepage unless you
are signed in sorta defeats the purpose.  We wanted this to show people that
were visiting the site there is activity on site.  Any way we can allow comment
& post viewing without being logged in?

that's correct

As the problems above are resolvable do you want to work towards a solution along this path ie taking the above functionality and apply Alex's theme to it
or do you want to me to write some bespoke code? but just to be clear i don't have any css / template experience so ill have a "little" learning curve to get over

I'll continue working on this tomorrow , let me know your thoughts and ill then pull out all the stops to deliver :-)
(Assignee)

Comment 14

9 years ago
Ok, 

I have ruled out the possibility of creating the page / block of node & comments together using views as the Views maintainer advises  ..

"Views can't do this. You would have to write a custom sort handler. But remember, you need to use SQL to sort, not PHP, and it's kind of difficult to write the SQL like you have.

(Mixing comments + nodes in a list is always very tough, and Views isn't really built for that)."

http://drupal.org/node/349584/comments-1190500#comment-1190500

I had the idea of using nodecomment module to convert comments to nodes and then use views but then i remembered / realised that forum / og_forum have a dependency on the comments module so this is not possible.

So ill need to write some bespoke code for this. Ill start working on the SQL command ,there may be some snippets on drupal.org.

If you need to advise / instruct me on any matters regarding templates / css , please do.

Best, Paul
(Assignee)

Comment 15

9 years ago
Just letting you all know that there were no problems in forming the SQL ..

(SELECT nr.title as title, nr.body as body, nr.timestamp as timestamp FROM node_revisions nr INNER JOIN node n ON nr.nid = n.nid WHERE status = 1)
UNION
(SELECT c.subject as title, c.comment as body, c.timestamp as timestamp FROM comments c WHERE status = 0)
ORDER BY timestamp DESC LIMIT 5
(Assignee)

Comment 16

9 years ago
Created attachment 363138 [details] [diff] [review]
A helper module to render recent nodes / comments together on a page / block

Making good progress.

So far this helper module implements the "recent nodes / comments" block. 

The block is generated and cached every time a node or comment is created / updated.

I'll have this bug finished tomorrow.
Attachment #362924 - Attachment is obsolete: true
Attachment #362925 - Attachment is obsolete: true
Attachment #362927 - Attachment is obsolete: true
(Assignee)

Updated

9 years ago
Attachment #363138 - Attachment is patch: true
Attachment #363138 - Attachment mime type: application/octet-stream → text/plain
(Reporter)

Comment 17

9 years ago
Hey there:  If this doesn't work, we can do something like the current "What People are Talking About"?

Also, I realized I misnamed the bug slightly -- this is for the homepage so updating it.

Thanks!
(Reporter)

Updated

9 years ago
Summary: Create recent posts & comments block for Sfx's News & Events page → Create recent posts & comments block for Sfx's new Homepage
(Assignee)

Comment 18

9 years ago
Created attachment 363158 [details] [diff] [review]
A helper module to render recent nodes / comments together on a page / block

Everything is done now , just needs some polishing tomorrow. I'll upload a image ..
Attachment #363138 - Attachment is obsolete: true
(Assignee)

Comment 19

9 years ago
Created attachment 363159 [details]
Accompanying screenshot
(Assignee)

Comment 20

9 years ago
Created attachment 363290 [details]
Create a recent posts & comments page /block for Sfx's new homepage

We need to make a small modification to the core comment module comment_save() function so that when a comment is updated the timestamp against the comment is updated. With this modification the records on the "recent posts & comments page" are ordered by the last time they were updated in descending order 

db_query("UPDATE {comments} SET status = %d, timestamp = %d, subject = '%s', comment = '%s', format = %d, uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['status'], time(), $edit['subject'], $edit['comment'], $edit['format'], $edit['uid'], $edit['name'], $edit['mail'], $edit['homepage'], $edit['cid']);
Attachment #363290 - Flags: review?(buchanae)
(In reply to comment #20)
> We need to make a small modification to the core comment module comment_save()

Sorry, there will be NO changes to core Drupal code.
(Assignee)

Comment 22

9 years ago
That's understood , if this is not something that can be patched against drupal core ill find another solution to the ordering problem
(Reporter)

Comment 23

9 years ago
Hey Paul:  Checking in here.  We need to make a call pretty soon on how to do this.
(Assignee)

Comment 24

9 years ago
Ill post my patch to Moshe (OG Maintainer) and if he gives a quick response to say he with patch this against the latest OG then we can go this path. In the meantime though ill see if can write a helper module to implement this functionality outside of OG.
(Assignee)

Comment 25

9 years ago
Sorry, #24 was relevant to another bug . I'll get this resolved in the morning with another helper module :-)
(Assignee)

Comment 26

9 years ago
Created attachment 364089 [details]
Create a recent posts & comments page /block for Sfx's new homepage
Attachment #363158 - Attachment is obsolete: true
Attachment #363290 - Attachment is obsolete: true
Attachment #364089 - Flags: review?(buchanae)
Attachment #363290 - Flags: review?(buchanae)
(Assignee)

Comment 27

9 years ago
Created attachment 364091 [details]
Allows a timestamp to be collected when a comment is inserted / updated
Attachment #364091 - Flags: review?(buchanae)
(Assignee)

Comment 28

9 years ago
Let me know if we can get these modules into SVN
(Reporter)

Comment 29

9 years ago
Alex:  Can you check this out?
Severity: normal → blocker
r22896
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Comment on attachment 364089 [details]
Create a recent posts & comments page /block for Sfx's new homepage

this review no longer needed, bug marked resolved fixed
Attachment #364089 - Flags: review?(buchanae)
Comment on attachment 364091 [details]
Allows a timestamp to be collected when a comment is inserted / updated

no longer needed, bug marked resolved fixed
Attachment #364091 - Flags: review?(buchanae)
Verified FIXED on https://spreadfirefox.authstage.mozilla.com/; we'll file spinoff bugs when and if we find them.
Status: RESOLVED → VERIFIED
OS: Mac OS X → All
Product: Websites → Websites Graveyard
You need to log in before you can comment on or make changes to this bug.