BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 4
    Aaron Thomas on #6824

    Definitely not.

  • Participant
    Level: Initiated
    Posts: 4
    Aaron Thomas on #6767

    Brajesh,

    My mistake, you were correct, my bp-custom.php was not valid, but I think I have fixed that file now, and it looks like this:

    <?php
    /**
     * Add class 'no-profile-photo' to body if the user has not yet uploaded an avatar
     *
     * Works with BuddyPress Force Profile Photo Plugin
     *
     * @param $classes
     *
     * @return array
     */
    function buddydev_custom_add_profile_photo_class_to_body( $classes ) {
    
    	if ( ! is_user_logged_in() || ! class_exists( 'BD_Force_User_Avatar_Helper' ) ) {
    		return $classes;
    	}
    
    	if ( ! is_super_admin() && ! BD_Force_User_Avatar_Helper::get_instance()->has_uploaded_avatar( bp_loggedin_user_id() )  ) {
    		$classes[] = 'no-profile-photo';//the user has no profile photo
    	}
    
    	return $classes;
    }
    add_filter( 'bp_get_the_body_class', 'buddydev_custom_add_profile_photo_class_to_body' );
    ?>

    — This is my fist time using bp-custom.php, and it’s only purpose, right now, is to accomplish this project with BP Force Profile Photo. I have placed this file in my plugins folder. —

    I have placed this css in my child theme’s style.css file:

    body.no-profile-photo .item-list-tabs {
    display:none;
    }

    But, the links still appear. Can you spot any mistakes?

    Thank you very much for your time.

  • Participant
    Level: Initiated
    Posts: 4
    Aaron Thomas on #6729

    Brajesh,

    Thank you for trying to help me with this enhancement.

    I did not manage to get this to work. I inserted the php code into my bp-custom.php, and I inserted the css code into my theme’s style.css. With that being said, did I work with the right files?

    I get this message in the WP dashboard:

    hoto’ to body if the user has not yet uploaded an avatar * * Works with BuddyPress Force Profile Photo Plugin * * @param $classes * * @return array */ function buddydev_custom_add_profile_photo_class_to_body( $classes ) { if ( ! is_user_logged_in() || ! class_exists( ‘BD_Force_User_Avatar_Helper’ ) ) { return $classes; } if ( ! is_super_admin() && ! BD_Force_User_Avatar_Helper::get_instance()->has_uploaded_avatar( bp_loggedin_user_id() ) ) { $classes[] = ‘no-profile-photo’;//the user has no profile photo } return $classes; } add_filter( ‘bp_get_the_body_class’, ‘buddydev_custom_add_profile_photo_class_to_body’ );

  • Participant
    Level: Initiated
    Posts: 4
    Aaron Thomas on #6111

    Thanks for your reply!

    I must admit, I am a beginner with PHP. I don’t know exactly how to complete step 1:

    (1. Add a class to body if the user has not uploaded a photo say we add ‘no-profile-photo’)

    If you get time, please give me more detailed instructions on how to do this part.

    The 2nd part sounds easy, I assume I would just add that CSS code to my theme’s stylesheet.

    As always, thanks for your time & for sharing this great plugin with us.