Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save champsupertramp/6b73195db24eb6650a23b4440b4287c3 to your computer and use it in GitHub Desktop.
Save champsupertramp/6b73195db24eb6650a23b4440b4287c3 to your computer and use it in GitHub Desktop.
Ultimate Member - Allow everyone to upload profile and cover photos on front-end pages.
/**
* Ultimate Member - Customization
* Description: Allow everyone to upload profile and cover photos on front-end pages.
*/
add_filter("um_user_pre_updating_files_array","um_custom_user_pre_updating_files_array", 10, 1);
function um_custom_user_pre_updating_files_array( $arr_files ){
if( is_array( $arr_files ) ){
foreach( $arr_files as $key => $details ){
if( $key == "userphoto" ){
unset( $arr_files[ $key ] );
$arr_files[ "profile_photo" ] = $details;
}
}
}
return $arr_files;
}
add_filter("um_allow_frontend_image_uploads","um_custom_allow_frontend_image_uploads",10, 3);
function um_custom_allow_frontend_image_uploads( $allowed, $user_id, $key ){
if( $key == "profile_photo" ){
return true;
}
return $allowed; // false
}
@AzmayenFayek
Copy link

During upload it’s showing "the image is too large" but actually not a large image at all. I tried many sizes,resulations,formates.
Please help me to fix it.
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment