Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 2,151 through 2,175 (of 3,787 total)
  • @danbp

    Participant

    Previous snippet changed all avatars (user, blogs and groups) which is not what you want. Here’s a snippet which works almost correctly, but not to 100%. Give it a try anyway.

    It changes the user avatar depending of an xprofile value.

    (add to bp-custom.php)

    function bpfr_my_new_avatar_url() {
    global $bp;
    
    	if( bp_is_user() && ! bp_get_member_user_id() ) {
            $user_id = bp_displayed_user_id();
        } else {
            $user_id = bp_get_member_user_id();
        }
    
    	if ( is_page( 'activity' ) ) {
    		$user_id = bp_get_activity_user_id();	
    	}
    
    $ranking = xprofile_get_field_data ('ranking', $user_id );
    
    	if ($ranking == "Top 25") {		
    		$url = get_stylesheet_directory_uri() .'/custom_img/25.png';
    	}
    	
    	if ($ranking == "Top 24") {		
    		$url = get_stylesheet_directory_uri() .'/custom_img/24.png';
    	}
    return $url;
    
    }
    add_filter( 'bp_core_default_avatar_user', 'bpfr_my_new_avatar_url' );
    

    Create a profile field called “ranking” with 2 options (top 24 & top 25).
    Create a folder in your child-theme called “custom_img” and add 2 pictures: 24.png & 25.png (250×250)
    If everybody must those avatars, disallow avatar upload in BP settings.
    Site default avatar stays as Mystery Man (wp default setting).

    You have also to get rid of Gravatar, so you must add this to bp-custom.php
    add_filter('bp_core_fetch_avatar_no_grav', '__return_true');

    The thing who doesn’t work is related to X & Y are now friends. Both willhave the same avatar.

    Can probably by better improved.

    @danbp

    Participant

    Sorry but your pasted code is wrong.
    See source.
    Read also the comments before you copy/paste.

    @henrywright can you help out please ?

    @danbp

    Participant

    Can you publish the exact code you’re actually using to show custom avatars on your site ?

    Your first snippet contains errors.

    You have to refresh the page once logged-in to get the avatar to appear in the sidebar.

    @danbp

    Participant

    Please, don’t double post. Answers are not coming faster by doing this. Thx.

    Topic is continued here:
    https://buddypress.org/support/topic/avatar-does-not-show-outside-buddypress/

    @danbp

    Participant

    Your homepage contains an error:
    ob_end_flush(): failed to send buffer of zlib output compression (1) in ../../wp-includes/functions.php on line 3269

    Which kind of avatar should appear on the homepage ? It’s the default blog page and there is no avatar on this page.

    You have to setup buddypress correctly at first before trying to modify your site.

    Check that any BP component has his page and setup pretty permalinks.

    Configure BuddyPress

    @danbp

    Participant

    Wow, i searched for that and didn’t found. 👿 Thank you @henrywright for this information. 😀

    @danbp

    Participant

    You’re welcome.

    @danbp

    Participant

    Oh wait… what do you exactly want to achieve ? Where should this ranking avatar show up ?
    Give more details please.

    What is the profile field name: ranking or gender ?
    Theme name ?

    In reply to: mentions.min.js

    @danbp

    Participant

    Guess you have an json error due to a facebook plugin. Deactivate it and see if it change something. If it is coming with your theme, see if an update is avaible or if something is related to this on your theme support.

    Seems also that you modified your theme name. Doing this is not recommended as it the best way to introduce some errors because of missing files or wrong slugs. Specially when high js management is built in.

    Test your install with 2015, and activate your theme only if anything is working correctly with this default setup.

    @danbp

    Participant

    Have you assigned a page to “registration” ?
    Again: each active BP component should have his own page.

    @danbp

    Participant

    Try this:

    function wpse_49216_my_new_avatar_url() {
    global $bp;
    	if( bp_is_user() && !bp_get_member_user_id() ) {
            $user_id = 'displayed: '. bp_displayed_user_id();
        } else {
            $user_id = 'get_member_user: '. bp_get_member_user_id();
        }
    
    $gender = xprofile_get_field_data ( 'ranking', $user_id );
       if ($gender == "Top 25") {
          return 'http://hsseek2.esy.es/wp-content/uploads/2015/04/25.png';
       }
       if ($gender == "Top 24") {
          return 'http://hsseek2.esy.es/wp-content/uploads/2015/04/24.png';
       }
    }
    add_filter ('bp_core_fetch_avatar_url', 'wpse_49216_my_new_avatar_url');

    @danbp

    Participant

    OK.
    Have you setup pretty permalinks to something other as “default” ?

    When BP is setup correctly, activities and members directory should be (by default), your-site/members/ and your-site/activities/
    You actually have your-site/?page_id=5 for activities.

    Check that you assigned a page to any activated BP component – ensure also they exist in page directory. These page should be blank and without any parent template or model. Just a title, nothing else.

    More setup details on Codex.

    @danbp

    Participant

    Yes, it’s a knowed bbPress bug (at least 2 mounth ago). But bbPress was updated since… So i guess it’s also related to your theme and the way he calls page…

    See here please, and apply the patch. (if not already in latest bbp ?)
    https://buddypress.org/support/topic/weird-error-after-updating-buddypress/#post-234299

    Activate first 2015 or 2013 while testing, so you will be sure it’s your theme in case of the test is successfull. And also all other plugins except BP and bbP.

    @danbp

    Participant

    hi @hellowed,

    try this (add to child theme functions.php or better, bp-custom.php) It will remove a and span and h1 html tag

    function bpfr_remove_html_from_private_msg($message){
    		$replacement = ''; 
    return preg_replace( "/ <(span|a|h1)[^>]*>/", $replacement, $message);
    	
    }
    add_filter('messages_message_content_before_save', 'bpfr_remove_html_from_private_msg');

    @danbp

    Participant

    @fugu78,

    you are using joomla on the mainsite and WordPress on the subdomain.
    Question is: is WP sharing the same DB as joomla or have you a complete separate install (db & cms) for your WP/BP site ?
    Which type of WP install do you use ? Single or network ? (more about)
    Are mainsite users and wp site users the same people ?

    BuddyBoss has his own support forum. You probably have better to ask there directly.

    @danbp

    Participant

    Don’t panic ! Something went wrong after WP update. OK.
    And two BP pages are now blank.
    But at this time, it’s difficult to tell you what happened to your install.

    Can you provide a site URL ? And a list of all your activated plugins ?

    It’s also a good practice to have a local install, mirrored to your production site, where you can make some test. This is particulary usefull in situation like yours.

    When you’re on group and members page, is the screen blank or only missing the BP part ?
    Please enable wp_debug in wp-config, and see if you get some error mesaage ?

    FYI, here a similar discussion, so you can have a little overview about page issues.

    @danbp

    Participant

    Hi @edutech2015,

    depends your theme, and needs preferably the usage of a child-thme.
    the forum plugin is bbPress. This plugin use the same technique as BuddyPress to adjust CSS.

    See bbPress documentation here.
    And follow for BP from here.

    @danbp

    Participant

    you have to add a scope in bp_get_stuff function.

    if ( bp_has_activities( $activity_id . '&scope=favorites,mentions&max=5' ) ) :

    Thought you have to uncomment some of array values too. (component and item_id)

    Reference: https://codex.buddypress.org/developer/loops-reference/the-activity-stream-loop/

    @danbp

    Participant
    public function generate_activity_stream( $atts, $content = null, ) {
    
    $temp_post = get_post($post_id);
    $user_id = $temp_post->post_author;
    
     //allow to use all those args awesome!
           $atts=shortcode_atts(array(
    
             // rest of the function
    

    @danbp

    Participant

    Have you already tested with one of WP default theme, as some details around pages have been changed recently in WP and BP.

    After an update, and some BP pages won’t show up, you can also try be re-saving pretty permalinks. Or disable a BP component, save and reactivate and save again.

    Sorry no other idea to share at the moment. 😉

    @danbp

    Participant

    @danbp

    Participant

    Hi @medianp,

    just tested the plugin on a local network install and it works.

    There is just a little count error (missing arg 2) in one of the file.
    To solve this, add $count at the end of line 107 in bp-community-stats.php
    $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(a.id) FROM {$bp->activity->table_name} a WHERE type = 'activity_update' AND a.component = '{$bp->activity->id}'", $count ) );

    Plugin author warned: Total Posts and Comments not support in multisite/network mode

    Search the WP plugin repo to get the missing stats.

    @danbp

    Participant

    Don’t hack core files !

    It will be overwriten at next BP update.

    Use preferably a filter function. Give this a try (add it to bp-custom.php) :

    function members_dir_oldest_first( $bp_user_query ) {
        if ( 'newest' == $bp_user_query->query_vars['type'] )       
    		$bp_user_query->uid_clauses['order'] = "ASC";
    }
    add_action ( 'bp_pre_user_query', 'members_dir_oldest_first' );

    @danbp

    Participant

    hi @utahman1971,

    this is the default behave of extended profile fields. Also it’s very handy, as those links became searcheable keywords. This let users click and find other entered same words.

    That said, a bio is generally more personnal, so those links maybe less important…

    Here’s a snippet (bp 2.0.1 +) you can add to bp-custom.php. It let’s you selectively disable those automated linking from some fields and let some other in place.

    function my_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
        // Access the field you are going to display value.
        global $field;
        // In this array you write the ids of the fields you want to hide the link.
        $excluded_field_ids = array(2,6,7);
        // If the id of this $field is in the array, we return the value only and not the link.
        if (in_array($field->id, $excluded_field_ids))
    	return $field_value;
    	
    	if ( 'datebox' == $field_type )
    	return $field_value;
    	
    	if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
    	return $field_value;
    	
    	$values = explode( ',', $field_value );
    	
    	if ( !empty( $values ) ) {
    		foreach ( (array) $values as $value ) {
    			$value = trim( $value );
    			
    			// If the value is a URL, skip it and just make it clickable.
    			if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) {
    				$new_values[] = make_clickable( $value );
    				
    				// Is not clickable
    			} else {
    				
    				// More than 5 spaces
    				if ( count( explode( ' ', $value ) ) > 5 ) {
    					$new_values[] = $value;
    					
    					// Less than 5 spaces
    				} else {
    					$search_url   = add_query_arg( array( 's' => urlencode( $value ) ), bp_get_members_directory_permalink() );
    					$new_values[] = '<a href="' . $search_url . '" rel="nofollow">' . $value . '</a>';
    				}
    			}
    		}
    		
    		$values = implode( ', ', $new_values );
    	}
    	
    	return $values;
    }
    
    /**
     * We remove the buddypress filter and add our custom filter.
     */
    function remove_xprofile_links() {
        // Remove the old filter.
        remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
        // Add your custom filter.
        add_filter( 'bp_get_the_profile_field_value', 'my_xprofile_filter_link_profile_data', 9, 2);
    }
    add_action('bp_setup_globals', 'remove_xprofile_links');

    If you want to deactivate completely profile fied links, you can use this function:

    function bpfr_remove_xprofile_links() {
        remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    }
    add_action('bp_setup_globals', 'bpfr_remove_xprofile_links'); 

    @danbp

    Participant
Viewing 25 replies - 2,151 through 2,175 (of 3,787 total)
Skip to toolbar