• Resolved argamanza

    (@argamanza)


    I’m using Ultimate Member as my main users and roles system, and i love it.

    I have one issue that cancels out the functionality of the Google Profile Avatars plugin – i’m using it together with Google Apps Login plugin and this way i achieved my desired functionality: a user will login using his Google account and automatically his Google avatar will be the avatar in my WordPress site.

    Since i installed Ultimate Member that no longer works, UM takes full ownership over the user’s avatar and unless he uploads one in his profile/account page, it will be the default one (wp-content/plugins/ultimate-member/assets/img/default_avatar.jpg).

    When i check the database each user does have his Google avatar URL inside wp_usermeta table, under the gpa_user_avatar column, but a brief look at the plugin’s code shows that unless there’s an avatar under wp-content/uploads/ultimatemember/(USER_ID)/profile_photo.png it displays the default avatar.

    I would really like to get the previous behavior with Ultimate Member, is there an easy way to achieve it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @argamanza

    Would you like to remove the UM avatar entirely from modifying WP get_avatar?

    Regards,

    Thread Starter argamanza

    (@argamanza)

    Thanks for the reply @champsupertramp , I think the optimal solution won’t be canceling get_avatar, since it’s still useful for users without Google avatar / users that didn’t use the Google Login…

    I would rather combine the functionality by adding a condition that will first check if the user has a Google avatar (wp_usermeta -> gpa_user_avatar isn’t empty) to display it before choosing the default avatar.

    That means i would also have to add a function that will remove that cell’s content once a user uses his profile page to upload a new avatar.

    I have a good understanding in a lot of programming languages, PHP is not one of them so while i do have the ability to create such functionality i lack the knowledge of how to use filters or any other way to “override” the plugin’s functionality…

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @argamanza

    You can try this code snippet:

    add_filter("um_user_avatar_url_filter","um_add_gpa_user_avatar", 10, 3 );
    function um_add_gpa_user_avatar( $url, $user_id, $data ){
       $has_gpa_user_avatar_url = get_user_meta( $user_id, "gpa_user_avatar", true );
       if( ! empty( $has_gpa_user_avatar_url ) ){
            return $has_gpa_user_avatar_url;
        } 
       return $url;
    }

    Regards,

    Thread Starter argamanza

    (@argamanza)

    @champsupertramp this isn’t perfect (now you can’t delete or change your image if the UM profile page if you have Google Avatar) but that’s just what i was looking for!

    I will take if from here, tweaking it to behave exactly like i wish shouldn’t be too hard.

    Thanks!

    • This reply was modified 6 years ago by argamanza.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘UM Cancels our other plugin functionality (Google Profile’ is closed to new replies.