Views 1.4 with Users Support

   Amir

November 14, 2013

Views 1.4 is ready with complete support for displaying WordPress users. This means that you can create Views that query users, filter by usermeta and display them any way you want. But that’s not all. Views 1.4 has more surprises for you!

Until this version, A View could display either posts (posts, pages and all custom types) or taxonomy. Now, you can do the same with WordPress users.

So, you can easily query and display all ‘members’ in a site, or all ‘editors’ or anything like that. Together with the usermeta support in Types, you can add fields to users and filter by them.

Users View
Users View

User filter
User filter

Other Notable Features in Views 1.4

Besides the major addition of users support for Views 1.4, you’re getting a handful of other features. Almost everything here came in response to client requests in the support forum. We appreciate your feedback very much and always look for ways to make it easier to build sites with Views.

  • Added sorting a View listing posts by last modified
  • Made slugs editable for Views and WordPress Archives
  • New {{wpv-post-status}} shortcode
  • Improved {{wpv-post-featured-image}} shortcode
  • New {{wpv-taxonomy-archive}} shortcode
  • New {{wpv-post-slug}} shortcode
  • New {{wpv-post-body}} attribute “suppress_filters” – when set to ‘true’ the shortcode will render with basic WordPress filters applied
  • Extended {{wpv-if}} shortcodes – add custom functions support to {{wpv-if}} shortcodes
  • Extended {{wpv-items-found}} and {{wpv-no-items-found}} support for Posts, Taxonomies and Users
  • New {{wpv-found-count}} with support for Taxonomies and Users
  • Added trash for Views, WordPress Archives and Content Templates
  • Added custom inner shortcodes in Settings and “wpv_custom_inner_shortcodes” PHP filter. Add {{wpml-string}} shortcode by default when available
  • Added a “class” parameter to the {{wpv-filter-submit}} shortcode
  • New feature for clearing all existing single posts from a Content Template assignment
  • Added “wpv_edit_view_link” PHP filter for frontend edit links
  • Added “wpv_filter_custom_field_filter_original_value” and “wpv_filter_custom_field_filter_processed_value” filters for values for Views filters – can override the values used on a filter by custom fields for Views listing posts
  • Added GUI for inserting translatable string

You can find full details about new and updated shortcodes in the Views shortcodes page. Credits go to Simon, for putting that great resource together.

And, Some Bug Fixes

  • Filter the_content was applied twice in some cases
  • When using a {{wpv-post-body}} shortcode inside a Content Template other shortcodes might not be expanded
  • Fixed problem with AJAX pagination on IIS servers
  • Default spinner image for pagination was not being set
  • Small glitches in Content Templates asignment
  • Evil comma of doom in javascript
  • Descriptions for Views objects are now exported and imported
  • Hook a PHP filter before and after the query to prevent incompatibilities with plugins that mess with the query
  • Do not offer creation of Content Templates for archive loops that do not exists (like posts, pages and attachments archives
  • View forms in V popup was missing in some situations
  • View widgets now list only the relevant Views
  • Removed dash from default shortcode attribute for taxonomy filters
  • Switched to ColorBox for the Insert View Form popup in the post.php and post-new.php screens
  • {{wpv-control}} shortcode parameter format was not being used for taxonomy filters using checkboxes
  • Views form shortcode can now be inserted in embedded Views
  • if a page contains two Views with table layout, sorting the first affected the order of the other (and the second one could not be sorted)
  • Respect format in Content Templates affected by the wptexturize filter
  • {{wpv-for-each}} shortcode behaviour is now more accurate
  • editing a posts with an asigned Content Template using a CRED form resulted in a broken layout
  • Fixed PHP warnings when performing custom searches by taxonomies using select or radios and taxonomy names as values
  • Custom search popup – do not offer taxonomies we want to exclude or taxonomies with show_ui set to false
  • Added the ability to insert a Content Template inside posts, templates
  • Datepicker in custom search was not displaying the selected date on results page when default_date is set to NONE
  • Stopped offering to create a WordPress Archive or a Content Template for post archives for posts that do not have an archive
  • When adding the {{wpv-filter-meta-html}} shortcode twice to a View combined output the table sorting stopped working
  • PHP notice when the {{wpv-heading}} had no name attribute
  • View duplication on multisite is working now
  • WPML + Views integration:
    • Views form widget – sync of target page for Views form wiget accross languages
    • Views form widget – only offer as target pages the ones in the current language
    • Views form shortcode – sync the target page from shortcode accross languages
    • Views filters – sync options like parents, taxonomy terms or post IDs accross languages
    • Views filter by taxonomy term – fix so it displays translated terms when needed
    • Converting URLs to point to translated content in Views and Content Template option in WPML was not working for links to taxonomy archives

Download

If you are using our Installer plugin, you will get this update directly to your admin dashboard. You can always download the ZIP files manually from your wp-types.com account.

Next for Views

The next major feature going into Views 1.5 is a very powerful debugger. Yes, I know, a boring feature. Give us the chance to surprise you with something exceptional here. The new Views debugger will make life for all of us a lot better.

It shows:

  • Memory and CPU consumption for Views, Content Templates and their nested elements
  • All the queries that Views does, both as WordPress API calls and as low-level SQL queries
  • The results of these queries
  • All the available filters, including their arguments, what goes in and what comes out
  • The raw data that Views produces before applying filters to it

This information is presented in a concise way, with nice nesting and expandable details. If you like Firebug, you’ll surely enjoy this debugger.

Views already lets you build sites faster. Armed with this new tool, I’m sure you’ll be able to build great Views sites, which look good and work blazing fast, even easier.

After the debugger, we’re working on dependent values for custom searches and many-to-many relationship in Types and Views.

 

Comments 20 Responses

  1. First of all :
    Hats off !!!! 😀

    A little question : In the “Content Selection” section, we can select multiple content types only for posts. Would it be conceivable to select multiple users in the future ?
    Just to explain why :
    Let’s say we have a directory, listing 2 types of users (for example Users A and Users B)
    Users A would only be able to edit their profile while Users B could additionally publish/edit specific custom posts.
    I thought that defining 2 custom roles in Access would do the trick, but there seems no way to filter both Users A and Users B (?)…
    Or maybe there’s a workaround ? (I ask this spontaneously without examine from all angles, sorry if my question prove to be inconsequent..)

  2. is there any way I can get early access to the debugger?

    I’m having issues with high memory usage because I have 10 views on my homepage. =\

  3. This is a serious amount of improvement for Views. Great job, team!

    My minor complaint for today is about the new “Move to trash” button in the View edit screen. If you look closely at it, you will notice that the button text has a different font family applied to it, which makes it odd-looking. This is because you have inserted the class “icon-trash” as an attribute to the button element itself. You can fix this by inserting an “i” tag with the class=”icon-trash” between the opening and closing button tags (i.e. just before the Move to trash text).
    There is also a tiny dot between the slug field and the trash button, I’m not sure what is it.

    Having said that, I think making the trash button less of a button and more of a link would be better. A red link like the one found in the Publish meta box in post edit screens is a good example, IMO.

  4. BTW, I see you deprecated the [wpv-posts-found] shortcode in favor of [wpv-items-found]. Will this have any effect on our existing code? Is it better to go and update all instances of that deprecated shortcode or what?

    • You can write them here. I go over everything. Not always we can include every suggestion in an upcoming release, but we certainly try.

  5. I keep getting this error when using the Users table as the data source.

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/84/11309384/html/ggvcoc/wp-content/plugins/wp-views/inc/filters/wpv-filter-user-field.php on line 133 and defined in /home/content/84/11309384/html/ggvcoc/wp-includes/wp-db.php on line 992

    • Can you please add a thread about this in our technical forum?

      Make sure that you are using the most recent versions of Types and Views and also tell us what WordPress version this is on.

    • Where is the technical forum?

      I keep getting this error when using the Users table as the data source.

      Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/84/11309384/html/ggvcoc/wp-content/plugins/wp-views/inc/filters/wpv-filter-user-field.php on line 133 and defined in /home/content/84/11309384/html/ggvcoc/wp-includes/wp-db.php on line 992

  6. Just had a chance to look at the new 1.4 Views version and it is looking great. Two things I wish it had:

    1) Every update I have to go in and override wpv-widgets.php so that “Edit view” doesn’t appear in my front end widgets – it would be nice if this was a setting in admin back office for Views > Settings

    2) On my wish list would be a short code for “back to search results” to give Toolset the functionality eBay has. When you have found a nice set of search results, then you view your item, it is nice to go back to your results. The only way I have found to do this is using the wordpress function wp_get_referer, to go back a browser page, but it is rather clunky.

    Many thanks for all your hard work

    David

    • Thanks for the compliments! We try very hard to make Views useful for you and I’m happy to see it’s working out.

      1. Can you please add a note in our technical forum about what you are editing in wpv-widgets.php? Please include a message that it’s for Juan. You can link to this comment, so that our support team know what to do with it. I’d like to get the details there and then add it to Views.

      2. Same thing for the ‘back to search results’. If you can explain specifically what you wish this shortcode do, it would be great. I’m not sure we can add it immediately, but the support team should probably be able to advice on how to implement it using a custom shortcode.

    • Sure. What do you want to know? Basically, now Views supports users same as it supports posts and taxonomy. You can query users and filter by their fields.

  7. It would be great to progress on the custom user roles:

    1) let user (a certain role) create other users
    2) in CRED: let the creator of a new post link this custom post to other users. Would be great for building new views

    Other suggestion: build views with predefined filters that filter on a value in a custom user field. I see this as an other way of filtering beside the URL parameter.

    • I was searching the site for exactly the functionality that Rik has described here:

      “let user (a certain role) create other users”

      Specifically, to be able to do this from a front end form that is restricted to a certain “pseudo” admin role.

      ie. have a limited admin role with the capability of managing (create, edit, delete) users (with lesser privileges) from a front end form, without the privilege of full back end access.

      It would be great to see this available in an upcoming release (assuming that I haven’t missed something already available).

    • Yes, looks odd. The way Views works mirrors the WordPress API call to load users. When we implemented it, we somehow thought that the role field is required. Looking at the documentation again, it doesn’t look that way. Let me check with Views devs and we’ll see if this can be changed.