BuddyDev

Search

Replies

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

    Hello Lefteris,

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

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Top Rated Media not correct #38617

    Hello Gav,

    Thank you for the acknowledgment. The current version of the plugin schema does not allow us to show the Top Rated gallery. In a future update, We will consider this.

    Regards
    Ravi

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

    Hello Daniel,

    Thank you for the details.

    1. There is no direct way to implement this with the BuddyBoss Platform. Please contact BuddyBoss they can better guide you with this.

    2. Use the following code:

    
    add_action( 'bp_activity_add_user_favorite', 'bpdev_track_user_favorite', 10, 2 );
    function bpdev_track_user_favorite( $activity_id, $user_id ) {
    	bp_activity_add_meta( $activity_id, 'favorited_by_user', $user_id );
    }
    
    add_action( 'bp_activity_remove_user_favorite', 'bpdev_track_user_unfavorite', 10, 2 );
    function bpdev_track_user_unfavorite( $activity_id, $user_id ) {
    	bp_activity_delete_meta( $activity_id, 'favorited_by_user', $user_id );
    }
    
    //show faces, yay!
    add_action( 'bp_activity_entry_content', 'bpdev_show_who_favorited_activities' );
    function bpdev_show_who_favorited_activities() {
    	$output          = '';
    	$favorited_users = bp_activity_get_meta( bp_get_activity_id(), 'favorited_by_user', false );
    
    	if ( ! empty( $favorited_users ) ) {
    		foreach ( (array) $favorited_users as $user_id ) {
    			$user_domain = bp_core_get_user_domain( $user_id );
    
    			$avatar = bp_core_fetch_avatar(
    				array(
    					'type'    => 'thumb',
    					'height'  => 25,
    					'width'   => 25,
    					'item_id' => $user_id
    				)
    			);
    
    			$output .= sprintf( '<a href="%s">%s</a>', $user_domain, $avatar );
    		}
    	}
    
    	if ( $output ) {
    		echo "<div class='clearfix activity-favorited-by'>{$output}</div>";
    	}
    }
    
    

    Please do let me know if it works or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Top Rated Media not correct #38597

    Hello Gav,

    Thank you for the details. I have added support for showing Top Rated media by total rating count. Please upgrade to latest version and check.

    https://buddydev.com/plugins/mediapress-media-rating/

    Regards
    Ravi

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

    Hello Daniel,

    Thank you for posting.

    1. Are you using BuddyPress Or BuddyBoss Platform.
    2. Can you link me to the post where we share the code snippet so that I can help you?.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Top Rated Media not correct #38574

    Hello Gav,

    Thank you for posting. Please look at the following resource showing how we calculating top rated medias

    https://github.com/mediapress/mpp-media-rating/blob/master/core/mpp-rating-functions.php#L184

    We just made a query with avg function to calculate the average rating for individual media.

    Do you want to list media order by no. of users rated?. Please let me know.

    Regards
    Ravi

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

    Hello Gav,

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

    Regards
    Ravi

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

    Hello Tom,

    Thank you for posing. Currently, Gallery shortcode is not supported hiding empty gallery feature. But you can use the following code in Active Child Theme “functions.php” or “bp-cutom.php” file:

    
    add_filter( 'mpp_shortcode_list_gallery_query_args', function ( $args ) {
    
    	$meta_query = array(
    		array(
    			'key'     => '_mpp_media_count',
    			'value'   => 1,
    			'compare' => '>=',
    		),
    	);
    
    	if ( isset( $args['meta_key'] ) ) {
    		$meta_query[] = array( 'key' => $args['meta_key'] );
    
    		unset( $args['meta_key'] );
    	}
    
    	$args['meta_query'] = $meta_query;
    
    	return $args;
    } );
    
    

    It will hide all empty galleries listed using gallery shortcode. Please give it a try and let me know if it works or not.

    Regards
    Ravi

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

    Hello Lefteris,

    Instead of ‘date_recorded < current_date – interval 2 month’ use this ‘date_recorded > current_date – interval 60 day’. Give it a show this way and let me know if it works or not.

    Regards
    Ravi

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

    Hello Lefteris,

    Thank you for your acknowledgment of the action. Instead of “bp_message_notice_text($notice)” you can use “$subject” for notice subject and “$message” for notice message passed as a parameter in the callback function. Please give it a shot this way. Please let me know if it works or not. If still faces the issue please share code on https://pastebin.com/ so that I can help.

    Regards
    Ravi

    • This reply was modified 4 years, 3 months ago by Ravi.