Home Forums WC Vendors Pro Support Vendor Approval Filter? Reply To: Vendor Approval Filter?


Thank you Anna. I tried use hooks but couldn’t figure it out, also I asked on stackoverflow too. I know it is custom work but maybe you guys know how to use right hook on this case.

Here is my custom function:

function create_submerchant($user_id) {

        $user_info = get_userdata($user_id);

        $store_country = 'TR';
        $store_name = $user_info ->pv_shop_name;
        $store_owner_name = $user_info ->_wcv_custom_settings_bankahesapadi;
        $store_owner_lastname = $user_info ->_wcv_custom_settings_bankahesapsoyadi; 
        $store_email = $user_info -> user_email;
        $store_address = $user_info ->_wcv_custom_settings_banka_adres;
        $store_iban = $user_info ->_wcv_custom_settings_bankaiban;
        $store_owner_id = $user_id;
        $store_owner_tc = $user_info ->_wcv_custom_settings_kimlikno;



And this is how I use my function under class-vendor-applicants.php:

public function user_row_actions_commit()
        if ( !empty( $_GET[ 'action' ] ) && !empty( $_GET[ 'user_id' ] ) ) {

            $wp_user_object = new WP_User( (int) $_GET[ 'user_id' ] );

            switch ( $_GET[ 'action' ] ) {
                case 'approve_vendor':
                    $role = 'vendor';
                    add_action( 'admin_notices', array( $this, 'approved' ) );
                    do_action( 'wcvendors_approve_vendor', $wp_user_object );
                    create_submerchant ($_GET[ 'user_id' ]);

                case 'deny_vendor':
                    $role = 'customer';
                    add_action( 'admin_notices', array( $this, 'denied' ) );
                    do_action( 'wcvendors_deny_vendor', $wp_user_object ); 

                    // code...

            $wp_user_object->set_role( $role );


But I don’t know how to bind my function with $wp_user_object’s user_id using hooks. As a summary, I am trying to call my function(using approved vendor’s id) when a vendor approved.

  • This reply was modified 6 years, 1 month ago by Yasa.
This website uses cookies to ensure you get the best experience on our website.