Skip Navigation

[Resolved] registration as vendor

This support ticket is created 6 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 14 replies, has 3 voices.

Last updated by papin.o 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#912938
vendor list.png

Hi,
Thank you for your time and support.
I have created a CRED registration form with vendor role.
The issue is that anyone who register, become vendor in wordpress but not in vendor plugin. they are not listed in woocommerce vendor.
please see Screenshot

#912985

Well, that is a taxonomy while Forms create users, I am not sure how that should relate.

If the plugin you use (vendors) somehow creates a Taxonomy for each user, it's up to that plugin to handle that and create the taxonomy, which I assume, they do only in the backend and not on general user interaction like you do with Forms.

To solve this, you have to find out:
- what is that Screen you show me? Is it a Taxonomy with terms just like Categories, or is this a Screen that actually lists Users?
- According that, you can then hook into Toolset Forms' API and eventually, for example add a Term in that Taxonomy matching your user so you can use that later in the 3rd Party Plugin's features.

This would for example be done on cred_save_data() with wp_insert_term().
If course this is only valid if that screen you show me lists "natively" set up Taxonomies (as Toolset Types does, for example)
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
https://developer.wordpress.org/reference/functions/wp_insert_term/

#913009

Hi Beda, the screenshot is the list of vendors that supposed to show users after they register to the website. i am using woocommerce product vendor

#913014

users are assigned to vendor role, but they are not listed under vendor list, in order forthe plugin to calculate the comissions etc...

#913250

Hello,

It needs custom codes, see comment of Beda:
https://toolset.com/forums/topic/registration-as-vendor/#post-912985

If you still need assistance for it, please provide a test site with same problem, fill below private detail box with login details and FTP access, also point out the problem page URL, I need a live website to test and debug, thanks

#916141

1) I created a custom post type named "Profile" that shows user's public profile and url is :
exemple.com/profile/username
("username" is submited in registration form)

2) registration form create users and assign them vendor role but they are not listed as vendor in "woocommerce product vendor" (mentioned previously)

My goals:

1) I want to create a custom code that automaticly create user profile as soon as there is submition (registration ). and post title should eb username provided in the registration form.
I never did a webhook. So I am a little bit lost.
Here is my custom code:

add_action('cred_submit_complete_8049', 'func_profile',10,2);
function func_profile($post_id,$form_data) {
if ($form_data['id']==8049) {
$title= 'username';
$args = array('ID' => $post_id, 'post_title' => $title);
wp_update_post($args);
}
}

2) I want another custom code or another instance that will also add users to that vendor list of woocommerce product vendor in order to calculate commissions etc...

3) one more thing: Is it possible to create sms notification for users with twilio whenever they receive messages (I am using toolset messaging system).

4) I want to create a rating system or use plugin combine with toolset that allows to rate and comments user's products and list the average rating and comments to their profiles.

Thank you

#916176

We can handle the questions one by one,

Q1) and Q2) As I mentioned above, it needs custom codes, here are some similar thread for your reference.
create a new post after submit the Toolset form
https://toolset.com/forums/topic/automatic-post-creation-on-registration/#post-555275
and insert a new term after submit the Toolset form
https://toolset.com/es/forums/topic/cuando-escribes-en-un-formulario-cred-duplicar-informacion-en-una-taxonomia/#post-556438

Q3) No, Toolst form only supports Email notification, does not support SMS notification, but you might try to use custom codes to achieve it, same as above, you can use action hook "cred_save_data" to send the SMS notification with custom PHP codes, I suggest you try to check it with our experienced contractors
https://toolset.com/contractors/

Q4) Same as above, there isn't such a built-in feature, in my opinion, you just need to try some other rating plugin, for example:
https://wordpress.org/plugins/search/rating/

#916377

Hi Guys,
Thank you for your answer and references you provided.
It was really helpfull.

Q1) FIXED with custom code below:

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
if ($form_data['id']==8049)
{
// Create post object
$my_post = array(
'post_title' => $_POST['user_login'],
'post_content' => '',
'post_status' => 'publish',
'post_author' => $post_id,
'post_type' => 'profile'
);

// Insert the post into the database
wp_insert_post( $my_post );
}
}

Q2) NOT WORKING : any idea of what prevent the user from being registered as vendor?

here is my custom code
add_action( 'cred_save_data_8049', 'prefix_cred_taxonomy', 10, 2 );
function prefix_cred_taxonomy( $post_id, $form_data ) {
$profile = get_the_title( $post_id );
wp_insert_term( $profile, 'vendor' );
}

Q3) I will try contractors as suggested

Q4) i am using a plugin hidden link
is it possible to combine it with toolset in order to create an average ratings belong tpost author ?

thanks again

#916431

Q2) As I mentioned above it is a custom PHP codes problem, I am not sure where is the problem, see my first answer:
https://toolset.com/forums/topic/registration-as-vendor/#post-913250
If you still need assistance for it, please provide a test site with same problem, fill below private detail box with login details and FTP access, also point out the problem page URL, I need a live website to test and debug, thanks

Q4) You can try it, and feedback if there is any compatibility problem, I have searched it in our forum, and found this ticket
https://toolset.com/forums/topic/you-can-query-the-table-_postmeta/
For your reference.

#916465

Hi Luo, Thank you for your answers,
everything works, just the code I have in Q2) is still not working and i don't know why.
anyway thank you for your help

#916467

OK, I have enabled the private message box again, please provide the login details and FTP access, also point out the problem page URL and CRED form URL. thanks

#916600

The taxonomy "vendor" slug should be "wcpv_product_vendors", see the URL you mentioned above:

the vendor plugin is ( woocommerce product vendor)
the url is
hidden link

so you will need to modify the codes from:

wp_insert_term( $profile, 'vendor' );

To:

wp_insert_term( $profile, 'wcpv_product_vendors' );

See similar thread:
https://stackoverflow.com/questions/39747713/woocommerce-product-vendors-update-taxonomy-custom-fields

#916619

Hi Luo , thank you for your help.
would you like to look at mycode? it's not workiing.

add_action( 'cred_save_data_8049', 'prefix_cred_taxonomy', 10, 2 );
function prefix_cred_taxonomy( $post_id, $form_data ) {
$profile = get_the_title( $post_id );
wp_insert_term( $profile, 'wcpv_product_vendors' );
}

#916679

Thanks for the details, the Toolset form ID 8049 is form a for creating wordpress users, so this line won't work:

$profile = get_the_title( $post_id );

You can replace it with this:

$user_obj = get_user_by('id', $post_id );
$profile = $user_obj->user_login;

More help:
https://developer.wordpress.org/reference/functions/get_user_by/

#916734

do you have any idea suggestion on how to eliminate vendor frontend url or just redirect it to profile url?
Anyway thank you very much for your help