Skip Navigation

[Resolved] Import Clients as Wp Users and provide them with personal dashboard

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1390319

Hello,
I am building a new version of my company’s website, and I need guidance on what’s the best way to approach my problem.
My company is a craftsmen association where companies pay a membership fee and they get access to a variety of services (accountancy services, payroll services, political assistance, legal assistance and so on).

Access to these services are granted provided that the annual fee is paid and active.

Here is what I would like to achieve: I want to provide every client with access to a personal dashboard built based on the client's activity, personal informations and interests as well as a restricted area consisting of members only news and events. Eventually, I would like to give them the opportunity to pay or renew the membership fee directly from the website.

I already have an initial csv file with all the clients' data exported from the management software that we use everyday and I would use wp-all-import to import the data into wordpress, so that every client would then be a wordpress user with the role of “associate”.
The CSV file contains info like the client's business area, vat number, address, number of employees and so on.

And here’s when I get confused on what is the best way to continue and I need your advice.

a) Should I create USER custom fields and import the csv data into the wordpress user? I don’t really like this solution just because wordpress users will consist of associates as well as other users (administrator, employees of my company that will manage the website) for which I won’t need to add all those informations.
b) Should I create an ASSOCIATE cpt and add the infos as custom fields to that cpt? But then how do I bind WORDPRESS USER and ASSOCIATE record? Is there a way to do that automatically within the import procedure? it’s more than 3000 associates and doing it one by one is out of the question.
Is there another way that I haven’t thought of?
Thank you for your help in advance.

#1390683
roles.png

a) Should I create USER custom fields and import the csv data into the wordpress user? I don’t really like this solution just because wordpress users will consist of associates as well as other users (administrator, employees of my company that will manage the website) for which I won’t need to add all those informations.
See the screenshot roles.png. When you create custom User fields with Types, you can choose specific User roles for each field group. The field group will only appear in wp-admin for User profiles with those specific User roles, so the extra fields won't be cluttering up other User profiles where they are not needed. It is not necessary to add all that information for other roles.

b) Should I create an ASSOCIATE cpt and add the infos as custom fields to that cpt? But then how do I bind WORDPRESS USER and ASSOCIATE record? Is there a way to do that automatically within the import procedure?
This approach is actually very powerful because it allows you to create custom searches for Users, as well as post relationships for Users. Normally these two things are not possible, but the use of a proxy post type provides these capabilities. Basically one Associate post is created for each User, and that User is set to be the author of their own Associate post. The approach is explained in this article: https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

It's possible to programmatically create those Associate posts when a User is registered using some custom code, or you can require your Users to create that Associate post using a Form. The Form can be something simple like one button that says "Set up my profile". I can provide additional information about that if you'd like.

However, you must still combine this proxy post type approach with Access controls based on custom User roles if you eventually want to restrict front-end access to specific content based on Membership status. More information about charging for membership: https://toolset.com/documentation/user-guides/charging-payments-with-cred-to-register-users/

#1391249

It seems there was a problem assigning this ticket to a supporter, so I'm updating the ticket to be sure you saw my previous response. Please let me know your thoughts and we can go from there. Thank you!

#1391251

Hello Christian, thanks for your answer!
I guess that due to its complexity (at least for me!) this problem must be approached one step at a time.
if you think that solution n. 2 is the way to go because more powerful and flexible I'll be more than glad to get all the infos on how to proceed. I'll first read the documentation you provided and then I will gladly follow whatever procedure you see fit.
In order to do this I think it'd be better if I first set up all the needed CPTs, with all the necessary custom fields. Can we keep this ticket open until then? Do you need access to the test website?

#1391451

Okay sure, please provide login credentials in the private reply fields here so I can collaborate in wp-admin.

#1392515

It would make sense to import the Users first, then you can set the post author of the Aziende CPT using those new User IDs. From what I understand about WP All Import, you need to purchase the extra User Import add-on to be able to import User profiles: http://www.wpallimport.com/add-ons/user-import/
I'm not sure if their User import system can create logins and passwords automatically, or if you must create those manually in the CSV before the import. That's more of a question for the WP All Import support team, since I'm not an expert with their software.

Then after importing the Users, you'll add the User IDs generated for each User to the post_author field of the Aziende post CSV file. Now when you import the Aziende posts from the CSV, the Aziende posts will have the appropriate post author.

#1392527

I have purchased the full package and I have wp-all-import user add-ons, so it's all a matter of actually checking if user.id and pwd can be automatically generated or not. Ok, let me complete this step first, I will use a test csv file with just 10 companies and then I'll get back to you, so we can proceed with the next step. Ok?

#1392627

Ok Christian, I have created a test csv file with only 37 entries. I automatically generated a password with excel and used the email address for both username and (of course) email address and imported users into wordpress. I gave each user the role of AZIENDA (associate). What's next step?

#1392771

If you have not already set up the Aziende custom post type in Types, that should be next. Add any custom fields you want to store here, like the Aziende's location or birthdate or home address or whatever information you would want to store with the User profile. All of those fields will exist as custom fields on the Aziende post type, not the Aziende User.

Next you'll need to import Aziende posts from a CSV...one post for each Aziende-role User. I can give you some general guidance, and if you get stuck and need more specifics let me know.

In the CSV file for these Aziende posts, you can place the User's name or login to map to the post title field during import. Since the login is unique, you could use that as the post slug. You can add all the custom fields in the CSV file as well, and map those to the corresponding Types field values during import. You should also add a column and insert the User ID of each corresponding Aziende User. This is probably the most challenging part, because you'll need to be sure the IDs match up exactly to their corresponding Aziende post. The User ID column should be mapped to the post author field during the import process.

If all goes successfully, you should have one Aziende post created for each Aziende role User, and all the custom fields should be imported correctly to these posts. The User should be the author of their own Aziende post, and each User should be the author of only one Aziende post.

Let me know how it goes.

#1393117

Christian, everything went by the numbers at first attempt!
WPALLIMPORT has an option to map the AUTHOR field to the info you're importing, so it was enough for me to use EMAIL field (which was the unique data I had used to create users "username") as the binding field, and I was able to create 37 AZIENDE posts, each with its own author corresponding to the matching USER.
Next step is to use Toolset Access to limit edit capabilities for each user ->azienda.
Then I will have to solve the membership problem.
I would like to try this on my own first, could I keep this ticket open so that I can ask for help if I am stuck? If everything goes ok, instead, I will close it myself as soon as I am ready. This will prevent me to have to open another ticket and risking being assigned to another staff member and I'd have to explain everything all over again.
Can we do that?

#1393303

Yes of course, I will mark the ticket as pending an update from you. Feel free to post back if you run into an issue and we can continue working on it.

#1394853

Hi Christian,
After thinking about the whole project I decided I won't add membership options on this website. In order to close this ticket I would only complete the USER-AZIENDA management, so this is what I would like to achieve:
A) I would like to give new users the ability to register AND then automatically create their page, and this is what I came up with: in the USER CREATION FORM I set the redirection page to the AZIENDA PROFILE CREATION page, where I have the AZIENDA cpt creation form. Is there a more efficient way?
B) Upon logging in, I would like for Associate users to be redirected either to their page or to home page with a modified menu with a link only accessible to them that says "edit your page". They shouldn't be able to access the back-end.
Since this dashboard is a simple presentation of the company, I included a repeating field to post product images. Is there a way to limit to, say, 5 images? Is there a way to allow only certain extensions?
Then I have a question about taxonomy custom fields, but I am not sure if I have to open another ticket for that.

#1398977

A) I would like to give new users the ability to register AND then automatically create their page, and this is what I came up with: in the USER CREATION FORM I set the redirection page to the AZIENDA PROFILE CREATION page, where I have the AZIENDA cpt creation form. Is there a more efficient way?
This seems okay to me, as long as it's easy for the User to get back to the Azienda Profile Creation page if they leave the site before creating their profile.

B) Upon logging in, I would like for Associate users to be redirected either to their page or to home page with a modified menu with a link only accessible to them that says "edit your page". They shouldn't be able to access the back-end.
If you have a custom login page, the Views login form shortcode can specify a redirection URL:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-login-form

Check this ticket for more information about blocking backend access for a specific user role:
https://toolset.com/forums/topic/block-completely-backend-access-to-a-user-role/

#1401437

I am sorry it took me a while to answer but I am fighting with a bad flu. Thank you as always for being so nice and helpful, Chris. I understand I cannot keep this ticket open forever so I will open a similar one in case your suggestions in your latest message don't help me solve the last problem I have.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.