0

Can you please help me i don't know code, but what i know is where are the data i need to get from Dokan PRo and is: from dokan_profile_settings, the data are inside of Meta-Value, as progress and looks like this: progress";i:60; but i don't know how retrive this value to make a list of all vendors with this progress value.

i have this code, but do not work

i have this code, but do not work

add_shortcode('display_vendors', 'display_vendors_with_progress');
function display_vendors_with_progress() {
    $vendors = get_users(array('role' => 'seller'));
    $output = '<ul>';
    
    foreach ($vendors as $vendor) {
        $store_info = dokan_get_store_info($vendor->ID);
        $progress = get_vendor_progress($vendor->ID);
        
        $output .= '<li>';
        $output .= '<a href="' . dokan_get_store_url($vendor->ID) . '">' . $vendor->display_name . '</a>';
        $output .= ' | Progress: ' . $progress . '%';
        $output .= '</li>';
    }
    
    $output .= '</ul>';
    
    return $output;
}

function get_vendor_progress($vendor_id) {
    $meta_value = get_user_meta($vendor_id, 'dokan_profile_settings', true);
    if (isset($meta_value['progress'])) {
        $progress_serialized = $meta_value['progress'];
        $progress = unserialize($progress_serialized);
        if (is_array($progress) && isset($progress['progress'])) {
            return $progress['progress'];
        }
    }
    return 'N/A';
}

I need to retrive this value to make a list of all vendors with this progress value.

0 Answers0