Captainlonate
Captainlonate

Reputation: 5008

Wordpress - Proper way to manage custom users

I have a site in Wordpress.

The functionality I need is such that, I can create 'users' of the site. These users have no purpose editing the Wordpress site in any way, and don't need to know we're even using the wordpress platform.

These users need to be able to edit their contact info and upload/view/swap out their own resume, using a page that I will build for them (not the wp-admin dashboard in any way). This resume will be PDFs and WordDocs.

At first I thought I'd just use the built in Wordpress Users and Roles that Wordpress offers. However, I'm not sure how I would attach resumes to that user, and let that user edit their own resume. I know I can use the 'user_contactmethods' hook to attach basic fields. However, I'd be trying to attach a link to a file that Wordpress hosts, and would need to be able to replace that file on a whim, in php. Also, my goal is to prevent them from ever using the Wordpress dashboard or editing tools.

Next, I thought I could create a custom post type for a 'SiteUser'. That would make it easy to manage a PDF/WordDoc attached to that post type. Also, that user wouldn't have any way to access the Wordpress stuff. Before I do that though, I wanted to ask on here if this really is the right way to do this.

This solution feels hacky.

Can I get some proposed solutions to this problem that could be perceived as 'the proper way'?

Thanks

Upvotes: 0

Views: 68

Answers (1)

vico
vico

Reputation: 2142

Here is a rough idea of what you are looking to do.

Step 1

Create the user role for these new users

Step 2

Set the permission for them and disable backend access and redirect all access of those roles to a custom page /account/

Step 3

Use Advance custom fields plugin to create some custom fields on the user meta. (text, file, image)

Step 4

Apply some login logic/form and Link to a /account/edit-info/ custom page with the acf frontend form. https://www.advancedcustomfields.com/resources/create-a-front-end-form/

Step 5

Use these info to display somewhere on the /account/ page

Optional

Using gravity forms instead to manage user data entry gives better control but requires more coding, and a better user experience.

Front-end Admin Steps

  1. Repeat Step 1-2

  2. Loop site user and list them and their custom field files Have a button that opens a Gravity form with the user ID text field pre-populated and hidden, and have a file uploader element.

  3. Add backend hooks after validation directly replace the user meta containing the file path or ID (however you choice to store it in Advance custom fields)

Upvotes: 2

Related Questions