BuddyDev

Search

Replies

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2985
    Ravi on in reply to: [Resolved] Adding menu items #3766

    Hi Phill,

    I have tried to fix problem by adding a new menu to Buddypress profile page that render shortcode content. Please try it in your bp-custom.php file and let me know if it works or not.

    
    function buddydev_modify_user_profile_tab() {
    
    	$bp = buddypress();
    	
    	$user_url = bp_loggedin_user_domain();
    	// add 'Change profile picture' sub-menu tab
    	bp_core_new_subnav_item( array(
    			'name'		=> 'Community', //replace with your name
    			'slug'		=> 'community', // slug must be unique
    			'parent_url'	=> trailingslashit( $user_url . $bp->profile->slug ),
    			'parent_slug'	=> $bp->profile->slug,
    			'screen_function'	=> 'buddydev_screen_profile_community',
    			'position'          => 30,
    			'user_has_access'   => bp_is_my_profile()
    		)
    	);
    
    }
    add_action( 'bp_setup_nav', 'buddydev_modify_user_profile_tab', 100 );
    
    function buddydev_screen_profile_community() {
    
    	add_action( 'bp_template_content', 'buddydev_load_content' );
    
    	bp_core_load_template( 'members/single/settings/general' );
    }
    
    function buddydev_load_content() {
    
    	echo do_shortcode( '[mpp-show-gallery id=303]' ); // replace by Your shortcode
    }
    
    

    Thank You
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2985
    Ravi on in reply to: [Resolved] Adding menu items #3763

    Hi Phill

    Thank you for posting. You can refer the following URL to create a new nav item for BuddyPress Profile Tab.

    https://buddydev.com/support/forums/topic/move-subnav-tabs/#post-3296

    Thank You
    Ravi

    • This reply was modified 8 years ago by Ravi.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2985
    Ravi on in reply to: [Resolved] Simple Front End Posts #3738

    Hi Glenn,
    I am sorry but I am unable to understand your details.

    Can you please provide more details to allow me understand what are you trying to accomplish here?

    Thank You
    Ravi

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

    Hi Alayna,

    There are multiple issues.

    1. On SiteWide activity BuddyPress uses WordPress heartbeat API to get latest activities but in case of user activity there is no such functionality going on. There is no filter to allow us enabling it
    2. At the moment, FB Like activity does not support “since” parameter for fetching new activities, so even if we recreate the heartbeat step, this plugin will need to be updated.

    It will take us atleast 2-3 days to update it.

    Thank You
    Ravi

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

    Hi Alayna,

    You can do something like this.

    
      jQuery(document).on( 'bpln:new_notifications', function( event, res ){
    
            // pass count selector here
            jQuery('#count').text(res.count); //to show no. of count
            // pass message selector here
            jQuery('#message').html(res.messages);
            //alert(res.count);
        });
    
    

    Thank You
    Ravi

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

    Hi Alayna,

    Please refer the following url as I have bind a callback function to this event here

    https://github.com/buddydev/bp-live-notification-tone/blob/master/assets/js/bp-live-notification-tone.js#L11

    Thank You
    Ravi

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

    Hi Alayna,

    Thank You for confirming.

    Thank You
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2985
    Ravi on in reply to: Edit Blog Post layout #3693

    Hello Brendan,

    It should be in “wp-content/plugins/” directory. If it is not present create one. You can refer following url

    https://buddydev.com/docs/guides/guides/buddypress-guides/what-is-bp-custom-php/

    Thank You
    Ravi

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

    Hi Alayna,

    Thank you for posting. Please use the following code in your bp-custom.php and let me know if it works or not

    
    
    function buddydev_exclude_users( $args ) {
    	//do not exclude in admin
    	if( is_admin() && ! defined( 'DOING_AJAX' ) ) {
    		return $args;
    	}
    
    	$excluded = isset( $args['exclude'] )? $args['exclude'] : array();
    
    	if( !is_array( $excluded ) ) {
    		$excluded = explode(',', $excluded );
    	}
    
    	$user_ids = array( bp_loggedin_user_id() ); //user ids
    
    	$excluded = array_merge( $excluded, $user_ids );
    
    	$args['exclude'] = $excluded;
    
    	return $args;
    }
    add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users' );
    
    

    Thank You
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2985
    Ravi on in reply to: Edit Blog Post layout #3681

    Hi Brendan,

    Brajesh Sir is away so I am posting here. Please use the following code in your bp-custom.php file
    and let me know if it works or not.

    
    function buddydev_filter_buddyblog_settings( $settings ) {
    
        if ( ! is_user_logged_in() ) {
            return $settings;
        }
    
        // Get the current user in the admin
        $user = new WP_User( get_current_user_id() );
    
        // Get the user role
        $user_cap = $user->roles;
    
        // Get the user login name/ID
        if ( function_exists( 'get_users' ) )
            $user_login = $user->user_nicename;
        elseif ( function_exists( 'get_users_of_blog' ) )
            $user_login = $user->ID;
    
        $defaults = array( 'RestrictCategoriesDefault' );
        // Get selected categories for Roles
        $settings = get_option( 'RestrictCats_options' );
    
        // Get selected categories for Users
        $settings_user = get_option( 'RestrictCats_user_options' );
    
        $user_key = $user_login . '_user_cats';
    
        $term_ids = [];
    
        if ( is_array( $settings_user ) && array_key_exists( $user_key, $settings_user ) && count( $settings_user[ $user_key ] ) > 1 ) {
    
            $settings_user[ $user_key ] = array_values( array_diff( $settings_user[ $user_key ], $defaults ) );
            $user_terms = $settings_user[ $user_key ];
    
            foreach ( $user_terms as $term ) {
                $term_ids[] = get_term_by( 'slug', $term, 'category')->term_id;
            }
    
        } else{
    
            foreach ( $user_cap as $key ) {
    
                if ( is_array( $settings ) && !empty( $settings[ $key . '_cats' ] ) ) {
    
                    $settings[ $key . '_cats' ] = array_values( array_diff( $settings[ $key . '_cats' ], $defaults ) );
                    
                    foreach ( $settings[ $key . '_cats' ] as $category ) {
    
                        $term_ids[] = get_term_by( 'slug', $category, 'category' )->term_id;
    
                    }
    
                }
    
            }
    
        }
    
        $settings['tax'] =  array(
            'category' => array(
                'include' => array_unique( $term_ids ),
                'view_type' => 'checkbox'
            )
        );
    
        return $settings;
    }
    add_filter( 'buddyblog_post_form_settings', 'buddydev_filter_buddyblog_settings' );
    
    

    Thank You
    Ravi