Skip Navigation

[Resolved] Auto change user roll based on values of of some Custom Post type.

This support ticket is created 2 years, 6 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 2 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2173957

I have a setup with custom post type that resembles a membership type setup.

The process and requirements:

A new user registers as a user with a user form that set the default role as "peg editor - pre-approval."
Once the user has registered on the WordPress platform, he is then rerouted to the "Add new editor" cred form. where he then completes a multi-step form, whet 4 steps there are two fields of interest.

section 1
The first field is a radio field with three options:
Individual memberships
Couple memberships
Student memberships
section 2
The second field directory entry that comes to play is also radio button field
The has only two options yes or no.
section 3
the third field is a status field.
with three options
Pre-Approval
Approved
Declined

Ok so now the challenge :
Once the user has been created his/her role is "per editor - preapproval"
Depending on the options above the editor must make a payment depending on his options.
We are now looking at creating some more rolls.
the rolls that will be is:

Peg - Student
Peg editor ( already )
and Peg Editor Executive

Now at this stage, the following must happen.
New member registers and does prelim profile.
In the prelim profile, they will make a selection of the above fields.

In section one they will select the level of membership they want.

In section one when they pick students they will be made role: Peg students.
Students can not be listed on the find an editor directory. that is why the directory entry is hidden from the student form.
then there is the option of individual or couple membership. They will have the option of selecting if they want to be listed or not in the directory. They will have the Peg editor role allocated to them.
Finally, you will have the option of being a PEG Editor executive when you select the single or couple membership and you select the directory entry as yes.

When the admin approves the application they allocate a PEG registration number that is unique. So now the admin opens the approval form, click on the correct candidate that they need to update, and a final screen shows up with the candidate's profile. If approved admin must a the add"PEG membership" number and change the profile status from pre-approved to approved. At this stage when the form update it must change the user role to either Peg-student, peg editor and PEG Editor executive depending on the status of the three variable selections made above.

Is this possible and if so how would I go about doing this.

#2174633

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I would like to know are you using Toolset Forms commerce?

Toolset forms offers certain hooks:
=> https://toolset.com/documentation/programmer-reference/cred-commerce-api/

There will be obvious way to change the role either using Toolset hook or WordPress native hook but you will have to identify where at what action you will be able to utilize what hook.

We need to divide this whole big concept in small parts and accordingly identify the resolution.

#2174757

Hi Minesh,

No, we are just using the standard forms plugin.

#2174797

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You said:

Once the user has been created his/her role is "per editor - preapproval"
Depending on the options above the editor must make a payment depending on his options.

So - how exactly you are taking payments using only WooCommerce?

#2174895

Hi Minesh,

Sorry for the confusion. The payment is a manual process. The editor registers to become a user, (user forms) then he completes a preliminary profile with this link
hidden link

The final form on that page includes the 3 fields identified in the first post on this ticket. That will determine the fees payable. After the above form updates the editor will be rerouted to a form created with formidable where they will be advised of the amount payable. They will then make either an eft or direct payment in the client's bank and forward proof of payment to our client. The client will then open a screen where they will approve the profile and notify the editor that they can then proceed with completing the profile. It is at this stage that the editor's role must then change.

The client opted not to go for an online payment system

#2174905

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you are dealing with the Toolset Forms then Toolset forms offers the hook: cred_save_data
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

Please note that the hook "cred_save_data" will be in action when you submit the form.

Please check the following related ticket:
=> https://toolset.com/forums/topic/is-it-possible-to-change-user-role-using-front-end-form/#post-1503479

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