Opened 10 years ago
Closed 7 years ago
#6030 closed enhancement (maybelater)
Ability to redefine bp_core_render_message()
Reported by: | slaFFik | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | needs-refresh, trac-tidy-2018 |
Cc: | slaFFik, georgemamadashvili@… |
Description
I would like to use bootstrap alerts there, so I will prepare a patch a bit later, that will give ability to redefine the alert.
if ( ! defined('bp_core_render_message') ) { function bp_core_render_message() { // current function code here } }
Attachments (1)
Change History (16)
#2
@
10 years ago
- Keywords dev-feedback added
There could be a filter, for tag, class and id. Content and other logic is ok, as for me, but that hard coded html should be changeable. IMO it's a bad idea to parse all that and replace before echoing.
Something like this:
<<?php echo $html['tag']; ?> id="<?php echo $html['id']; ?>" class="<?php echo $html['class']; ?> <?php echo esc_attr( $type ); ?>"> <?php echo $content; ?> </<?php echo $html['tag']; ?>>
What do you think?
#3
@
10 years ago
- Keywords needs-patch added; dev-feedback removed
There could be a filter, for tag, class and id. Content and other logic is ok, as for me, but that hard coded html should be changeable. IMO it's a bad idea to parse all that and replace before echoing.
Sure, something like this sounds good to me.
#7
@
10 years ago
- Cc georgemamadashvili@… added
@boonebgorges @slaFFik I would mark this one as 'wontfix'. bp_core_render_message()
is called via template_notices
hook. It should be pretty easy to remove action and re-add your custom one.
#8
@
10 years ago
- Keywords has-patch added; needs-patch removed
On one hand, I agree with Mamaduka, as it can be done using this kind of code :
https://gist.github.com/imath/8afc70a43318d306c711
On the other hand, using 6030.patch (for instance) we get the same result with less lines of codes for the plugin developer. e.g. :
function slaffik_template_notice_args( $args ) { $args['class'] = 'slaffik-notice'; return $args; } add_filter( 'bp_before_core_template_notice_parse_args', 'slaffik_template_notice_args', 10, 1 );
#10
@
10 years ago
I'd like to see as many of these pieces turned into template parts as possible, so they can be overridden from a child theme or template pack, in addition to having filters in place to allow overriding any automatically calculated attributes.
Some kind of BP_User_Feedback
class to extend off of WP_Error
would be helpful here, also. The ability to assign codes, id's, types, and succes/fail would be hugely helpful.
I agree we can likely make tiny improvements, but don't be afraid to think bigger.
#14
@
7 years ago
- Keywords trac-tidy-2018 added
We're closing this ticket because it has not received any contribution or comments for at least two years. We have decided that it is better to close tickets that are good ideas, which have not gotten (or are unlikely to get) contributions, rather than keep things open indefinitely. This will help us share a more realistic roadmap for BuddyPress with you.
Everyone very much appreciates the time and effort that you spent sharing your idea with us. On behalf of the entire BuddyPress team, thank you.
If you feel strongly that this enhancement should still be added to BuddyPress, and you are able to contribute effort towards it, we encourage you to re-open the ticket, or start a discussion about it in our Slack channel. Please consider that time has proven that good ideas without contributions do not get built.
For more information, see https://bpdevel.wordpress.com/2018/01/21/our-awaiting-contributions-milestone-contains/
or find us on Slack, in the #buddypress channel: https://make.wordpress.org/chat/
We don't use pluggable functions in BuddyPress (and don't introduce new ones in WordPress) because of a fatal flaw: they can only be redefined once. If more than one plugin/theme attempts to define a function, it creates race conditions.
How about a filter that will allow you to bail out of the function early on? Or perhaps we could assemble the markup without echoing it and run it through a filter before echoing?