• Resolved sslv

    (@sslv)


    In the website I’m working on, I’m using Geodirectory to create Shops and Events!

    I want to achieve two scenarios:

    Shops – allow Shop owner (author of the shop) to register the employees (a number of userswp users)

    Events – allow Event owner (author of the event) to register a host (a singular userswp user) and also to register a shop if needed (a geodirectory location (shop))

    All above scenarios are optional! What would be the best way of achieving that? I tried to use a shortcode to a multiselect option but it doesn’t seem to be working.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stiofan

    (@stiofansisland)

    Hello @sslv,

    You can link two GD CPT’s together using the “Link posts” custom field.

    There is currently no way to do what you want with the the UsersWP user type, you would currently have to add the employees as a GD listing CPT. (though this is something we have in the plans for this year, it has not been given a date yet)

    Thanks,

    Stiofan

    Thread Starter sslv

    (@sslv)

    Hi Stiofan,

    I thought to let you know that I found a way to display list of users in the GD Form. I created a shortcode and added that shortcode in the multiselect option values. Here is the code I used to create the shortcode:

    add_shortcode('user_multiselect_options', 'generate_user_multiselect_options');
    function generate_user_multiselect_options() {
        $users_by_role = get_users(array(
            'role__in' => array('user_role_1', 'user_role_2'),
        ));
        $options = '';
        foreach ($users_by_role as $user) {
            $options .= '<option value="' . esc_attr($user->ID) . '">' . esc_html($user->display_name) . '</option>';
        }
        return $options;
    }
    
    
    • This reply was modified 7 months, 4 weeks ago by sslv.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to allow user to select a number of UsersWP in Add Listing Form’ is closed to new replies.