Skip to:
Content

Opened 6 weeks ago

Last modified 5 weeks ago

#7503 new defect (bug)

Add identifying tag parameter to bp_has_*() loop arguments.

Reported by: dcavins Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

When filtering arguments via hooks like bp_after_has_groups_parse_args, knowing more about the loop's context would help determine whether filters should be applied and how. At the moment, you can look at the incoming arguments and make a guess, but it would be easier to target the loop in the group widget, for instance, and not the main groups directory loop on the same page, if the widget's parameters included 'context' => 'widget' or similar.

These loops are good candidates for this additional parameter:

  • bp_has_activities()
  • bp_has_blogs()
  • bp_has_groups()
  • bp_has_members()
  • bp_has_message_threads()
  • bp_has_notifications()
  • bp_has_profile()

The function bp_has_activities() is used in a number of ways within BP:

  • bp_activity_embed_has_activity() to embed activity items
  • bp_activity_heartbeat_last_recorded() to return new activity items
  • RSS feed output
  • Recent posts widget
  • activity-loop.php (template used in a number of contexts)
  • Activity single item display

@jjj notes that bbPress does something similar in bbp_set_query_name(): https://bbpress.trac.wordpress.org/browser/tags/2.5.12/includes/common/template.php#L2011

This is not a technically difficult change to make, but we should decide what we want to call the parameter and what pattern should be used for the names. We could use names patterned like OOCSS, for example:
'loop_name' => 'directory--main'

Thanks for your thoughts about how to make this small change as useful as possible.

Change History (2)

This ticket was mentioned in Slack in #buddypress by hnla. View the logs.


6 weeks ago

#2 @hnla
5 weeks ago

Personally not a fan of BEM, OOCSS is something that really is common sense that many devs have practised for years without having to give it a name ( a series of elements requiring same styles would have the common styles described in a grouped selector sense or set as a class that could be applied to elements as needed)

As we haven't adopted a BEM methodology to our markup in the past or in current endeavours not sure we should have an odd example spring up, I would plump for a traditional 'directory-main'.

Note: See TracTickets for help on using tickets.