Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

  • dutch84
    Participant

    @dutch84

    I would be interesting in knowing the answer to this questions as well.


    dutch84
    Participant

    @dutch84

    @prashantvatsh Sorry to bother you, but I tried the following solution, and it is still not working:

    First, I added the following code to my bp-custom.php file:

    <?php
    
    //The following creates avatar class in activity stream
    //based on x-profile field data
    
    function buddydev_create_avatar_class_based_on_field_data() {
        
    	$user_id = bp_get_activity_user_id();
    	$title = xprofile_get_field_data('25', $user_id); // field ID or name
    	$title = strtolower( $title );	
    	$class = $title.'avatar';
    	
    	echo $class;
    }
    
    add_action( 'create_activity_avatar_class_based_on_field_data', 'buddydev_create_avatar_class_based_on_field_data', 10, 1 );
    
    ?>

    Then, I added the following as a class inside the div tag for activity avatar in my buddypress/bp-templates/bp-legacy/buddypress/activity/entry.php file:

    <?php do_action( 'create_activity_avatar_class_based_on_field_data'); ?>

    Yet still it is not working. Did I put the do_action in the wrong file?


    dutch84
    Participant

    @dutch84

    @prashantvatsh it seems that I need to give activity avatar’s class based on field data so that they will take the css change as well. How and where do I update the php so that the Activity avatars receive a new class based on field data?


    dutch84
    Participant

    @dutch84

    Thanks again, @prashantvatsh
    It worked!
    However, it only shows on the profile of the user. I want the color to show in the activity feed and everywhere you see their avatar on the website. Is that possible? How do I achieve this?

    Thanks!


    dutch84
    Participant

    @dutch84

    Thank you @prashantvatsh
    It still is not working. Could these files possibly be in the wrong folders?

Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar