[buddypress-trac] [BuddyPress Trac] #1269: Create a BP_Loop_Template base class that all template classes can inherit from

buddypress-trac noreply at wordpress.org
Fri Dec 26 22:11:21 UTC 2014


#1269: Create a BP_Loop_Template base class that all template classes can inherit
from
------------------------------------+------------------------------
 Reporter:  rvenable                |       Owner:  johnjamesjacoby
     Type:  enhancement             |      Status:  assigned
 Priority:  normal                  |   Milestone:  2.3
Component:  Theme / Template Parts  |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch               |
------------------------------------+------------------------------
Changes (by imath):

 * keywords:   => has-patch


Comment:

 I've been working on adapting every component's template loops (except for
 the legacy forums one) so that they extend the {{{BP_Template_Loop}}}.

 Unlike the previous patches, this time i'm separating unit tests from the
 patch, because i've used them as a base to check i wasn't breaking
 anything. So you'll find the unit tests in 1269.unittests.patch.

 You'll see in 1269.03.patch that some components use a very specific logic
 for their loops (the group invite one for instance), but the more
 complicated was the xProfile one. Actually {{{BP_XProfile_Data_Template}}}
 is somehow doing 2 loops in one (groups and fields). So i've chosen to
 split them :
 - {{{BP_XProfile_Data_Template}}} is mainly taking care of profile field
 groups
 - a new class {{{BP_XProfile_Fields_Template}}} is looping fields.

 Everything went fine doing the split, but a template issue forced me to
 keep a bunch of "fields" method in {{{BP_XProfile_Data_Template}}} to
 avoid breaking profile loops for BP-Default or standalone BuddyPress
 themes.
 The problem is located in 3 templates :
 - {{{src/bp-templates/bp-legacy/buddypress/members/register.php}}}
 - {{{src/bp-templates/bp-
 legacy/buddypress/members/single/profile/edit.php}}}
 - {{{src/bp-templates/bp-
 legacy/buddypress/members/single/settings/profile.php}}}

 In these templates, the profile loop is not checking if the group has
 fields using {{{bp_profile_group_has_fields()}}}, they directly do a {{{
 while ( bp_profile_fields() ) : bp_the_profile_field(); }}}. So i've
 edited each of these templates adding the 'has_fields' check as i actually
 need it to init the {{{BP_XProfile_Fields_Template}}} class.

 I think it's ready for testing, and i'd love to have your feedbacks.

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


More information about the buddypress-trac mailing list