Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 6 years ago

#6769 closed enhancement (fixed)

BP Users front.php

Reported by: hnla's profile hnla Owned by: imath's profile imath
Milestone: 2.6 Priority: normal
Severity: normal Version:
Component: Templates Keywords: has-patch commit
Cc:

Description

In the same manner that single Groups can have their home page overloaded by adding a template named 'front' and with the recent improvements made to that capability vis a vis how the menus re-factor themselves to account for Activity no longer being the index/landing page by imath it's time to bring the user account screens into parity with Groups.

I think this is probably quite a sought after requirement as I certainly have had to build site pages that are far more general for users that act as a overview page where our current user screens are a little too specific to a single component.

Whereas this task doesn't propose actually building usable screens but just bolting in the mechanism, I've had a thought of a further step we can take to allow BP community to submit working templates that might be downloaded & dropped in to sites.

Encouraging the community to come up with custom user front templates would be a great way of getting people involved in the project, I envisage something along the lines of a small dedicated repo on bp github where we could curate submissions into a small gallery, freely available for people to use, the authors get to see their work publicly available, & it's not as time consuming as building a full blown plugin.

Curating shouldn't be too arduous, requiring simply running locally and checking that the template met some basic coding standards and didn't do anything silly. Keeping the templates updated would be the responsibility of each author, if not willing or able to the entry would be omitted from moving into a tag branch corresponding to new release version or something along those lines.

Attachments (4)

6769.patch (11.2 KB) - added by imath 9 years ago.
6769.02.patch (11.2 KB) - added by imath 9 years ago.
6769.03.patch (11.7 KB) - added by imath 9 years ago.
6769.04.patch (11.2 KB) - added by imath 9 years ago.

Download all attachments as: .zip

Change History (24)

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


9 years ago

#2 @DJPaul
9 years ago

So you want to add a front.php to the template stack for (all) member component screens?

#3 @hnla
9 years ago

Essentially want parity with the way groups work (along with imaths recent improvements groups received) groups and user account screens ought to work in pretty much same manner.

The other point to this is as I mention above to try and provide an easy means for people to create a more generic landing page, the specific component focussed view we currently work to doesn't really work in the sence that users probably want a more general overview.

#4 @DJPaul
9 years ago

  • Milestone changed from 2.5 to 2.6

#5 @imath
9 years ago

  • Keywords has-patch added

Hello @hnla

This is my suggestion for the custom user front template :)

Here's an example that shows the "member type" front template

https://cldup.com/9HcHj1uwU9.png

6769.patch should preserve existing functionalities (when xProfile or Activity are not active for instance).

@imath
9 years ago

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


9 years ago

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


9 years ago

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


9 years ago

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


9 years ago

#10 @hnla
9 years ago

@imath Running this and it looks solid. Checking a few aspects but think we're good to commit generally.

#11 @hnla
9 years ago

One thing I wonder as I play around is whether we should have the nav item 'Home' always visible but just displaying 'activity loop' if no front.php located and no 'activity' label link changing to adding activity label link and loop when there is a front.php in action.

#12 @imath
9 years ago

@hnla i'm not sure we should change 'Activity' to 'Home' if there's no custom front template. First if we are to do this, we'd also need to change 'Profile' to 'Home' if the activity component is not active.

For 2.6, i suggest we only introduce the custom front page for members and wait to see if users are expecting the nav renaming.

.02.patch is a refreshed version of the initial patch to take in account the latest improvements introduced in the BuddyPress navigation :)

If no objections, i'd like to commit this before next dev-chat.

@imath
9 years ago

#13 @hnla
9 years ago

Commit!

#14 @DJPaul
9 years ago

Will this change add a new template, or just add support loading a new template if one is in a user's theme?

#15 @imath
9 years ago

@DJPaul This change will not add a new template. The user's theme needs to include a members/single/front.php to customize the home page for members.

About backcompat, there's a little change inside the members/single/home.php. If the overridden template has not been updated to take this change in account, the members/single/plugins.php template will be used instead of the expected front.php one.

I think it should be ok, but if we want to make sure even with an outdated members/single/home.php the front.php template is loaded, we could use the bp_members_front_template_backcompat() function i've added to 03.patch.

@imath
9 years ago

#16 @dcavins
9 years ago

This is great! 6769.03 works well for me, though I'm a bit on the fence about adding the extra level of backcompat. (It seems reasonable that if you want this new functionality and have the wherewithal to add specific front templates, you should be able to update home.php)

My only comment:
in bp_displayed_user_front_template_part(), these filter parameters and descriptions seem odd or maybe just incomplete (could we set a name? Or not pass it, since this action should be unique to this use?):

/**
 * Let plugins adding an action to bp_get_template_part get it from here
 *
 * @param string $slug Template part slug requested.
 * @param string $name Template part name requested.
 */
do_action( 'get_template_part_' . $slug, $slug, false );

Great work!

#17 @imath
9 years ago

  • Keywords commit added

Thanks @dcavins :)

In .04.patch i set a name and i remove the extra level of backcompat. I will commit it in a few hours.
Thanks everyone for your feedbacks.

@imath
9 years ago

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


9 years ago

#19 @imath
9 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 10774:

Introduce the support for a custom home page template for single members profiles.

  • Themes can now include a front.php template to customize the home page of members.
  • Introduce a template hierarchy for this template so that it is possible to have different front pages according to the ID, the nicename or the member type of the displayed user.

Props hnla, dcavins, DJPaul, imath.

Fixes #6769

#20 @DJPaul
8 years ago

  • Component changed from Appearance - Template Parts to Templates
Note: See TracTickets for help on using tickets.