mirjan cocka
Published in : 2021-07-27

Add custom fields in user profile and display in Dashboard

Wordpress

Hello folks 😊

Im struggling for a solution. My client wants that users can upload videos and pdf in they profile, when they register and those need to be displayed in a custom user dashboard. I'm working with elementor Pro and ACF.

Now I can add those fields, as file upload through ACF, problem is how to display them in Dashboard. I'm not expert in php, mabe this can be easy but I didn't find a solution. I want basicly video to be embed in dashboard, and a button to download pdf report.

 

Thanks in advance

Mirjan

Comments

Mohamed Atef Date : 2021-07-27

Best answers

51

Best answers

51

Hi Mirjan, I am admin Mohamed Atef & I am so happy to see you with us, to add this all you need to do is set the location of the custom fields group to 
“Users role” like the screenshot below 
//prnt.sc/1grtn1s
and then you can edit the fields from the user profile like this screenshot

and that's all you need to control the fields from the dashboard 
let me know if you have any other questions 
Thanks

mirjan cocka Date : 2021-07-27

Hello Mohamed, thanks for your reply. 

 

Yes I manage to do it and it works fine, my problem is displaying them In front end, in a custom user dashboard. So when a user will log, it redirects in this custom dashboard when he will have a video embedded to watch and a button to download pdf. I tryed elementor dynamic conditions, but no luck. 

Mohamed Atef Date : 2021-07-28

I got what you mean, when you add the fields and they appear link this inside the profile of the users (check this image)
you will need to display them using get_field() like the code below, this function will allow you to get the fields and show them with a shortcode called [showUserCustomFields], you can change the fields names to fit your fields

<?php add_shortcode('showUserCustomFields', function(){$id = get_current_user_id();echo get_field('pdf', 'user_'.$id);echo "<br>";echo get_field('hello', 'user_'.$id);});?>

I believe that the only trick is the in the second parameter of the get_field it should be like ‘user_1' 1 is the user id so you can get the dynamic user id using $id = get_current_user_id(); then add it to the function like the code 

Let me know if you get what i mean 
Good luck

Mohamed Atef Date : 2021-07-28

Best answers

51

Best answers

51

And please replay to my comment so I get a notification 

mirjan cocka Date : 2021-07-28

thanks Mohamed.

it works

Mohamed Atef Date : 2021-07-28

you are so welcome :)

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Cpanel to Webmin migration 503 error
Publish date: 2021-08-12 | Comments: 4

Tag: Wordpress

creating custom gallery
Publish date: 2021-09-12 | Comments: 4

Tag: Wordpress

What is the best reference to the most used WordPress functions?
Publish date: 2022-02-09 | Comments: 2

Tag: Wordpress

Way to disable Block URLs for WordPress Posts
Publish date: 2022-02-26 | Comments: 2

Tag: Wordpress

[solved] undefined $post->ID in WP_Query()
Publish date: 2022-01-30 | Comments: 2

Tag: Wordpress

Issue with generating Thumbnails for PDF file format.
Publish date: 2022-02-26 | Comments: 1

Tag: Wordpress

A custom WordPress Login page and URL
Publish date: 2022-02-10 | Comments: 2

Tag: Wordpress