[buddypress-trac] [BuddyPress Trac] #6388: Groups single item home : improve the way we deal with custom front and activity component

buddypress-trac noreply at wordpress.org
Mon Sep 28 18:47:29 UTC 2015


#6388: Groups single item home : improve the way we deal with custom front and
activity component
----------------------------------------------+------------------
 Reporter:  imath                             |       Owner:
     Type:  defect (bug)                      |      Status:  new
 Priority:  normal                            |   Milestone:  2.4
Component:  Component - Groups                |     Version:
 Severity:  normal                            |  Resolution:
 Keywords:  has-patch 2nd-opinion needs-docs  |
----------------------------------------------+------------------

Comment (by imath):

 6388.04.patch is my suggestion to deal with backcompat issue 2 & 3 of my
 previous comment. BTW 3 shouldn't happen if we have a codex page
 explaining the new template hierarchy for groups single item requires the
 template to be up to date :)

 But anyway.. The trick is to add a new argument to an existing hook in
 this case : `bp_before_activity_post_form`. This argument is the
 BuddyPress version when the template has evolved.

 For an outdated template, this version won't be there, so in this case i'm
 using a global to make sure it will still be possible to post activities.
 So this solves case 2.

 This is also solving case 3, even if we have 2 activity page, because both
 are working :) And having 2 activity page will alert the user of the theme
 something is wrong with the theme, as soon as he activate WP_DEBUG as i'm
 using a doing it wrong.

 The risk of this trick is if someone is hooking
 `bp_before_activity_post_form` with a function eg: 'my_hook' and uses this
 function directly passing to it an argument to act differently, then there
 might be a problem.. But this is really an edge case!

 Another option is to add a private action at the top of each template
 looking like this
 `do_action( '_bp_template_activity_post_form_2_4_0' );`

 Then when in an older hook we could check if the template is up to date
 like this :
 $is_uptodate = did_action( '_bp_template_activity_post_form_2_4_0' );

 Another option, it we think people will update their template is to
 postpone this ticket to 2.5 and post on bpdevel and then do nothing for
 backcompat.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6388#comment:13>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list