Opened 12 years ago
Closed 11 years ago
#5029 closed defect (bug) (fixed)
display_comments=none does not work in activity loop
Reported by: | pollyplummer | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.9 | Priority: | low |
Severity: | minor | Version: | 1.7 |
Component: | Activity | Keywords: | |
Cc: |
Description
When customizing the activity loop, there seems to be no change when using display_comments:
<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ).'&display_comments=none' ) ) : ?>
I would assume this would hide the threaded comments. display_comments=threaded works, as does display_comments=stream. The codex says that 'none' is the default, but it seems that 'threaded' is really what is shown by default.
Change History (7)
#2
@
12 years ago
It looks like the codex has been wrong for a long time. The default value of the display_comments
param has been threaded
since r2485. The codex should be updated to reflect the fact that threaded
is the correct default value.
FWIW, the default value of display_comments
in bp_activity_get()
is false
. Maybe that's where the confusion originally came from.
I do see that there is some funny business with strict type checking and the display_comments
parameter in BP_Activity_Activity::get()
, which may make it impossible to actually turn off comments. I'm going to write a couple unit tests and report back.
#3
@
12 years ago
@Boone I did update the codex as it could be a potential time waste and frustration for people.
Passing '0' does kill the comments , I originally thought because 0 as a string or int is essentially bool false but now not sure I'm not simply passing a value unrecognised so it's returning nothing.
I missed bp_activity_get() which is why I struggled to understand bp_has_activities() clearly which does become quite difficult to follow the flow of the passed params/args
Also I can definitely directly edit:
$template_args = array { 'display_comments' => false, //$display_comments, )
and remove the comments from the activity display.
#5
@
12 years ago
- Milestone changed from Awaiting Review to 1.8
- Priority changed from normal to low
- Severity changed from normal to minor
hnla - Yes, I've found the same thing. It's possible to exclude comments like this:
if ( bp_has_activities( array( 'display_comments' => false, ) ) )
But not using any querystring format, and not using the 'none' keyword, and not passing a 0.
At least some of these issue should be fixed at some point, but there are complications. I can't simply cast things to boolean, because of r3985, which I don't totally understand but would probably be broken by messing with the strict type check.
I've run out of time to look at this at the moment, so I'm going to move it to 1.8 and hopefully look at it in more detail in the upcoming days. Though, it's definitely not a regression, so it may get bumped.
I have just run through bp_has_activities() for Sarah to see what was what.
Firstly Codex entry is now inaccurate stating two things:
Function sets :
and requires bool false to hide display ' false for none, stream/threaded - show comments in the stream'
I checked and passing a string equiv to 'display_comments=0' works to hide as as far as I remember passing zero as a string or otherwise is technically bool false.
I'll add an update to the codex page to reflect this while leaving older entries in place but we may need to consider if passing string '0' is actually valid even if does seem to work - I'm not sure on that aspect.