BuddyDev

Search

Replies

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Buddypress Clear Notifications Plugin #52460

    Hello,

    Thank you for posting here. I have checked it with “BuddyPress 12.4.1” and it is working fine so you can use it without any issues. Please give it a try.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Create activity search form #52446

    Hello Sunny,

    Thank you for the acknowledgement. You can use the ‘bp_is_activity_directory’ function to make sure it shows only on the activity directory page. Please give it a try.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Create activity search form #52401

    Hello Sunny,

    Thank you for the acknowledgment. Please place the following code in the “bp-custom.php” file or your active theme “functions.php” file.

    
    add_shortcode( 'bp-activity-search-form', function ( $atts ) {
    
    	if ( ! function_exists( 'bp_get_activity_directory_permalink' ) ) {
    		return '';
    	}
    
    	$atts = shortcode_atts(
    		array(
    			'label'     => __( 'Search Activities', 'bp-custom' ),
    			'btn_label' => __( 'Search', 'bp-custom' ),
    		),
    		$atts
    	);
    
    	ob_start();
    
    	?>
    	<div class="bp-activity-search-form">
    		<?php if ( $atts['label'] ) : ?>
    			<h4><?php echo esc_html( $atts['label'] ); ?></h4>
    		<?php endif; ?>
    		<form action="<?php echo esc_url( bp_get_activity_directory_permalink() ); ?>" method="get">
    			<input type="text" name="s">
    			<input type="submit" class="button" value="<?php echo esc_attr( $atts['btn_label'] ); ?>">
    		</form>
    	</div>
    	<?php
    
    	return ob_get_clean();
    } );
    
    

    Please use the shortcode “[bp-activity-search-form]”. It only works with the activity directory page. Please give it a try and let me know.

    To more info on “bp-custom.php” check here: https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Create activity search form #52358

    Hello Sunnybuddy,

    Thank you for the acknowledgement. As you said you are using the older BuddyPress which is why there is no activity search form in the latest version you can find it on the Activity directory page. But to check whether activity search is supported on your setup just try to add “?s=text-to-search” with the URL on the directory page and check whether it shows results or not. If it shows the expected result you can create a search form using HTML and make it searchable.

    Please give it a try.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    This reply has been marked as private.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    This reply has been marked as private.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Custom cover photo by role #52352

    Hello La,

    Thank you for the acknowledgement. I am glad that I could help.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Custom cover photo by role #52345

    Hello La,

    Thank you for the acknowledgement. I am glad that it worked. Just comment or delete the following code:

    
    else {
    		$settings['default_cover'] = 'http://example.com/cover.jpg';
    	}
    
    

    With this step, no default cover will apply if the user does not have the mentioned role in the conditions.

    Please check.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Create activity search form #52341

    Hello Sunnybuddy,

    Welcome to the BuddyDev forums. Please let me know which theme or BuddyPress template pack you are using so that I can help. Also, let me know if you are using Youzify yes or no.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Custom cover photo by role #52340

    Hello La,

    Thank you for the acknowledgement. Please try the following code:

    
    
    /**
     * Default cover based on role
     *
     * @param array $settings Cover image settings.
     *
     * @return array
     */
    function buddydev_set_custom_default_profile_cover( $settings = array() ) {
    
    	if ( ! bp_is_user() ) {
    		return $settings;
    	}
    
    	$user = get_user_by( 'id', bp_displayed_user_id() );
    
    	if ( ! $user ) {
    		return $settings;
    	}
    
    	if ( in_array( 'administrator', $user->roles, true ) ) {
    		// Users with administrator role.
    		$settings['default_cover'] = 'http://example.com/cover-admin.jpg';
    	} elseif ( in_array( 'editor', $user->roles, true ) ) { //editor
    		// Users with editor role.
    		$settings['default_cover'] = 'http://example.com/cover-editor.jpg';
    	} elseif ( in_array( 'author', $user->roles, true ) ) { //author
    		// Users with author role.
    		$settings['default_cover'] = 'http://example.com/cover-author.jpg';
    	} elseif ( in_array( 'contributor', $user->roles, true ) ) {
    		// Users with contributor role.
    		$settings['default_cover'] = 'http://example.com/cover-contributor.jpg';
    	} elseif ( in_array( 'subscriber', $user->roles, true ) ) {
    		// Users with subscriber role.
    		$settings['default_cover'] = 'http://example.com/cover-subscriber.jpg';
    	} else {
    		$settings['default_cover'] = 'http://example.com/cover.jpg';
    	}
    
    	return $settings;
    }
    add_filter( 'bp_before_members_cover_image_settings_parse_args', 'buddydev_set_custom_default_profile_cover', 40 );
    
    

    Let me know if it helps or not.

    Regards
    Ravi