Shape the future of Social networking with WordPress: Join Project Midnight Sun! The next generation platform for community building with WordPress!

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25318
    Brajesh Singh on in reply to: Login form #18385

    Hi Madhavi,

    If you plan to sell memberships and products both and want to give special discounts etc to subscribes, the best available solution is to use WooCommerce for products and WooCommerce Memberships plugin for the membership.

    Hope that helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Hi Torben,
    Thank you for posting.

    1. Translation issue:- It is happening because we have all bbPress files using our text domain. That means, in order to translate, you will need to localize it in theme’s translation file.

    If you rename “bbpress” folder, the templates are used from bbpress and since they are already translated, it works.

    2. The only reason we put our own bbpress folder and files was to control the views and provide better styles. If the view works for you without our bbPress folder, I will suggest removing it.

    You should also remove bbpress-functions.php if you decide to go with it .

    There is nothing wrong in removing the folder as in future, we do plan to only keep a few wrapper files.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Hi Mark,
    Hope you are doing well.

    I am sorry for the delayed update.

    The update is available now. Please upgrade to 1.6.1
    https://buddydev.com/plugins/bp-profile-visibility-manager/

    and then from general settings enable the Follow Button visibility. If you do that, users can choose the option to enable/disable the button.

    Please let me know if it works for you or not?

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318
    Brajesh Singh on in reply to: facebook like activity stream #18379

    Hi David,
    If you are comfortable providing me either ftp or the access to theme, I can look into it and can quickly provide a solution.

    Please let me know if that will be feasible?

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Hi Daria,
    Thank you. Yes, we can do that in future.

    Here I am going to show two approaches( I will prefer second if feasible).

    Strategy 1 :- Using member_type__in like this

    
    
    /**
     * Restrict members list by member type.
     *
     * @param array $args args.
     *
     * @return array
     */
    function buddydev_filter_by_opposite_member_type( $args ) {
    
    	//  No need to change members listing if the user is not logged in.
    	if ( ! is_user_logged_in() ) {
    		return $args;
    	}
    
    	// Map of visible member types based on the member type.
    	// 'male', 'female' are member type names.
    	$visible_types_map = array(
    		'male'   => array( 'international', 'female' ),
    		'female' => array( 'canada',  'male' ),
    	);
    
    	$member_types = bp_get_member_type( get_current_user_id(), false );
    	$member_type = '';
    	// check if the user has a member type that may trigger the selection.
    	foreach ( $member_types as $member_type_name ) {
    		if ( isset( $visible_types_map[ $member_type_name ] ) ) {
    			$member_type = $member_type_name; //found.
    			break;
    		}
    	}
    
    	// If the user does not have a member type
    	// or if the user does not need the restriction.
    	if ( empty( $member_type ) || empty( $visible_types_map[ $member_type ] ) ) {
    		return $args;
    	}
    
    	$args['member_type__in'] = $visible_types_map[ $member_type ];
    	return $args;
    
    }
    
    add_filter( 'bp_after_has_members_parse_args', 'buddydev_filter_by_opposite_member_type' );
    
    

    The problem with this approach is that instead of “AND”ing the coditions are “OR”ed. Eg. Instead of ‘international’ AND ‘female’ it becomes ‘international’ OR ‘female’ and it does not server our purpose.

    Strategy 2: Use member_type__not_in to exclude member types. It only works if all the members have atleast one member type assigned(It does not matter which member type)

    
    /**
     * Restrict members list by member type.
     *
     * @param array $args args.
     *
     * @return array
     */
    function buddydev_filter_by_opposite_member_type2( $args ) {
    
    	//  No need to change members listing if the user is not logged in.
    	if ( ! is_user_logged_in() ) {
    		return $args;
    	}
    
    	// Map of visible member types based on the member type.
    	// 'male', 'female' are member type names.
    	$visible_types_map = array(
    		'male'   => array( 'international', 'female' ),
    		'female' => array( 'canada',  'male' ),
    	);
    
    	$member_types = bp_get_member_type( get_current_user_id(), false );
    	$member_type = '';
    	// check if the user has a member type that may trigger the selection.
    	foreach ( $member_types as $member_type_name ) {
    		if ( isset( $visible_types_map[ $member_type_name ] ) ) {
    			$member_type = $member_type_name; //found.
    			break;
    		}
    	}
    
    	// If the user does not have a member type
    	// or if the user does not need the restriction.
    	if ( empty( $member_type ) || empty( $visible_types_map[ $member_type ] ) ) {
    		return $args;
    	}
    	// Find all registered types and deduce the types which are invisible.
    	$all_types = bp_get_member_types(array(), 'names' );
    	$invisible_types = array_diff( $all_types, (array) $visible_types_map[ $member_type ] );
    
    	$args['member_type__not_in'] = $invisible_types;
    	return $args;
    
    }
    
    add_filter( 'bp_after_has_members_parse_args', 'buddydev_filter_by_opposite_member_type2' );
    

    You only specify which member types will be visible. We calculate the invisible types automatically. This works to AND our conditions but there is an issue. If a user does not have any member type, they will show up in the list. In other words, if all uses are guaranteed to have at least 1 member type, it works.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Hi Torben,
    since BuddyPress has changed the url for activation link recently, It could be specific to theme. I will be looking into it more today and I will have a solution for the same by tomorrow.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Hi Nikita,
    I have fixed the issue.

    Please upgrade to 1.2.4
    https://buddydev.com/plugins/conditional-profile-fields-for-buddypress/

    And it will work with conditions across multiple filed groups. Please do let me know if it works for you or not?

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Hi Nikita,
    Thank you for the patience.I have found the bug. There is a place where I am checking that the field which triggers change must exist in dom. That is an incorrect assumption for the edit page. I am working on it and will have a release in next couple of hours.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Thank you Nikita. I will get back to you by the day end today(Sunday).

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25318

    Hi Daria,
    Thank you for sharing more details and the patience.

    1. I am sorry but the above is not doable with BuddyPress Member Types alone( May be we can use a 3rd member type called international? I will be thinking a bit more about it today).

    2. The opposite of it(which member types a user want to see is easily doable).

    The member type is like category so we can include whole category or exclude whole category but can not do the same for individuals.

    It is possible to implement it as non member type solution though.

    PS:- I will share the code for member type by Sunday evening.

    Thank you
    Brajesh