• Resolved mymshow

    (@mymshow)


    Is there any way to add the following:

    -Default image
    -Remove image button
    -Show image on the front end

    This options can be found on the Buddypress Xprofile Custom Fields Type, but I prefer your plugin as I only need to add the image field along with the basic buddypress profile fields in order to keep it nice and simple.

    I am using your plugin along with Buddy Verified in order to allow users to upload an verification photo such as id in order to set their account as Verified User.

    Thank you in advance.

    JB

    https://www.ads-software.com/plugins/buddypress-xprofile-image-field/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Alex Githatu

    (@kalengi)

    Thanks for choosing my plugin.

    To display a default image, hook into the bp_get_the_profile_field_value filter and process based on the field type parameter. If the type is Image, then check whether it has any data. If not, then supply the link to your default image. Something like the following (untested code):

    function setDefaultImage($field_value, $field_type, $field_id) {
    	if($field_type == 'image'){
    		if(empty($field_value)){
    			$field_value = WP_CONTENT_URL . '/uploads/profiles/my-default-image.jgp';
    		}
    	}
    
    	return $field_value;
    }
    add_filter( 'bp_get_the_profile_field_value', 'setDefaultImage', 10, 3 );

    To show an image on the front-end can be done with a similar approach, but in this case you pick the field that has a non-empty $field_value, make that the src for an img tag and return the result as the new value.

    The image removal button is a feature I’ll be putting into the next version of the plugin due in about two weeks.

    Thread Starter mymshow

    (@mymshow)

    The default image is not that important so I will wait untill you will come with the new version which include the remove button and also if you will consider in add the show in front end image too. For example after I upload a photo it does show in the edit mode but when I go on view mode i see the following Verification Photo: /uploads/profiles/1/@admin.jpg instead of the actual photo.

    Thank you in advance.

    JB

    Plugin Author Alex Githatu

    (@kalengi)

    Yes, the image display shall be part of the update.

    Thread Starter mymshow

    (@mymshow)

    That is GREAT. Looking forward to it.

    Thank you,

    JB

    Plugin Author Alex Githatu

    (@kalengi)

    The new version of the plugin is now available. Handles front-end image display and image removal.

    Plugin Author Alex Githatu

    (@kalengi)

    Marking as resolved

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘XProfile Image Field Default Image, Remove Image, Show image in front end’ is closed to new replies.