I’m building an online store using WordPress. I want to allow users to register on my site as either a Vendor or a Customer. If they register as a Customer, they’ll get a basic account where they can shop, save items to a cart or wish list, and can check out. If they register as a Vendor, they’ll have access to create their own items for sale on the site (similar to Etsy) and I’m allowing this by using the EDD FES Plugin.
Currently, I have things set up fine to allow new users to register, but it only allows them to register as a Vendor. I don’t even know what I would do to make this work so that the User Page where the Vendor can set up their store items would show differently for a person who happens to be a Customer. Currently, on the User Page I have just placed the [fes_vendor_dashboard]
tag that automatically adds the dashboard for me.
Any help, advice, suggested plugins, etc. are all welcome.
Thank you in advance!
I dont know if you’ve seen Justin Tadlock’s excellent Members plugin but if you’re working with custom user roles it’s well worth checking out.
As for programatically setting a user role you can just take the user object and use the
set_role()
function to change their role to whatever you want as long as that role has been defined. For example lets say you have a select box with the name of ‘user_role’ with 2 options of ‘vendor’ and ‘customer’ you could simply do the following…Hope that helps
Dan