| | |
| | | <?php |
| | | namespace JVBase\importers; |
| | | |
| | | use Exception; |
| | | use WP_Error; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | |
| | | // Commit transaction |
| | | $this->wpdb->query('COMMIT'); |
| | | |
| | | } catch (\Exception $e) { |
| | | } catch (Exception $e) { |
| | | // Rollback on error |
| | | $this->wpdb->query('ROLLBACK'); |
| | | fclose($handle); |
| | |
| | | } |
| | | |
| | | // Get the role from options with proper fallback |
| | | $role = $options['default_role'] ?? get_option(BASE . 'client_import_role', JVB_USER); |
| | | $role = $options['default_role'] ?? get_option(BASE . 'client_import_role', BASE.'client'); |
| | | |
| | | // Ensure role exists, fallback to JVB_USER if not |
| | | // Ensure role exists |
| | | if (!get_role($role)) { |
| | | $role = JVB_USER; |
| | | return new WP_Error('invalid_role', 'Invalid role'); |
| | | } |
| | | |
| | | // Create user |