BuddyDev

Search

Replies

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

    Any update sir

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

    First of all I have this code below

    
    
     // filter buddypress profile completion redirect url to a custom page.
    add_filter( 'buddypress_profile_completion_redirect', function ( $redirect_url ) {
    	return get_permalink( 34168 );
    } ); 
    
    

    34168 = complete-profile page

    
    
     function buddydev_skip_redirect_on_non_bp_pages( $skip ) {
        if ( ! is_buddypress() ) {
            $skip = true;
        }
        return $skip;
    }
    add_filter( 'bp_force_profile_completion_skip_check', 'buddydev_skip_redirect_on_non_bp_pages' );  
    
    
    
    
     function buddydev_redirect_to_news_feed() {
    	
    	if ( is_user_logged_in() && is_front_page() ) {
    		bp_core_redirect( bp_get_activity_directory_permalink() );
    		exit( 0 );
    	}
    }
    add_action( 'template_redirect', 'buddydev_redirect_to_news_feed' ); 
    
    

    Now when a new user register

    1. All first login redirects should go to (welcome) page instead of (complete-profile) page. Currently, by default all first logins redirect to (complete-profile) page by BuddyPress Profile Completion plugin.

    2. I want member types pro first login redirect to take priority to (welcome) page over the BuddyPress Profile Completion plugin

    Honestly, I was thinking why you never created an all comprehensive buddypress redirection plugin. The plugin would handle the following settings

    1. First login redirect for new users
    2. Second login redirect for new users
    3. Normal login and logout redirect for all users
    4. Option to select redirect page for logged in users while trying to access the home page (see third code I sent)
    5. Login and Logout redirect options based on member types.
    6. Login and Logout redirect options based on roles.

    Now all your other plugin can work or integrate effectively with this redirect plugin.
    PLUGINS LIKE
    1. Branded login plugin
    2. Member types pro plugin
    3. Profile completion plugin

    What do you think?

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

    Gentle reminder sir

  • Participant
    Level: Guru
    Posts: 910
    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: 910
    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: 910
    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: 910

    Any update on this

  • Participant
    Level: Guru
    Posts: 910
    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: 910
    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: 910
    Tosin on in reply to: [Resolved] Restrict buddypress activity privacy #36944

    Gentle reminder sir