<?php
if (!defined('ABSPATH')) exit;

if (!function_exists('stakmv_is_vendor')) {
function stakmv_is_vendor($user_id = null) {
    $user_id = $user_id ?: get_current_user_id();
    $user = get_user_by('id', $user_id);

    if (!$user) return false;

    return user_can($user, 'edit_products') || in_array('author', $user->roles, true);
}
}
