BuddyDev

Search

Replies

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Can you help me with this code. #36839

    Hello Kumar,

    Thank you for the acknowledgment. Please have a look here.

    https://developer.wordpress.org/reference/functions/wp_mail/#using-headers-to-set-from-cc-and-bcc-parameters

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Waseem,

    Sorry for the inconvenience. Please do let me know where are you facing this issue i.e. Normal WordPress Registration Page, BuddyPress Registration, WordPress Admin New User screen. Please do let me know as this plugin user ajax for checking the existence. Please make sure the ajax call running. You can check this through Google Chrome Developer Tools. You can access this using F12 under the Network tab.

    Regards
    Ravi

    • This reply was modified 4 years, 5 months ago by Ravi.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Cannot modify header information #36834

    Hello Luca,

    Sorry for the inconvenience. Please try after deactivating other plugins except BuddyPress and switch to default WordPress theme temporarily. Then give it a shot. Is the warning still showing or not. Also please do let me know which theme and plugin you are using is it BuddyPress or BuddyBoss Plateform.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Restrict buddypress activity privacy #36832

    Hello Tosin,

    Thank you for the suggestion. I will look into it and will update you.

    Regards
    Ravi

    • This reply was modified 4 years, 5 months ago by Ravi.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Can you help me with this code. #36791

    Hello Tosin,

    Try the follow code.

    
    
    /*  Add settings page to WP Admin */
    add_action( 'admin_menu', 'bp_follow_notify_add_admin_menu' );
    add_action( 'admin_init', 'bp_follow_notify_settings_init' );
    function bp_follow_notify_add_admin_menu(  ) {
    	add_options_page(
    		'Buddypress Followers Notify',
    		'Buddypress Folllowers Notify',
    		'manage_options',
    		'buddypress_folllowers_notify',
    		'bp_follow_notify_options_page'
    	);
    }
    function bp_follow_notify_settings_init(  ) {
    	register_setting( 'pluginPage', 'bp_follow_notify_settings' );
    
    	add_settings_section(
    		'bp_follow_notify_pluginPage_section',
    		__( '', 'bp_follow_notify' ),
    		'bp_follow_notify_settings_section_callback',
    		'pluginPage'
    	);
    
    	add_settings_field(
    		'bp_follow_notify_sender_name',
    		__( 'Sender Name', 'bp_follow_notify' ),
    		'bp_follow_notify_sender_name_render',
    		'pluginPage',
    		'bp_follow_notify_pluginPage_section'
    	);
    	add_settings_field(
    		'bp_follow_notify_sender_email',
    		__( 'Sender Email', 'bp_follow_notify' ),
    		'bp_follow_notify_sender_email_render',
    		'pluginPage',
    		'bp_follow_notify_pluginPage_section'
    	);
    
    	add_settings_field(
    		'bp_follow_notify_post_types',
    		__( 'Post Types', 'bp_follow_notify' ),
    		'bp_follow_notify_post_types_render',
    		'pluginPage',
    		'bp_follow_notify_pluginPage_section'
    	);
    }
    function bp_follow_notify_sender_name_render() {
    	$options = get_option( 'bp_follow_notify_settings', array() );
    	$sender_name = empty( $options['bp_follow_notify_sender_name_render'] ) ? '' : $options['bp_follow_notify_sender_name_render'];
    	?>
    	<input type='text' name='bp_follow_notify_settings[bp_follow_notify_sender_name_render]' value='<?php echo $sender_name; ?>'>
    	<?php
    }
    function bp_follow_notify_sender_email_render(  ) {
    	$options = get_option( 'bp_follow_notify_settings', array() );
    	$sender_email = empty( $options['bp_follow_notify_sender_email'] ) ? '' : $options['bp_follow_notify_sender_email'];
    	?>
    	<input type='text' name='bp_follow_notify_settings[bp_follow_notify_sender_email]' value='<?php echo $sender_email; ?>'>
    	<?php
    }
    function bp_follow_notify_post_types_render(  ) {
    	$options = get_option( 'bp_follow_notify_settings', array() );
    
    	$selected_post_types = empty( $options['bp_follow_notify_post_types'] ) ? array() : $options['bp_follow_notify_post_types'];
    
    	$args = array( 'public' => true );
    	$post_types = get_post_types( $args );
    	?>
    	<select name='bp_follow_notify_settings[bp_follow_notify_post_types][]' multiple='multiple'>
    		<?php foreach ( $post_types as $post_type ) : ?>
    			<option value='<?php echo $post_type; ?>' <?php selected( in_array( $post_type, $selected_post_types ) ); ?>><?php echo $post_type; ?></option>
    		<?php endforeach; ?>
    	</select>
    
    	<?php
    }
    function bp_follow_notify_settings_section_callback(  ) {
    	echo __( 'Notify', 'bp_follow_notify' );
    }
    function bp_follow_notify_options_page(  ) {
    	?>
    	<form action='options.php' method='post'>
    
    		<h2>Buddypress Folllowers Notify</h2>
    
    		<?php
    		settings_fields( 'pluginPage' );
    		do_settings_sections( 'pluginPage' );
    		submit_button();
    		?>
    
    	</form>
    	<?php
    }
    add_action( 'new_to_publish', 'bp_follow_notify_author_followers', 99, 1 );
    add_action( 'draft_to_publish', 'bp_follow_notify_author_followers', 99, 1 );
    
    /**
     * @param WP_Post $post Post object.
     */
    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 ( $counts['followers'] > 0 ) {
    
    		$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_email = array();
    		foreach($followers as $follower){
    
    			/* Email Notification */
    
    			$user = get_user_by( 'id' , $follower );
    			$notifying_email[] = $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,
    				) );
    
    			}
    		} //end loop
    
    		$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";
    
    		@wp_mail( $notifying_email, $subject , $message, $headers );
    	}
    
    }
    /*  Register component */
    function bp_follow_notify_filter_notifications_get_registered_components( $component_names = array() ) {
    	// Force $component_names to be an array
    	if ( ! is_array( $component_names ) ) {
    		$component_names = array();
    	}
    
    	array_push( $component_names, 'bp_follow_notify' );
    
    	return $component_names;
    }
    add_filter( 'bp_notifications_get_registered_components', 'bp_follow_notify_filter_notifications_get_registered_components' );
    /* Format screen notfications */
    add_filter( 'bp_notifications_get_notifications_for_user', 'bp_follow_notify_format_notifications', 9, 5  );
    function bp_follow_notify_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    
    	if ( 'follow_new_post' === $action ) {
    
    		if ( (int) $total_items > 1 ) {
    			$title = sprintf( __( '%d new posts have been published', 'bp-follow-notify' ), (int) $total_items );
    			$link  = bp_get_notifications_permalink();
    		} else {
    			$title = sprintf( __( '%s has published a new post.', 'bp-follow-notify' ), bp_core_get_user_displayname( $secondary_item_id ) );
    			$link = get_permalink( $item_id );
    		}
    
    		// WordPress Toolbar
    		if ( 'string' === $format ) {
    			$return = apply_filters( 'bp_follow_notify_notification', '<a href="' . esc_url( $link ) . '" title="' . esc_attr( title ) . '">' . esc_html( $title ) . '</a>', $title, $link );
    			// Deprecated BuddyBar
    		} else {
    			$return = apply_filters( 'bp_follow_notify_notification', array(
    				'text' => $title,
    				'link' => $link
    			), $link, (int) $total_items, $title, $title );
    		}
    
    		return $return;
    
    	}
    
    	return $action;
    }
    
    

    Please do let me know if it works or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: How to bulk-assign member badges #36790

    Hello Kristy,

    Thank you for the question. Yes, You can add badges to member types or roles then you can assign them.
    Please do let me know if it helps or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Brian,

    Sorry for the inconvenience. Have you able to see other fields. If yes, Is there any member type associated with members and These custom fields available to those member types.

    Check the following link for fields associated with member types.

    https://tinyurl.com/yzjy78kb

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello,

    Please upgrade your plugin to the latest version. I have added support for displaying badges on a single topic screen.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello,

    I have tested this on my server and it seems to work fine. Please take a look at the following screenshot.

    https://tinyurl.com/y98uxwu7

    Please share your screenshots.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello,

    Thank you for posting. I am unable to see any direct solution to skip single group activity on the Activity directory page right now.

    Regards
    Ravi