Support Forum
Support › MB User Profile › Font end image upload input not showingResolved
Hello Meta Box Team,
I have a little issue currently. We have created additional meta data for the User Profiles and created the forms on the front end to update these using the shortcode:
[mb_user_profile_info id="profile" submit_button="Submit" confirmation="Your information has been successfully submitted. Thank you."]
This works wonderfully, although the input to upload images to the profiles does not show up. The description and the label show and there seems to be a hidden text field input:
<input class="rwmb-image_upload" name="cportfolio_img" type="" value="5463,5462" data-options="{"maxFileSize":0,"mimeType":"image","maxFiles":2,"forceDelete":false,"maxStatus":true,"imageSize":"thumbnail"}">
Ideally, I would like to have the drag and drop field displayed on this page - but a standard upload button would also work.
Do you have any advise?
Many thanks
Harrison
Hi Harrison,
This problem is the same as in MB Frontend Submission. To understand and resolve it, please read this docs.
Hi Anh,
Thanks for the reply, I did see that post - we following to our functions.php:
function mb_allow_subscriber_uploads() {
if ( is_admin() ) {
return;
}
// Replace 'subscriber' with the required role to update, can also be contributor.
$subscriber = get_role( 'subscriber' );
$subscriber->add_cap( 'upload_files' );
$subscribers = get_role( 'customer' );
$subscribers->add_cap( 'upload_files' );
$subscribered = get_role( 'administrator' );
$subscribered->add_cap( 'upload_files' );
}
add_action( 'init', 'mb_allow_subscriber_uploads' );
Sadly, this made no difference at all.
I not sure if the input buttons will be hidden if the user doesnt have permissions to upload - but we dont have them - just the labels.
Thank you again for your advice.
Kind regards
Harrison
Hi Anh,
Sorry to come back to you on this, but I was wondering if you had any advice on this issue?
Kind regards
Harrison
Hi Anh,
Thanks for the reply, I did see that post - we following to our functions.php:
function mb_allow_subscriber_uploads() {
if ( is_admin() ) {
return;
}
// Replace 'subscriber' with the required role to update, can also be contributor.
$subscriber = get_role( 'subscriber' );
$subscriber->add_cap( 'upload_files' );
$subscribers = get_role( 'customer' );
$subscribers->add_cap( 'upload_files' );
$subscribered = get_role( 'administrator' );
$subscribered->add_cap( 'upload_files' );
}
add_action( 'init', 'mb_allow_subscriber_uploads' );
Sadly, this made no difference at all.
I not sure if the input buttons will be hidden if the user doesnt have permissions to upload - but we dont have them - just the labels.
Thank you again for your advice.
Kind regards
Harrison
Hi Anh,
Do you have any advice for the issue below?
We have looked at editing the user permissions in the functions file, however, even as a new user you cannot see any input buttons.
Kind regards
Harrison
Hi Anh,
Sorry to come back to you on this, but I was wondering if you had any advice on this issue?
Kind regards
Harrison
Hi Anh,
Thanks for the reply, I did see that post - we following to our functions.php:
function mb_allow_subscriber_uploads() {
if ( is_admin() ) {
return;
}
// Replace 'subscriber' with the required role to update, can also be contributor.
$subscriber = get_role( 'subscriber' );
$subscriber->add_cap( 'upload_files' );
$subscribers = get_role( 'customer' );
$subscribers->add_cap( 'upload_files' );
$subscribered = get_role( 'administrator' );
$subscribered->add_cap( 'upload_files' );
}
add_action( 'init', 'mb_allow_subscriber_uploads' );
Sadly, this made no difference at all.
I not sure if the input buttons will be hidden if the user doesnt have permissions to upload - but we dont have them - just the labels.
Thank you again for your advice.
Kind regards
Harrison
Hi Harrison,
Can you inspect the HTML of the field to see if the button is outputted? And please check the console if there's any error.
Hi Anh,
Thanks for picking this up.
There are no errors showing in the Console.
So far as I can see there is no button being created.
The HTML is below, many thanks again.
Kind regards
Harrison
https://ghostbin.com/paste/grant/fwbngm5k9khztpmoar238sfnsxmnfcvc/accept
Hi Harrison,
Can you please re-upload your code? I see only a text "Hey" in the link.
Hi Anh,
I have tried a different code sharing platform.
Do let me know if this works:
https://codeshare.io/an3ygM
Kind regards
Harrison
Hi Harrison,
Sorry for the delay.
The HTML output looks correct. The upload button is rendered by JavaScript. In your code, looks like the JavaScript doesn't run.
Would you mind sending me the admin account to check it? Please send in the contact form.