Most Read Authors/Most Commented Lists for community content
Posted: 05 October 2008 06:45 AM   [ Ignore ]  
Grad Student
Rank
Total Posts:  61
Joined  11-27-2007

Looking to add lists to the sidebar of a community site, where users will login and submit content.  Their usernames and profile images will then be displayed in the sidebar etc.

However, on the homepage of the community commenting area, the client has requested the following:


1.  Most read authors in the last year - list of authors (users publishing full length articles, disregarding comments, to the community area) sorted by the combined number of views on their articles in the last year.  If this proves to be extremely complicated to implement, this could be sorted by number of comments made by others on their articles in the last year instead.  The intention is that this will act as an incentive for authors to post content.

2.  Most active users in the last 90 days - list of users sorted by how many comments they have made in the last 30 days.

3.  Most commented - articles with the most comments in the last 90 days

Any help appreciated, thanks.

Profile
 
 
Posted: 05 October 2008 07:08 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

It all looks like it will take some custom coding.  I’m going to shift to ‘How to’ for brainstorming the queries.  It’s also possible there are some plugins out there I’m not aware of that might apply.  A plugin is likely the best option here.

The difficulties is that none of the currentt tags give you the ‘last 90 days’.  So while the weblog tag can be comment_total, you can’t limit it to count only comments in the last ‘x’ days.  You’d need feature requests to add that ability stock.

Make sense?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 05 October 2008 07:09 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  61
Joined  11-27-2007

OK, will see if anybody can come up with anything and take things from there.  It seems like this would be fairly standard for a large-ish community site though.  Any suggestions guys?

Profile
 
 
Posted: 13 October 2008 11:40 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  13
Joined  01-16-2008

This will do the tricks smile

{exp:query sql="select count(*) as total,author_id,avatar_filename,screen_name as sn from exp_comments c left join exp_members m on c.author_id=m.member_id where author_id>0 group by author_id order by total desc limit 6"}
                        
<div>
                          <
a href="/member/{author_id}">
                                
{if avatar_filename}
                                
<img src="/images/avatars/{avatar_filename}" border="0">
                                
{if:else}
                                
                                
<img src="/images/avatars/default_picture" border="0">
                                
{/if}
                          
<br>{sn} made {total} comments</a>
                          </
div>
{/exp:query}

Profile
 
 
Posted: 14 October 2008 03:06 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  61
Joined  11-27-2007

Great, that works perfectly for the first part.

This wouldn’t work using something like this to control the time period?:

<?php
global $LOC;
$start_time = $LOC->decode_date('%Y-%m-%d %g:%i %A', $LOC->now - 2592000); // 2592000 seconds in a month - display if in the last month
?>

Profile
 
 
Posted: 22 October 2008 08:50 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  61
Joined  11-27-2007

Any thoughts?  Limiting this to the last 2 months is pretty important as it needs to be a recent ‘Top Commenters’ list rather than an all-time list.

Could a moderator move this to technical support please?  It’s connected to a licenced version of EE.

Profile
 
 
Posted: 22 October 2008 09:20 PM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

vanquished, the ‘Tech’ answer is, you can’t do it with stock tags.  If there was a parameter or something that would return the total for the last x days, I’d point it out. 

‘How to’ is for brainstorming how to approach a site, or come up with a way to do something EE won’t do ‘out of the box’.  If I moved it back to ‘Tech’ my only answer would be ‘That’s not currently available, but it would make a good feature request’.

I just shifted this to ‘How to’ as it might gain some insights into how you might work around the fact there isn’t currently an existing method to do what you want.

1.  EE’s view count doesn’t record when the view was made.  So stock, you can’t limit it to a given time period.  If I needed this, I’d probably write an extension and add a custom table to count both views and time and create summary stats from that.  There may be other ways to go at it, but it simply isn’t currently available as a tag.  And since there is no date associated with each view, you can’t do a custom query or anything.  The information simply isn’t in the database on a standard EE installation.  You could come up with average veiws via query/php- because you have the entry date.  But that’s as close as you could get- and even that’s pretty much custom coding, just not too difficult to do.

2.  This could likely be done with a custom query.  adorkable81 was on the right track, but you’d need to add in a check for date.  Since the date of the comment is available, it should be possible.  But custom queries are beyond tech support- and rightly a ‘How to’ issue.

3.  Same issue- EE doesn’t make available a comments in the last ‘x’ days count.  Should be possible with a custom query.

If I had already written any of these up for a site I’ve worked on, I’d share it.  But I haven’t.  You might skim the plugins, as it’s possible someone has rolled one out that would do the trick.  But if not, you’d need to code your own or consider bringing in outside help.  The above would all boild down to feature requests or custom add-ons, as they aren’t currently available.

Make sense why this was shifted to how to?  The features just aren’t there in the standard install.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 23 October 2008 05:02 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Rank
Total Posts:  61
Joined  11-27-2007

OK, thanks.

Based on my experience with PHP (minimal), I might have to skip this and just have a list of all time top commenters.

To get a ‘most commented articles’ list I can just limit it to articles posted after a specific date.

Regarding most read authors, there’s no way to combine the hit count for all of an author’s posts and display thie in a list?

Profile
 
 
Posted: 24 October 2008 08:04 PM   [ Ignore ]   [ # 8 ]  
Grad Student
Rank
Total Posts:  61
Joined  11-27-2007

Have the query up and running to pull the top commentors, is there any way of doing exactly the same for authors (not too worried about the date issue at present).  In addition, how would I go about limiting both of these lists to comments/entries in 1 weblog?

Thanks so much for your help - it’s hugely appreciated.

Profile
 
 
Posted: 02 November 2008 10:51 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Rank
Total Posts:  61
Joined  11-27-2007

Any way to do this?  Sort authors by number of entries in weblog {news}?

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64904 Total Logged-in Users: 46
Total Topics: 81847 Total Anonymous Users: 23
Total Replies: 440038 Total Guests: 244
Total Posts: 521885    
Members ( View Memberlist )