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: 25486
    Brajesh Singh on in reply to: [Resolved] Delay when posting on BP #45145
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi Quint,
    Thank you for the reply and confirming.

    2. I have slightly updated the code( Also included your code for inch2feet, so please remove the old one).

    
    
    function inches2feet($inches){
    
    	//Get the feet by dividing the inches by 12.
    	$feet = intval($inches/12);
    	//Then, get the remainder of that division.
    	$inches = $inches % 12;
    	//If there is no remainder, then it's an even figure
    	if($inches == 0){
    		return $feet . ' foot';
    	}
    	//Otherwise, return it in ft and inches.
    	return sprintf('%d ft %d inches', $feet, $inches);
    }
    
    /**
     * Converts inches to metric unit(zz meters, xx cms ).
     *
     * @param float $inches inch.
     *
     * @return string
     */
    function inches2metric( $inches ) {
    
    	$cms = $inches * 2.54;
    
    	$len_meters = floor( $cms / 100 );
    	$len_cms    = $cms % 100;
    
    	$out = array();
    
    	if ( $len_meters ) {
    		$out [] = sprintf( '%d meters', $len_meters );
    	}
    	if ( $len_cms ) {
    		$out [] = sprintf( '%d cm', $len_cms );
    	}
    
    	return join( ', ', $out );
    
    }
    
    add_filter( 'bp_get_the_profile_field_value', function ( $field_value, $field_type = '', $field_id = '' ) {
    	if ( ! $field_id || ! $field_value ) {
    		return $field_value;
    	}
    
    	$height_fields = array( 8, 9 );// update your field ids.
    	if ( ! in_array( $field_id, $height_fields ) ) {
    		return $field_value;
    	}
    
    	$field_value = floatval( $field_value );
    
    	$imperial_length = inches2feet( floatval( $field_value ) );
    	$metric_length   = inches2metric( $field_value );
    
    	return "{$imperial_length}({$metric_length})";
    
    }, 9, 3 );
    
    

    It will display in the format ” xx ft, yy inch( mm meters, zz cms)”.
    Please feel free to adapt it.

    3. Thank you. I do believe that.

    Sure, I am looking forward to it.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi Quint,
    Welcome back.

    1. You can apply it to multiple fields in the profile loop using a filter

    
    
    add_filter( 'bp_get_the_profile_field_value', function ( $field_value, $field_type = '', $field_id = '' ) {
    	if ( ! $field_id || ! $field_value ) {
    		return $field_value;
    	}
    
    	$height_fields = array( 8, 9 );// update your field ids.
    	if ( ! in_array( $field_id, $height_fields ) ) {
    		return $field_value;
    	}
    
        return inches2feet( floatval( $field_value ) );
    
    }, 9, 3 );
    
    

    2. Do you want me to update to append the original value. If yes, what would be the display format.

    3. Thank you for the suggestion and I am surely considering adding a length field.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi Tosin,
    Thank you. I will be getting back to you late this weekend with more details.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi April,
    Thank you for the details.

    I do not understand your point but I do understand that you want the link to be /members/xyz/first-name for xyz user.

    At the moment, the plugin does not have this ability. We can add it in next 2-3 days via hook. We will not add this to plugin core as it does not represent our intended use case and will be more trouble for most of the members who do not understand how BuddyPress/BuddyBoss works(You seem to know, so that does not apply to you).

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25486
    Brajesh Singh on in reply to: BuddyPress Group Tabs Creator Pro upgrade issue #45134

    Hi David,
    I am sorry. I am not sure what could be the cause as you do have active membership. Do you have any staging site where I can check the same?

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Thank you. I am looking forward to your feedback.

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi April,
    Welcome back.

    1. Sorry, that is beyond the scope of profile tabs creator pro. It can not help you with your profile url. That is provided by BuddyPress/BuddyBoss. It can help you with the component url(e.g friends/activity/messages etc). The url format http://example.com/members-directory-page-slug/user-nicename/user_login is managed by the BuddyPress/BuddyBoss core.

    I will suggest contacting BuddyBoss developers if you need to change that.

    2. Does BuddyBoss offer you to choose icons for tab? If yes, Please let me know and we can add the same. Otherwise, the solution is to add icon via css. Please let me know the icon code and I will supply the css.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi Tosin,
    Thank you for the suggestion.

    can you please tell the intent on the request. Do you want new user to be friends with all the feature members or do you want the user who is being featured to be friends with other member matching the criteria?

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi @talia,
    Sorry about it.

    Please open a new topic to help me assist you. This topic is related to another member’s issue and they will be notified of the discussions which is not relevant to their need.

    In the meantime, I will be looking at the issue.

    Regards
    Brajesh