Closed (won't fix)
Project:
Activity
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2010 at 19:58 UTC
Updated:
11 Sep 2010 at 21:48 UTC
Hi,
My activity all block is set to show 10 items. Most of the time it does just that. Occasionally, the 'more' link stops showing up. And also, on occasion, the block displays less than 10 items. Or both...
I can't find anything in the code that would be causing this.
There are several hundred activity items in the system, so that's obviously not the problem. Is it time-based?
Comments
Comment #1
mstef commented...........................?
Comment #2
Scott Reynolds commentedi would bet on node_access causing troubles here.
Comment #3
OfficeMedium commented(edit out)
Comment #4
mstef commentedNo, it's not. I'm using UID 1.
The problem seems to be activity_get_activity().
I have about 400 activity items. The block # is set to 10. activity_block() asks activity_get_activity() for 11 items, and it returns 8 items...
The function is a bit confusing so I'm having trouble finding out why it's doing that...
Also having trouble finding out why this only happens when it decides to happen..
Comment #5
mstef commentedWell, I just commented out the db_rewrite_sql() which, according to the documentation, says it allows other modules to impose access restrictions on activity listings.
But why, as uid 1, that would cause problems?
But ah, removing that causes a lot of problems...perhaps i need to just use a regular DB query..
?????
Query: SELECT activity.*, activity_targets.target_uid, activity_targets.target_role FROM {activity_targets} activity_targets INNER JOIN {activity} activity ON activity.aid = activity_targets.aid WHERE activity_targets.target_uid = %d ORDER BY activity.created DESC ORDER BY activity.created DESC;
Comment #6
mstef commentedIt's not just the "All" block either...
so..
no one happened to notice this?
Comment #7
mstef commentedcommenting out activity_invoke_activityapi($row, 'load'); restores the correct amount of items..
now I'm not sure what that function does exactly or why it would cause items to stop showing...i have to guess some other module is telling the rows not to show, but why?
Comment #8
Scott Reynolds commentedEchoing my first comment
Comment #9
mstef commentedEchoing comment #4...
I'm logged in as UID 0 (aka, admin)
Node access restrictions don't exist.
Comment #10
Scott Reynolds commentedUid 0 IS NOT admin. Its ANON. From your comment #4 Uid 1 is admin.
Comment #11
mstef commentedyea i meant 1...oops...
still though...
Comment #12
mstef commentedAND...say it was an access permission (which it can't be)...i have about 300 activity items..it should return enough to fill the 10 mark..
but as I'm realizing, this coding was done very foolishly because only 11 items are sent to activity_get_activity()...there's no fall back if items aren't allowed to be shown...
oops?
Comment #13
mstef commentedTwo more reasons why you're wrong...
All of the hundreds of items show up on the page view (strange)
Right now, only 9 items are showing on the block...the 10th item is a logged in/logged out item...not even a node#
Comment #14
mstef commentedA problem this big, no one notices it or tries to find a solution?
Comment #15
sirkitree commentedBeing insulting and seemingly ungrateful for free time spent on things is not the best way to get help with something mike
Comment #16
mstef commentedinsulting, ungrateful?
Comment #17
mstef commentedjust a bit shocked how such a big flaw (perhaps 2 flaws) could go unnoticed for almost a year now
Comment #18
Scott Reynolds commentedStop it Mike you know better. In a private mail to me you apologized for being a bit 'round in the issue thread'. Don't act surprised when someone calls you on it.
Comment #19
mstef commentedI was rude. I didn't insult any one. And I don't know where ungrateful came from...
Regardless, any one look into this issue?
Comment #20
mstef commentedAlright, I don't think the node permissions are causing the problems any more. The real problem, like I said, is that the block gives activity_get_activity() a certain amount of items it wants, for example 11. The function fetches 11 items, but if a few aren't able to be viewed because of access restrictions, less items are returned - and no 'more' link (which is very bad).
I added a few small lines to the function to fix this - the best solution I can think of now. There is an additional perimeter added ($block). I suggest when adjust activity_block() [case: 'all'] to add $block = TRUE. What it does it simple. It fetches 3x the amount of items requested, and iterates items until the $limit is reached (so the true remaining amount is returned).
Comment #21
sirkitree commentedclosing. 1.x no longer supported.