BuddyDev

Search

Xprofile Custom Fields – Only very basic editor showing

  • Participant
    Level: Initiated
    Posts: 1
    Dave on #29451

    Hi, wondering if anyone would be able to help please.

    Currently using WP 5.4.1 and BP 5.2.0
    I have Buddy Press xProfile custom fields installed where I have created a multi line text box to allow members to write about themselves.

    For some reason though, only a very basic editor is show up. I tried adding tinymce advanced to see if that would help, but no joy. I was hoping to have the option for members to add images/media – the kind of features you see on a regular text bar.

    Any help grealty appreciated.

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #29452

    Hi Dave,
    Welcome to BuddyDev.

    Thank you for the question.

    BuddyPress does not allow upload to avoid security issues. this is feasible to allow users upload media but not recommended.

    To enable uploading for any user, you need to enable upload button and gran user upload_files permission

    
    // grant all users upload permission.
    add_filter( 'user_has_cap', function ( $all_caps, $caps, $args, $user ) {
    
    	if ( 'upload_files' !== $args[0] ) {
    		return $all_caps;
    	}
    
    	if ( is_user_logged_in() ) {
    		// grant all needed caps.
    		foreach ( $caps as $cap ) {
    			$all_caps[ $cap ] = true;
    		}
    	}
    
    	return $all_caps;
    }, 10, 4 );
    
    // enable upload button in text area.
    add_filter( 'bp_xprofile_field_type_textarea_editor_args', function ( $args ){
    	$args['media_buttons'] = true;
    
    	return $args;
    });
    
    

    That will allow any logged user to upload images/other file types.

    Please do note that this is not recommended as it may be a security nightmare to allow everyone uploading.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Dave on #29529

    Hi,
    Many thanks for that. Is there an option of rather then uploading images, but using images from elsewhere they have located on the net, or uploaded elsewhere?

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #29539

    You are welcome.

    I am sorry, I am not aware of any existing solution for BuddyPress xprofile that allows this.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved