Wordpress Add Custom data tables in User Profile - Not Custom Field - wordpress

I am kind a new to wordpress and need guidance. But understand PHP.
I need to add custom tables with data ( Repeater fields is optional/ HTML field ) in User's profile. User Cannot edit those data ( read only )
Data will be manually added from Admin Dashboard > Users. I assume there should be a field in there for admin to add those data
Then, User can read it from their profile page / Data presented in user's profile.
Those data will be something like a set of 3 tabs with Transaction list and history.So each user has different data.
I had searched but all only show tutorials on adding custom Field in User Registration.
Assistance please. Thank You

You can use Advanced custom fields for this. What you do is that you add a field to users add/edit page with ACF. If you have frontend user profile page. You can get the data from this fields with the function get_field('my_custom_field', $userID)
If you don't have and frontend user profile page, and will let your users go thru the "backend" profile page you will need to add som functions that disables so an user can't edit those fields if you don't want the users to edit them. You can do that with the filter add_filter('acf/load_field', 'my_filter);
The rest how you do this should you be able to find on ACF documentation page.

Related

Display custom post types filter by ACF with current user

I would like to display my custom posts on frontend.
I made a back office for a mobile app, but I'd like to create access from frontend to display information from my back office. First, I try to display single content from a custom post. I need to filter these pages by a custom ACF field equal to my current user.
And I need to check if the user has the good role. I've already configured all my Custom posts, all my ACF fields, and custom roles. I made a specific plugin for my back office.
I would like to create specific shortcodes to display the differents single views and the different lists I'll will need for my back-office..
Custom option
Value
Custom posts name
page_clubs
ACF field related
administrators
Custom role
club_administrators, or club_members
User
Current

Is there a WordPress plugin or a php code to insert a table that user can manipulate the data in it

Right now I am using the ultimate member plugin to register users. But the company asked me to change the form and allow users to insert their education qualifications in a table when registering. Users need to have a button that has the ability to insert more rows (If they have more qualifications).
As far as I know, I can't use the Ultimate Member plugin for that. I searched for many table plugins but didn't find anything that can do this task. I once had done this using code. But I don't know how to apply it to this registration form. If anyone can figure out a way to embed the code to Ultimate member (to save that table data) or any plugin that can do this, please let me know soon as possible.
Updated Question
I have tried that shortcode and got confused as it ruined the page. Now I'm trying a PHP method to solve this problem.
Thank You
Well you have many options to solve this problem. What you are actually looking for is Custom Fields.
WordPress has the ability to allow post authors to assign custom fields to a post. This arbitrary extra information is known as metadata.
Now, custom fields can be created in 2 ways.
Either you write php code in a plugin/theme
Or you you install plugin which helps you build custom fields.
What you are actually looking for is to create Repeatable Field Groups. These are the field which can be replicated. As many as you want.
Some plugins which provide facility to add them in no particular order are:
Advanced Custom Fields - Repeater Field : https://www.advancedcustomfields.com/resources/repeater/
Toolset - Repetable Field Group : https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/
Metabox - Meta Box Group : https://metabox.io/plugins/meta-box-group/
They all will give you ability to create repeater fields.
Repeater field can be made for both users and posts or Custom Post Types(CPT). You need them for Users. I am not sure which one of them allows you to create repeater field for Users but you can check on there website.
PS : These are all paid plugins. (They may have free version of them but repeater field comes with PRO).
Once you have created a field for users you can use that field in your registration form.
UPDATED ANSWER
As the question author wants to add the field using PHP, the field can be added as so.
After looking at all the hooks available to the user by UM (Ultimate Member) plugin. I found two hook that can be used to add fields and save in the backend.
um_after_form : Some actions after register form fields.
add_action( 'um_after_form', 'my_after_form', 10, 1 );
function my_after_form( $args ) {
// add your repetable fields here.
}
um_after_save_registration_details : Action on user registration after save details. This runs after the form is submited and user is registered. Use this to save data inside the user database.
add_action( 'um_after_save_registration_details', 'my_after_save_registration_details', 10, 2 );
function my_after_save_registration_details( $user_id, $submitted ) {
// Save field here.
// You have user_id and submitted data, do your thing here.
}

ultimate member user meta fields in user edit

Does someone know if it's possible to edit the fields the ultimate member plugin stores as user meta data?
In users list I see a tab containing the info on these fields, but don't see this info in the user edit page, which impeeds the admin to edit such fields.
Thanks

Wordpress: Custom profile form not working in Ultimate member plugin

When I create a custom form for a custom user role using ultimate member plugin, it doesn't work. Only the default profile form works. Please what can be the problem. I need to create different profile forms for different types of users
The cause of this issue is that the original User page only contains the shortcode for the default profile form.
After you create all of your custom profile forms, and assign the relevant roles to each (Form Settings -> Disable Global Settings -> Select Role), you need to add the short codes of all your forms to the User page, just one after another.
UltimateMember will decide which of the forms to display depending on the user's role.
So on the view user page, add the shortcode for the custom form, in addition to the existing default profile form.
It's a bit weird to have multiple shortcodes but it will only show the one for that role.
Also make sure to assign a the Custom Role to the Custom Form, as stated by Michael Rodriguez

Create a contact form and display submissions as searchable directory

I want to create a directory that users can submit their data (name, email, phone) to and see a searchable directory. Ninja Forms was good for submitting data, but had no (free) option to display the data in a searchable format. I tried using Contact Form DB, but the displayed results weren't searchable.
The Gravity Forms plugin has an API that will allow you to access submitted data. Here is a similar query to your own:
https://wordpress.stackexchange.com/questions/82791/how-do-i-show-data-from-gravity-forms-in-my-template
That said, it would probably be just as easy (if not easier) to code this outside the WordPress framework. Create a new table in the database for user data, then create the corresponding form and PHP form handler to write the details to the table.
WordPress provides a class for explicitly accessing the database:
http://codex.wordpress.org/Class_Reference/wpdb
You would then simply add your search code into a page template. I hope this helps!

Resources