IP Boards Secure Gravatar Fix

This problem has a very simple fix. Lets jump right into the code.

In the file /system/Member/Member.php there is a method called get_photo which is called when you try to reach a users photo by $member->photo.

Our problem is with the default photo of IP Boards, so we will need to delete it.

About line 975 there is a part of code like this

    $url = \IPS\Http\Url::external( "https://secure.gravatar.com/avatar/" . md5( trim( mb_strtolower( $this->pp_gravatar ?: $this->email ) ) ) . ( $photoVars[0] ? ( "?size=" . min( $photoVars[1], $photoVars[2] ) ) : '' )) . "&d=" . urlencode( $url ) );

We will remove the part where it concatanates the default image url.

 . "&d=" . urlencode( $url ) )

After the code looks like this:

    $url = \IPS\Http\Url::external( "https://secure.gravatar.com/avatar/" . md5( trim( mb_strtolower( $this->pp_gravatar ?: $this->email ) ) ) . ( $photoVars[0] ? ( "?size=" . min( $photoVars[1], $photoVars[2] ) ) : '' ));

It should all be fine.

PS: If you want you can still modify which default gravatar type you wish.

    $url = \IPS\Http\Url::external( "https://secure.gravatar.com/avatar/" . md5( trim( mb_strtolower( $this->pp_gravatar ?: $this->email ) ) ) . ( $photoVars[0] ? ( "?size=" . min( $photoVars[1], $photoVars[2] ) ) : '' )) . "&d=identicon" ) ;

Since I love the way identicons look, i simply changed the default image url to identicon.

Copyright © Ozan Kurt 2015.

Scroll to Top