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

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.
}

Related

In JetEngine Forms, where are the submissions / entries stored?

In WordPress JetEngine Forms you can create forms. When a user submits it, where does the data go? In GravityForms, you can edit a form and see a list of all submissions so far. Does JetEngine honestly lack that? Can't find it in the docs; can't find them in the DB either.
As a workaround you can auto-create a post of the (JetEngine) custom post type (i.e.) "form submission".
First set up the custom post type. Make sure to exclude it from the search. You can set it to private too, but then it doesn't appear in the forms dropdown anymore where we're gonna need it. (You can make the CPT public first, then set up the action, and make the CPT private afterwards. The association in the action's dropdown still stands, albeit now the dropdown value is empty … Seems a bit buggy and dangerous to do it that way)
Create a Meta Field for each form field.
Then edit the form and, next to "Send mail" or whatever your primary submit action is, add another action which is to "Insert/Update Post". Choose the CPT and map the form fields to the meta fields.
It's a bit cumbersome because of this redundant field management … But it's doable.

WooCommerce - Custom User Registration Fields

I was following this blog post https://www.themelocation.com/how-to-add-custom-fields-to-user-registration-form-in-woocommerce/ to learn about creating custom user fields in Woo (for registration).
The post above worked, and I was able to see new fields during registration, but I had two questions:
How can I get these fields to appear when I'm editing a user in wp-admin? I didn't notice them rendering on the edit user page.
Right now Woo (by default) lets you just register with an e-mail. I wanted to also use a first name and last name (my custom fields), but this is already a field on the users in WordPress, so I don't want to duplicate fields. Is there a way to somehow pull in/use/associate an existing field (such as name) during the Woo registration?
Thanks so much for any help/guidance you all can give me.
1 You can use this plugin for display your custom fields in the admin view.
2 In your template HTML file, find the form, and use the default id & name tag : "Firstname" / "Lastname" ...ext

Wordpress custom post type structure

i am building a wordpress website for a client. i need to build 1 template type of page with a list of fields that the client can fill in to populate the page. so lets say i build a template page called Person Template. On it i have an empty picture placeholder on the left and an empty Name Field below that. On the right i have an empty "persons phone number" and "Persons email" field.
what i need to create somehow is a system that the client can enter these 4 items into wp-admin somewhere and save that as a new Person. Then they can repeat and save another Person until they have created say 100 Person pages.
How do I do this? I tried building a Custom Post Type called Person CPT. I have built a Page called Person Template. I have built some "Person CPT" posts and put them on a page but i dont know how to create the Entry Fields page for my client to use.
You're correct that you'll need to use a custom post type. To add the fields you have two options:
Add the fields using add_meta_box(). You'll then need to save this data as post meta. Then in your single-person.php template you would retrieve the meta using get_post_meta(). It's a tad cumbersome, as you need to write the markup for the meta box, hook it into an action to add it to the admin page, and verify the content before it's saved. Here's an article that walks you through it
Alternatively get yourself the Advanced Custom Fields plugin: it makes adding additional fields very quick and easy. I use it all the time.

Capability required to view Advanced Custom Fields in WordPress

I asked this question over on the WordPress StackExchange but was told it was off-topic for there. I hope it is correct to ask it here instead.
A client has asked that I setup the Contributor role in WordPress so that it can only view/edit/delete their own posts from a CPT called 'members'. I have done this using Justin Tadlock's Members plugin + a small snippet of code since they only want the Contributor's to be able to see their own posts & not others (even if they can't edit them).
Everything is working well except for Advanced Custom Fields. The client is using this to provide extra fields on the 'members' CPT, but unless I give the Contributor role the 'edit_others' capability they are unable to see the fields created by ACF.
Is this an issue with ACF, or with WordPress? I am still fairly new to Roles & Caps and I cannot seem to understand how to change this. If possible I would like the ACF fields to be visible on the 'edit_members' capability.
Add the 'edit_others_posts' to your user role.
I had same problem, and after some trying out different combinations, have found that this capability needs to be enabled.
The problem is not in roles or capabilities, problem is how you limit the edit-posts dashboard for non-administrators. Your if-statement should not be performed on edit-post page, only at post listing page (for example, if you use pre_get_posts to restrict posts editing for admins only, then you must not run this pre_get_posts function at posts.php page).
Also example from ACF support forum.
This issue has been posted a long time ago, but I believe there is still someone facing it at the moment. So I would like to make it easy to understand.
First of all, we have to separate it into two parts.
First, the relationship between user, role, and capability. Let's say, each user has a roles, and each role has capabilities. It is one-to-many relation from top down.
Second, custom post type(CPT), advanced custom field plugin (ACF) and ACF extension plugin.
Each custom post type can be done for a specific capability and all fields under the custom post type has been done by using ACF.
Lastly, not all fields need to appear on every user who has the role that included this capability. Some field need to be appear for just for some specific role which has this capability included. This is where ACF extended plugin step in. It is sound complicate isn't it? Let have a look the chart below.
With acf_permission, you can be able to specific the role for be able to see the field like below.
`[instruction_placement] => label
[hide_on_screen] =>
...
[acfe_permissions] => Array
(
[0] => administrator
[1] => editor
)
...`
This might not fully answer the question but hope it will help to clear how does it work together.
https://www.acf-extended.com/features/field-groups/permissions

Restrict editing some post custom fields - wordpress

In my website there is a master admin and some editors.
Each editor can edit and fill some custom fields too (meta boxes added by Meta Box plugin APIs) but I need to restrict editing and showing some custom fields to that group but didn't found anything related to this topic.
any help will be appreciated.
There are two free plugins that will work together to accomplish this, and more...
The first plugin is Advanced Custom Fields: http://wordpress.org/plugins/advanced-custom-fields/
Advanced Custom Fields lets you create and assign groups of custom fields to specific user roles or post types.
The second plugin is the Members plugin which extends and allows customization/creation of user roles: http://wordpress.org/plugins/members/ .
How it works. Use the Members plugin to create a new user role with the same (or whatever you like) permissions as Editor, call them 'Editors Plus'. Then use Advanced Custom Fields to create a custom field group that only 'Editors Plus' can access. IE: Show this field group if: 'User', 'is equal to', 'Editor Plus'. All of it happens via easy GUIs.
Register a new role with help of this link:
http://codex.wordpress.org/Function_Reference/add_role
and then apply authentication to this whatever you want.
thanks.

Resources