Closed (fixed)
Project:
Video
Version:
master
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
11 Sep 2005 at 18:06 UTC
Updated:
19 Sep 2005 at 15:08 UTC
Jump to comment: Most recent file
I was getting a bug where the "top videos" block wasn't getting put in the right order. So this patch fixed that problem for me and also orders it based on the download_counter + the play_counter. It could be changed so there is seperate "most played" and "most downloaded" blocks, if people think that is a good idea i could do it. So if no one sees any problems with this new code i'll commit it to CVS.
Original code:
function video_block_list($type = 'top') {
$orderby = ($type == 'new') ? 'n.created' : 'v.download_counter';
return node_title_list(db_query_range(db_rewrite_sql(
"SELECT DISTINCT(n.nid), n.title FROM {node} n, {video} v
WHERE n.type = 'video' AND n.status = 1 AND n.moderate = 0
ORDER by $orderby DESC"),0, 10));
}
Updated code:
function video_block_list($type = 'top') {
$orderby = ($type == 'new') ? 'n.created' : 'v.download_counter + v.play_counter';
return node_title_list(db_query_range(db_rewrite_sql(
"SELECT n.nid, n.title FROM {node} n, {video} v
WHERE n.nid = v.nid AND n.type = 'video' AND n.status = 1 AND n.moderate = 0
ORDER BY $orderby DESC"),0, 10));
}
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | video.module.block.patch | 4.56 KB | LukeLast |
| #1 | video.module_0.patch | 1020 bytes | LukeLast |
Comments
Comment #1
LukeLast commentedHere it is in patch form.
Comment #2
fax8 commented+1 for me. feel free to commit.
Also like the idea to add most played, most downloaded. but still leave top videos.
which sums played and downloaded counters.
Comment #3
LukeLast commentedcommitted a couple patches to CVS.
I'll look at adding the 2 extra blocks. Do you know how to get options displayed on the block options page? I was thinking it would be a good idea to have an option defining how many items should be shown in the block there.
Comment #4
LukeLast commentedComment #5
LukeLast commentedHere are the updated block functions. This patch basically adds "Most played videos" and "Most downloaded" blocks, as well as adding an option in the block configuration page to set the number of videos to list in each block and allows the customization of the block display title.
Here are the updated functions.
I've tested everything and it's been working nicely. If no one can see any problems i'll commit it to CVS.
Comment #6
LukeLast commentedComment #7
(not verified) commented