Forum Replies Created
-
Hi @shanebp
Thanks for your recommandations, you’re right.
I’ve made it working by putting my snippet in bp-custom.php like this:/** * Buddypress template stack adaptation for Blade Sage.io templating * @link * example @link http://www.generalthreat.com/2013/08/grappling-with-bp-theme-compatibility/ * * initial one was : * /app/public/app/themes/sage/resources/buddypress */ // will return something like '/app/public/app/themes/sage/resources/views'; function md_bp_blade_register_template_location() { // return STYLESHEETPATH . '/views/buddypress/'; return TEMPLATEPATH . '/views'; } // replace bp template parts syntaxe with the template overload from sage Blade types // see: http://hookr.io/functions/bp_get_template_part/ function md_blade_replace_template( $templates, $slug, $name ) { // Overload the bp template $templates = array(); // empty it if ( isset( $name ) ) { $templates[] = $slug . '-' . $name . '.blade.php'; } else { $templates[] = $slug . '.blade.php'; } //print_r($templates); return $templates; } add_action( 'bp_init', function () { //error_log("bp init loaded"); // custom url stacks for blade '/views' folder // working but Blade Syntax is not interpreted ... if( function_exists( 'bp_register_template_stack' ) ) { bp_register_template_stack( 'md_bp_blade_register_template_location', 1 ); } // we also have to filter the render file extension (.blade.php) // for Buddypress components tpl parts add_filter( 'bp_get_template_part', 'md_blade_replace_template', 10, 3 ); // http://buddypress.wp-a2z.org/oik_api/bp_locate_template/ //add_action( 'bp_locate_template', 'md_blade_locate_template', 1, 6); });
But this technique doesn’t work with bp ajax for example when bp groups loop is reloaded with ajax
I’m sure there is something to do with bp_locate_template() or bp_locate_template_and_load()
to inject correctly my buddypress templates in the_content from mytheme/resources/views/buddypress (instead of mytheme/resources/buddypress/)By the way i’m using the Sage starter theme https://roots.io/sage/
Any idea?
Hi
i can’t post my snippet on this forum … weird
here is my gist :
https://gist.github.com/mecanographik/156306079ed8c86e58ec9ef0472a31d6Hi @snd26,
Thanks for sharing.Here is more universal version of your function i use now on a project in a addition with a group meta filter during bp ajax groups loop :
function custom_is_page($slug) { $statement = false; if ( is_page( $slug ) ) { $statement = true; } elseif ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { $referer_page_id = url_to_postid( wp_get_referer() ); $referer_page = get_post( $referer_page_id ); if ( $referer_page instanceof WP_Post && $slug === $referer_page->post_name ) { $statement = true; } } return $statement; }
I use it in this function :
add_action('bp_before_groups_loop', 'custom_groups_loop_meta_filter'); function custom_groups_loop_meta_filter($meta_filter) { if(custom_is_page('groups-movies')) { $meta_filter = new BP_Groups_Meta_Filter( 'group_type', 'movies' ); return $meta_filter; } }
Note about the previous snippet :
If html still doesn’t work, just add this second (and complementary) function in functions.php :/* * Force HTML content type format for wp_mail */ function set_content_type( $content_type ){ if( empty($content_type) OR $content_type == 'text/plain' ) { $content_type = 'text/html'; } return $content_type; } add_filter( 'wp_mail_content_type', 'set_content_type', 1 );
Did it help you?
Hi, i’ve a working solution for those like me who did not receive any buddypress email with html format (because there was a 3rd party plugin which was redeclaring wp_mail for eg.), here is the code to put in your functions.php file in your theme :
/** * Provide an HTML template for all your BuddyPress emails * BuddyPress 2.5 introduced a new stylised HTML email system. * By default the HTML system doesn't work if a 3rd party transactional email plugin is active * (e.g. wpMandrill or SendGrid), and reverts to sending plain text emails. * * This function allows the stylised BuddyPress HTML emails to be sent using some 3rd party plugin. * It does this by sending the email through wp_mail() rather than directly with PHPMailer. * * @author Mecanographik * * inspiration : * @link https://github.com/21applications/bp-wpmandrill * */ add_action( 'init', 'my_prefix_bp_wp_mail_html_filters' ); function my_prefix_bp_wp_mail_html_filters() { add_filter( 'bp_email_use_wp_mail', function( $bool ) { return false; }, 10, 1 ); }
hope this helps 😉
Hi, You can check what we’ve done for the French Buddypress community with @imath here :
Check my profile for example :
http://bp-fr.net/membres/mecanographik/regards,
Maybe it’ll still interesting you to know that YOU CAN DO THAT.
Don’t use the wp’s constant, just edit your functions.php file and your .htacess file :
here is the code, it works for me !
http://chopapp.com/#4es8td00Hi,
How do you call your function ?