added company based filter and user meta

This commit is contained in:
2026-02-17 10:55:50 +01:00
parent 9ea053986d
commit f505687b16
5 changed files with 117 additions and 3 deletions

View File

@@ -15,8 +15,28 @@ $tags = get_terms([
'hide_empty' => false,
]);
?>
$users = get_users([
'meta_key' => 'company',
'meta_compare' => 'EXISTS',
]);
$companies = [];
foreach ($users as $user) {
$company = get_user_meta($user->ID, 'company', true);
if (!empty($company)) {
$companies[$company] = $company;
}
}
$authors = get_users([
'meta_key' => 'company',
'meta_value' => array_keys($companies) ?? [],
'meta_compare' => 'IN',
'fields' => 'ID',
]);
?>
<div class="pexpo-core-root pexpo-core-shell" id="pexpo-core-shell">
<div class="pexpo-core-topbar" id="pexpo-core-topbar">
<div class="pexpo-core-filterWrap" id="pexpo-core-filterWrap">
@@ -64,6 +84,12 @@ $tags = get_terms([
<option value="<?php echo esc_attr($tag->slug); ?>"><?php echo esc_html($tag->name); ?></option>
<?php endforeach; ?>
</select>
<label for="pexpo-core-companies"><?php echo esc_html__('Cégek', 'partnerexpo-core'); ?></label>
<select id="pexpo-core-companies" data-placeholder="<?php echo esc_attr__('Cégek kiválasztása', 'partnerexpo-core'); ?>" data-search-text="<?php echo esc_attr__('Keresés...', 'partnerexpo-core'); ?>" multiple="multiple">
<?php foreach ($companies as $key => $company) : ?>
<option value="<?php echo esc_attr($key); ?>"><?php echo esc_html($company); ?></option>
<?php endforeach; ?>
</select>
<button id="pexpo-core-filterApply"><?php echo esc_html__('Alkalmaz', 'partnerexpo-core'); ?></button>
</div>
</div>