Support » Plugin: Simple User Listing » Best way to display users in several different formats

  • Resolved nerdworker

    (@newtonsongbird)


    I need to display user data in several different ways, so I need a way to differentiate which shortcode was used. For instance, I need a list of all users with a certain role which will list their name, company, email, phone. But elsewhere, I need to list users with that same role, but only their company name.

    There only seems to be one template to customize, so I don’t think I can make a separate template for each type of listing I need. I also don’t seem to be able to give the shortcodes a name to check for in the template and alter the display that way.

    Is there any guidance you could give me on how best to accomplish multiple display formats?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author helgatheviking

    (@helgatheviking)

    Well, I think you’ve got me there. At first I wanted to say

    [userlist query_id="this-query"] is a way to distinguish between queries, but that’s just it… it’s for queries and doesn’t get passed to where the template is called.

    I’m happy to add a filter for sul_get_template_part so you can modify the template, but still not sure how to pass the shortcode args to that.

    Unfortunately, I don’t have any availability to take a custom development gig at the moment. but the code is all at github and I’m open to pull requests if you find a good modification that works for your case. Unfortunately,

    nerdworker

    (@newtonsongbird)

    Thanks for the reply. I will take a look and see if I can come up with a solution.

    nerdworker

    (@newtonsongbird)

    I added a pull request on Github.

    I added a shortcode argument as $template, which is the name of an additional template part – located in yourtheme/simple-user-listing/slug-author.php. The name in $template must match the “slug” part of the filename. If no template is specified, it defaults to content-author.php.

    Example: [userlist template=”members”] with a corresponding file of yourtheme/simple-user-listing/members-author.php

    I hope this meets your approval.

    Plugin Author helgatheviking

    (@helgatheviking)

    Resolved by https://github.com/helgatheviking/Simple-User-Listing/pull/11

    [userlist template="members"] is supported as of 1.8.2 and will look for yourtheme/simple-user-listing/content-members.php in your theme.

    nerdworker

    (@newtonsongbird)

    Thanks so much for merging my pull request and adding this to your plugin!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Best way to display users in several different formats’ is closed to new replies.