Home » Blog » Introducing Query Tags, Query for the Current Logged In User
Blog, Changelog, Conductor

Today we’re introducing a new feature to Conductor called query tags. This is a feature that will let you query content for the current logged in user. This type of functionality has long been requested by our customers. We’re happy to announce that these types of queries are now possible in Conductor! Query tags are supported on all post types and Ninja Forms entries.

Update to the latest version of Conductor and the Conductor Query Builder Add-On to start using query tags in your queries. You’ll also need to update the Ninja Forms Add-On if you plan to use query tags on Ninja Forms entries. Read on to learn more about the new query tags feature.

Query tags are a new feature in our Query Builder Add-On. Query tags allow users to build queries that fetch data from dynamic properties. For now, we’ve only included the “current logged in user” query tag. In the future we may expand this feature to include other dynamic properties such as the current date.

Query tags are automatically added to the values drop downs in the query builder. Query tags have the following format in the builder: *{query_tag}*.

Current Logged In User Query Tag

Query Tags for Post Types

For all registered post types in your WordPress install, query tags are available in the following clause types:

Current Logged In User Query Tag
  • Where Clause
    • Author ID parameter
  • Where Meta (Custom Field) Clause
    • Any custom field parameter

Query Tags for Ninja Forms

For Ninja Forms entries, query tags are available in the following clause types:

Current Logged In User Query Tag
  • Where Clause
    • Author ID parameter
      • Note: In Ninja Forms, this is the user who submitted the form
  • Where Meta (Custom Field) Clause
    • Any custom field parameter
Display Current Logged In User Ninja Forms Entries

Here is an example query which displays Ninja Forms entries for the current logged in user:

Query Builder Ninja Forms Current Logged In User Query Example

Query Builder Ninja Forms Current Logged In User Query Example

Query Tag Conditions

Each query tag can specify a condition has to be met for it to be included in the query arguments for a query. If the query tag condition isn’t met, the query will return zero results. Effectively the query arguments are reset to an empty array in this case.

For the “current logged in user” query tag, the condition is set to check if a user is logged in (via is_user_logged_in()). If you test the “current logged in user” query tag while logged out, no content will be displayed.

It’s also possible to see no results with a logged in user. This can happen because the current logged in user doesn’t have any content based on the criteria you’ve specified in your query.

Front-End Preview with Query Tags

In some cases, the front-end preview within our query builder may not display any results.  For the “current logged in user” query tag, this is because your account does not meet the criteria of the query. A notice will be displayed in the “Front-End Preview” when no results are returned and a query tag exists.

Query Builder Preview - No Results Notice

Query Builder Preview – No Results Notice

In situations like this, you’ll want to make sure you test your query on an account which does meet the criteria so you can see what it will look like.

Other Notable Updates

Conductor

In Conductor we added the wp_rest nonce to all Conductor REST API requests which allows for basic authentication checks to be performed on those requests.

We fixed a possible issue where featured image sizes in Conductor widgets could be overridden via the post_thumbnail_size filter. Conductor actually now hooks into this filter (really late) to ensure that the correct featured image size is displayed on specific Conductor Widgets.

We also fixed a possible PHP notice in the Conductor_Admin_Options PHP class when Conductor was used in an environment with PHP 7.

Conductor Query Builder Add-On

We fixed a bug where, in some cases, the preview query event was not triggered properly when adjusting query arguments in the advanced builder. This resulted in incorrect content displayed in the “Front-End Preview”.

Official Changelogs

Conductor

  • Added the “wp_rest” nonce to all Conductor REST API requests (allows for basic authentication checks to be performed)
  • Fixed a possible issue where featured image sizes in Conductor widgets could be overridden via the “post_thumbnail_size” filter
  • Fixed a possible PHP notice in the Conductor_Admin_Options PHP class when Conductor was used in an environment with PHP 7

Conductor Query Builder

  • Introduce query tags
  • Fixed a bug where adjusting query arguments in the advanced query builder did not properly trigger a preview query event in some cases
  • Added logic to allow [FROM] parameter option elements to have configuration data via the “data-config” HTML5 attribute

Conductor Ninja Forms

  • Added logic to allow Ninja Forms entries to be utilized in the advanced builder in the Query Builder Add-on
  • Added logic to allow Conductor Query Builder Add-On query tags to be utilized with Ninja Forms entries

Having Issues After Updating?

We have tested all of these updates extensively across many versions and variations of WordPress. If you encounter any unexpected issues after upgrading, please let us know by submitting a support ticket.

 

Conduct your content!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.