BuddyDev

Search

Replies

  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: [Resolved] Buddypress moderation button shortcode #37165

    Gentle reminder sir

  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: Member types pro redirect not working #37022

    I just found out the issue

    1. only first login redirect feature does not work
    2. Buddypress profile completion redirect takes priority over all login redirects. I have tested this with various plugins like
    a. https://wordpress.org/plugins/buddypress-profile-completion/
    b. https://wordpress.org/plugins/peters-login-redirect/
    c. https://wbcomdesigns.com/downloads/buddypress-redirect/

  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: Member types pro redirect not working #37024

    I just found out the issue

    1. Only first login redirect feature does not work
    2. Buddypress profile completion plugin redirect takes priority over all login redirects while using plugin like
    1. https://wordpress.org/plugins/peters-login-redirect/
    2. https://wordpress.org/plugins/bp-redirect-to-profile/
    3. https://wbcomdesigns.com/downloads/buddypress-redirect/

  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: Member types pro redirect not working #37023

    I just found out the issue

    1. Only first login redirect feature does not work
    2. Buddypress profile completion plugin redirect takes priority over all login redirects while using plugin like
    1. https://wordpress.org/plugins/peters-login-redirect/
    2. https://wordpress.org/plugins/bp-redirect-to-profile/
    3. https://wbcomdesigns.com/downloads/buddypress-redirect/

  • Participant
    Level: Guru
    Posts: 886

    Any update on this

  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: [Resolved] Can you help me with this code. #36957

    I did replace the complete function but I made 2 changes. Thank you so much for your patience this is the full code im using which is now working kindly review.

    The two changes are

    (1.) change of admin email to fixed email see below

     $follower_email = 'followers@website.com';
    
    	@wp_mail( $follower_email, $subject, $message, $headers ); 

    (2.) removal of code that prevented articles from being published

    
    function bp_follow_notify_author_followers( $new_status, $old_status, $post ) {
    
    	if ( $new_status === $old_status || 'publish' !== $new_status ) {
    		return;
    	}
    
    	$post = get_post( $post );
    
    	$options             = get_option( 'bp_follow_notify_settings' );
    

    THE FULL CODE NOW IS

    
     function bp_follow_notify_author_followers ( $post ) {
    
    	$options             = get_option( 'bp_follow_notify_settings' );
    	$selected_post_types = empty( $options['bp_follow_notify_post_types'] ) ? array() : $options['bp_follow_notify_post_types'];
    
    	if ( ! in_array( $post->post_type, $selected_post_types ) ) {
    		return;
    	}
    
    	$author_id   = $post->post_author;
    	$author_name = get_the_author_meta( 'display_name', $author_id );
    	$counts      = bp_follow_total_follow_counts( array( 'user_id' => $author_id ) );
    
    	if ( empty( $counts['followers'] ) ) {
    		return;
    	}
    
    	$followers = bp_follow_get_followers( array( 'user_id' => $author_id ) );
    
    	$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
    
    	$subject = '[' . $blog_name . '] New Post From ' . $author_name;
    
    	$message = sprintf( __( '
    				%2$s
    				
    				%3$s
    				
    				Link: %4$s
    				-----------
    				You are receiving this email because you are following %1$s.', 'bp-follow-notify' ),
    		$author_name,
    		$post->post_title,
    		wp_trim_words( $post->post_content ),
    		get_permalink( $post->ID )
    	);
    
    	$notifying_emails = array();
    	foreach ( $followers as $follower ) {
    
    		/* Email Notification */
    
    		$user               = get_user_by( 'id', $follower );
    		$notifying_emails[] = $user->user_email;
    
    		/* BP Notification */
    		if ( bp_is_active( 'notifications' ) ) {
    			bp_notifications_add_notification( array(
    				'user_id'           => $user->ID,
    				'item_id'           => $post->ID,
    				'secondary_item_id' => $author_id,
    				'component_name'    => 'bp_follow_notify',
    				'component_action'  => 'follow_new_post',
    				'date_notified'     => bp_core_current_time(),
    				'is_new'            => 1,
    			) );
    		}
    	}
    
    	$sender_name  = ( ! empty( $options['bp_follow_notify_sender_name'] ) ? $options['bp_follow_notify_sender_name'] : $blog_name );
    	$sender_email = ( ! empty( $options['bp_follow_notify_sender_email'] ) ? $options['bp_follow_notify_sender_email'] : 'no-reply@' . $blog_name );
    
    	$headers = '';
    
    	$headers = "MIME-Version: 1.0" . "\r\n";
    	$headers .= "Content-type: text/html; charset=" . get_bloginfo( 'charset' ) . "" . "\r\n";
    	$headers .= "From: " . $sender_name . " <" . $sender_email . ">" . "\r\n";
    
    	$bcc_emails = join( ',', $notifying_emails );
    
    	$headers .= "Bcc: " . $bcc_emails . "\r\n";
    
    	$follower_email = 'followers@website.com';
    
    	@wp_mail( $follower_email, $subject, $message, $headers );
    } 
    
  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: [Resolved] Can you help me with this code. #36946

    Hello

    I just removed this code I found out it was preventing posts from being published while using this plugin https://www.buddyboss.com/product/buddypress-user-blog/

    When I removed the code the email is now being sent

    I changed only this code

    
     function bp_follow_notify_author_followers( $new_status, $old_status, $post ) {
    
    	if ( $new_status === $old_status || 'publish' !== $new_status ) {
    		return;
    	}
    
    	$post = get_post( $post );
    
    	$options             = get_option( 'bp_follow_notify_settings' ); 
    

    Back to this

    
     function bp_follow_notify_author_followers( $post ) {
    
    	$options             = get_option( 'bp_follow_notify_settings' ); 
    

    Also rather than use admin email, since this exposes site admin to security issues can you change it to the actual follower or recepient email.

    Thanks

  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: [Resolved] Restrict buddypress activity privacy #36944

    Gentle reminder sir

  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: [Resolved] Can you help me with this code. #36939

    Any update sir please not that im not reffering to the screenshot I sent before but now the actual post notification mail itself is not being sent.

    Thanks

    • This reply was modified 3 years, 2 months ago by Tosin.
  • Participant
    Level: Guru
    Posts: 886
    Tosin on in reply to: [Resolved] Can you help me with this code. #36923

    I’ve tested it the post notification mail is no longer being sent. The plugin is not working as no post notification email was received.