Opened 6 years ago
Closed 5 years ago
#7995 closed defect (bug) (fixed)
Misposition of multiple bp_nouveau_after_* actions
Reported by: | mo3aser | Owned by: | imath |
---|---|---|---|
Milestone: | 6.0.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Templates | Keywords: | has-patch |
Cc: |
Description
Hi,
In this template file bp-templates/bp-nouveau/buddypress/activity/index.php
The bp_nouveau_before_activity_directory_content(); is before the
<div class="screen-content">
however the bp_nouveau_after_activity_directory_content(); is inside the .screen-content" just before the </div> closing, sw if want to wrap the .screen-content with a custom markup by hook to bp_before_directory_activity_content and bp_after_directory_activity_content for example
<section class="content-wrapper"> <div class="content-inner"> </div><!-- .content-inner --> </section><!-- .content-wrapper -->
the output will be
<section class="content-wrapper"> <div class="content-inner"> <div class="screen-content"> </div><!-- .content-inner --> </section><!-- .content-wrapper --> </div><!-- // .screen-content -->
This causes a lot of issues with some themes, the same in multiple templates:
bp-templates/bp-nouveau/buddypress/activity/index.php
bp-templates/bp-nouveau/buddypress/blogs/index.php
bp-templates/bp-nouveau/buddypress/groups/index.php
bp-templates/bp-nouveau/buddypress/members/index.php
Best regards
Attachments (1)
Change History (10)
#2
@
6 years ago
- Keywords needs-patch added
Hi @mo3aser & @boonebgorges
First I agree with Boone, the best way to change the markup is to override the template from the theme.
Then, the fact the "after" hook is before the closing tag is not new. If you look at the same templates into BP Legacy, you'll see that for instance the bp_after_directory_activity
is before the closing tag. That's why to avoid backward compatibility issues we simply did the same in BP Nouveau. If you look at the bp_nouveau_after_activity_directory_content()
function it simply wraps the BP Legacy hooks.
However, I agree that is doesn't make a lot of sense and that something needs to be fixed for blogs/index, groups/index, and members/index : the bp_after_directory_{component}_page
shouldn't be fired before the closing div.
Maybe having a new template tag to fix the bp_after_directory_{component}_page
position and to add a new bp_after_directory_activity_page
hook to be consistent across directory page templates would be a good idea.
#3
@
6 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 4.0
In 7995.patch I'm suggesting to introduce a new template tag that wraps these hooks after the directory page (outside of any tag) :
bp_after_directory_members_page
(introduced in 1.5)bp_after_directory_groups_page
(introduced in 1.5)bp_after_directory_blogs_page
(introduced in 2.3)bp_after_directory_activity_page
(to be introduced in 4.0)
On as side note, I was thinking template tags is also a good way to avoid forgetting about some common hooks ;)
#4
@
6 years ago
- Milestone changed from 4.0 to Up Next
Thanks for the patch, @imath. Maybe I'm misreading, but it looks like this patch changes the location of the existing hooks. Is that correct? I thought we'd discussed perhaps adding new hooks instead.
Let's look at this after 4.0.
#5
@
6 years ago
Fine with me @boonebgorges :)
Well it fixes a misposition (comparing to Legacy) for the bp_after_directory_[component]_page
hook of the members, groups and blogs components.
It also adds a new bp_after_directory_activity_page
hook to be consistent with the other components directory pages.
#6
@
5 years ago
- Milestone changed from Up Next to 6.0.0
Move the first tickets to next major release.
Hi @mo3aser - Thanks for the ticket.
What's the use case for wrapping the markup using a hook? It seems to me that the proper way to change the markup is to override the template file in the theme. Are you doing something in a plugin?
I do agree that we ought to have hooks available in parallel places. Having "before" outside of a div and "after" inside of a div doesn't make a lot of sense. I'm unsure whether we can easily change them because of backward compatibility concerns, though - perhaps @imath or @hnla has an opinion about it.