Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Profile photo of mecanographik
    mecanographik
    Participant

    @mecanographik

    Hi @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;
    	}
    }
    
    Profile photo of mecanographik
    mecanographik
    Participant

    @mecanographik

    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?

    Profile photo of mecanographik
    mecanographik
    Participant

    @mecanographik

    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 😉

    Profile photo of mecanographik
    mecanographik
    Participant

    @mecanographik

    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,

    Profile photo of mecanographik
    mecanographik
    Participant

    @mecanographik

    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/#4es8td00

    Profile photo of mecanographik
    mecanographik
    Participant

    @mecanographik

    Hi,
    How do you call your function ?

Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar