Support » Plugin: Ultimate Member - User Profile & Membership Plugin » Ultimate Member – Image Uploads and Profile Images

  • Resolved molokini

    (@molokini)


    Hello,

    We’re having real difficulties getting Ultimate Member to upload images.

    We have followed the steps here: https://docs.ultimatemember.com/article/114-photo-uploads-not-working

    And have met all those conditions, checked all those settings. We can see in the uploads folder an ultimatemember folder, then a temp one. We have set the permissions to 744 on the folders.

    When we try to do a registration which has upload image field, nothing gets uploaded and the console returns something like

    …domain…./wp-content/uploads/ultimatemember/temp/stream_photo_0893f81ebe1e5c6c18cc130a7337907b719c15c8.png?1570720133964 404 (Not Found)

    Secondly, we have created our own custom profile page which resides in our theme here /child_theme/ultimate-member/templates/profile.php but we have no way of adding in the Ultimate Member core profile photo functionality, therefore we can’t change the user avatar (notwithstanding the issue noted above).

    Even when we disable the child theme profile.php, the default Ultimate Member one doesn’t work, see here, this is supposedly with the default Ultimate Member profile.php in place and this happens:

    https://www.molokini.co.uk/profile-issue.jpg

    As you can see we just get a white gap and a tick?

    There is nothing in debug.log as I have enabled WP_DEBUG in wp-config.php so I don’t know where to turn next?

    Thanks,
    Vicky

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    I still have the same trouble with profile images, all attempts to uplaod an image results in “Your image is invalid!”. Did all the testing, stripped down the page to twentysixteen and twentyseventeen with disabling ALL Plugins except UM – to no avail.

    Switched rights of the uploads/ultimatemember directory to group -> can write – no avail.

    The site uses avada with fusion, no caching plugins (exept the avada one) and asgaros forum.

    phpinfo says gd and imagemagic are on.

    So I am really stuck here and do need the functionallity for this site. My customer won’t accept it without profile images.

    Could you tell me where the profile images should go exactly and with which name? So I could test uploading an image via ftp, just to start on this end?

    Best regards,
    nici-

    That sucks you have the same problem nici.

    We finally got it to work, turns out the executable bit wasn’t set correctly on our folders, so when we looked at them on WinSCP they looked like folders, but when we tested through browsing the directory structure in Chrome we saw they looked like files.

    Once we did this we added this code to a function we have attached to the um_after_save_registration_details action, this essentially creates another post sit alongside the registered user (a company profile) and this ideally needs to take the logo uploaded.

    What we found was that the image uploaded into the /wp-content/ultimatemember/temp folder does not get moved into its relevant /wp-content/ultimatemember/<user_id> folder until after this action is fired. (And when it does get moved it gets a different name!! as reflected in the final user profile meta key ‘profile_logo’ in our case as that is the name of the field we created on the Ultimate Member registration form).

    So I have written this code:

    $image_filename = $submitted['profile_logo'];
    
    if(!empty($image_filename)):
    	$base_uploads_folder = wp_upload_dir();
    	$um_folder = $base_uploads_folder['basedir'].'/ultimatemember/';
    
    	$image_url = $um_folder . 'temp/' . $image_filename;
    
    	$upload_dir = wp_upload_dir();
    	$image_data = file_get_contents( $image_url );
    
    	// move the file into standard WP upload folder hierarchy before
    	// UM hides it away again....
    	if ( wp_mkdir_p( $base_uploads_folder['path'] ) ):
    		  $file = $base_uploads_folder['path'] . '/' . $image_filename;
    	else:
    		$file = $base_uploads_folder['basedir'] . '/' . $image_filename;
    	endif;
    
    	file_put_contents( $file, $image_data );
    
    	// now attach to media library
    	$wp_filetype = wp_check_filetype( $image_url, null );
    	$attachment = array(
    	  'post_mime_type' => $wp_filetype['type'],
    	  'post_title' => 'User ID '.$user_id.' Profile Photo',
    	  'post_content' => '',
    	  'post_status' => 'inherit'
    	);
    
    	$attach_id = wp_insert_attachment( $attachment, $file );
    	require_once( ABSPATH . 'wp-admin/includes/image.php' );
    	$attach_data = wp_generate_attachment_metadata( $attach_id, $file );
    	wp_update_attachment_metadata( $attach_id, $attach_data );	
    
    	set_post_thumbnail($new_company_pid,$attach_id);	
    endif;	

    In the end we have had to use this as we couldn’t make any sense of Ultimate Member’s profile photo facility that’s built in, it just doesn’t work for us at all, and the documentation is a nightmare to work through, or non existent. In fairness, there are a load of hooks which we are grateful for but the process of finding the docs on them is really badly done.

    We may have to do something similar for the user profiles in due course.

    Finally I got it to work – or the hoster did, to be honest:

    Turned out it was a problem in hosting – the module imagick WAS enabled and GD, which I HAD checked of course, but there was a conflict with PHP and imagick, which I could not see.

    So in case anyone else runs into this specific problem: I found out that it must be the hosting by deleting the whole website, installing a fresh wordpress and UM – and nothing else. The problem was still there.

    It did cost my thousands of nerves – and the project months! But this way I could get the hoster to (refusingly) look into it and find the problem!

    Best regards
    nici-

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey Everyone,

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. 🙂

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.