# Users to have specific «section/roles» like Vendors

**URL:** <https://community.hivepress.io/t/users-to-have-specific-section-roles-like-vendors/14779>\
**Category:** HivePress\
**Created:** [January 25, 2025, 3:06pm UTC](https://community.hivepress.io/t/users-to-have-specific-section-roles-like-vendors/14779 "2025-01-25T15:06:55Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![lolofora](https://community.hivepress.io/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@lolofora](https://community.hivepress.io/u/lolofora)\
**Post date:** [January 25, 2025, 11:42pm UTC](https://community.hivepress.io/t/users-to-have-specific-section-roles-like-vendors/14779/3 "2025-01-25T23:42:51Z")

</div>

Salut cotasson 🙂

Oh, okey, i see that we are working on the same type of project 🙂

In fact i was asking for that hoping to make things simplier.

I saw that post :

> [@Attribute as shortcode](https://community.hivepress.io/t/attribute-as-shortcode/14139):
>
> Hello, greetings from Spain. I will like to put an attribute as a shortcode so I can handle and use it in the listing template. I found this snippet but I can’t figured out where to put my shortcode in order to show the attribute in the frontend. I tried to put it in the shortcode block but with no results, by the way, my attribute field name is “precios”, so I put [precios] in the shortcode block, but the frontend shows the same “[precios]”, and should show a list of prices as the attribute v…

And like i shared here for a repeater and shortcode for the “Listing” Page/Template

> [@A working sample of a repeater?](https://community.hivepress.io/t/a-working-sample-of-a-repeater/14201/8):
>
> Salut Laurent, Good job ! Thank you for sharing with the community. I am sorry if I did not provide a more detailed explained, it was just 1 AM, and I was trying to get some sleep. But apparently you got my point. wink

I’d like to do the same but for users.

I am trying to create a custom “User” page and i need to retreive all attribute as shortcode.

But so far i just manage to do it but it shows the custom attribute of the loggued user.  
Not the user profil we are browsing : (and of course you dont see anything if you are not logged)

```auto
add_shortcode('show_user_attribute', function($atts) {
    // Allow manual override with user_id parameter
    $atts = shortcode_atts([
        'user_id' => null
    ], $atts);
    
    $user_id = null;
    
    // If specific user_id is provided in shortcode
    if ($atts['user_id']) {
        $user_id = intval($atts['user_id']);
    }
    // If on user profile page, get that user's ID
    elseif (is_singular('hp_user')) {
        $user_id = get_post_meta(get_the_ID(), 'hp_user', true);
    }
    // Otherwise get current logged-in user
    else {
        $user_id = get_current_user_id();
    }
    
    if (!$user_id) return '';
    
    return get_user_meta($user_id, 'hp_user_test_attribut', true);
});

```

which if far to be looking good anyways…

I was hoping to have something similar than :

```auto
$listing = \HivePress\Models\Listing::query()->get_by_id($listing_id);

```

Like :  
`$user = \HivePress\Models\USer::query()->get_by_id($user_id);`

But i cant get what i want :-/

Cheers too ! 🙂

lolo

---

_[View the full topic](https://community.hivepress.io/t/users-to-have-specific-section-roles-like-vendors/14779)._
