pods icon indicating copy to clipboard operation
pods copied to clipboard

Cant sorting pods block

Open wireinet opened this issue 1 year ago • 6 comments

Description

t.post_modified DESC (for example) in not work in my case in pods. Even the suggested option (under input field) does not work. I can't figure out what he needs. I just need sorting options.

Version

3.1

Testing Instructions

  1. Add gutenberg block "Pods Item List"
  2. Select pod name employee (for example) this custom post type created by pods
  3. Select template "emploee" in my case this is simple
  4. item with fields:
[if post_thumbnail]
{@post_title}
[/if]

{@post_title}

{@employee__post}

{@employee__phone}

[if employee__fax]

{@employee__fax}

[/if] [if employee__skype]

{@employee__skype}

[/if]
4) i get list of items with some sorting (cant understand whats is default options) 5) set suggested options like t.post_title ASC and get error: "Pods Embed Error: ORDER BY contains SQL that is not allowed."

Screenshots / Screencast

2024-06-20_11-58-27

Possible Workaround

No response

Site Health Information

No response

Pods Package

No response

wireinet avatar Jun 20 '24 09:06 wireinet

Having the same problem with Version 3.2.5 and ordering DESC in Gutemberg blocks. if I put ASC it works. I have also tried using CAST as you say in https://docs.pods.io/searching-filtering-sorting/sorting/sorting-date-fields-using-cast/#page-header-1347 and with ASC works, but with DESC it doesn't.

The error:

Object of class WP_Error could not be converted to string

Debug backtrace

#0 [internal function]: Pods->process_magic_tags() #1 /var/www/html/test.test/web/wp-content/plugins/pods/classes/Pods.php(4230): preg_replace_callback() #2 /var/www/html/test.test/web/wp-content/plugins/pods/components/Templates/Templates.php(726): Pods->do_magic_tags() #3 /var/www/html/test.test/web/wp-content/plugins/pods/components/Templates/Templates.php(628): Pods_Templates::do_template() #4 /var/www/html/test.test/web/wp-content/plugins/pods/classes/Pods.php(3681): Pods_Templates::template() #5 /var/www/html/test.test/web/wp-content/plugins/pods/includes/general.php(2204): Pods->template() #6 /var/www/html/test.test/web/wp-content/plugins/pods/includes/general.php(1382): pods_shortcode_run() #7 /var/www/html/test.test/web/wp-content/plugins/pods/includes/general.php(1346): pods_shortcode_run_safely() #8 /var/www/html/test.test/web/wp-content/plugins/pods/src/Pods/Blocks/Types/Item_List.php(426): pods_shortcode() #9 /var/www/html/test.test/web/wp-content/plugins/pods/src/Pods/Blocks/Blocks_Abstract.php(144): Pods\Blocks\Types\Item_List->render() #10 /var/www/html/test.test/web/wp-content/plugins/pods/src/Pods/Whatsit/Block.php(212): Pods\Blocks\Blocks_Abstract->safe_render() #11 /var/www/html/test.test/web/wp-includes/class-wp-block.php(519): Pods\Whatsit\Block->render() #12 /var/www/html/test.test/web/wp-includes/class-wp-block.php(499): WP_Block->render() #13 /var/www/html/test.test/web/wp-includes/blocks.php(2061): WP_Block->render() #14 /var/www/html/test.test/web/wp-includes/blocks.php(2113): render_block() #15 /var/www/html/test.test/web/wp-includes/block-template.php(263): do_blocks() #16 /var/www/html/test.test/web/wp-includes/template-canvas.php(12): get_the_block_template_html() #17 /var/www/html/test.test/web/wp-includes/template-loader.php(106): include('...') #18 /var/www/html/test.test/web/wp-blog-header.php(19): require_once('...') #19 /var/www/html/test.test/web/index.php(17): require('...') #20 {main}

Thanks a lot for Pods :)

rosa2 avatar Jul 20 '24 17:07 rosa2

I get the same error with pager when I go to the second page, without anything in ORDER BY or WHERE.

rosa2 avatar Jul 20 '24 18:07 rosa2

I have downgraded to 3.2.4 and everything that I said works.

rosa2 avatar Jul 20 '24 18:07 rosa2

With version 3.2.6 I can sort again.

rosa2 avatar Aug 03 '24 06:08 rosa2

In Pods 3.2.8.1 I don't get a ORDER BY field in the "Pods Item List" block at all. Is it still supposed to be there?

If yes, how do I get it to show up? If no, how do I order the list now? I want to order by post_date, most recent on top (ie, classic blog style) but I'm getting a list sorted alphabetically by post_title.

Edit: To answer my own question: it's a language thing. The site is in Dutch which somehow caused the ORDER BY field in the "Pods Item List" block to disappear, but as soon as I switched to US English in my user profile, it was back! Sorting by t.post_date DESC now works just fine.

irisv avatar Jan 16 '25 12:01 irisv

I have the same problem. ORDER BY field is missing. But in my case it is not related to language nor to any plugin as i tested to disable all. I have Pods 3.3.1 by now on a up to date WP6.8.1. Language of WP is US English and my user now as well. (before it was at browser default)

novski avatar May 15 '25 11:05 novski

I believe this could possibly be related to when changing Pods settings it does not flush the Pods cache and the Pods Blocks cache their configurations.

I have a fix for that in Pods 3.3.2 but I'm unable to reproduce any of the cases described here.

sc0ttkclark avatar Jul 07 '25 17:07 sc0ttkclark

@rosa2 I'm unable to reproduce the WP_Error issue described here and ASC/DESC are working for me within the blocks context.

Having the same problem with Version 3.2.5 and ordering DESC in Gutemberg blocks. if I put ASC it works. I have also tried using CAST as you say in docs.pods.io/searching-filtering-sorting/sorting/sorting-date-fields-using-cast#page-header-1347 and with ASC works, but with DESC it doesn't.

The error:

Object of class WP_Error could not be converted to string

Thanks a lot for Pods :)

sc0ttkclark avatar Jul 07 '25 18:07 sc0ttkclark

I believe the issues have all been resolved now as of the latest releases of Pods (since the original report) and the latest issue with cache flushing when changing settings (as of Pods 3.3.2 which will be out soon).

sc0ttkclark avatar Jul 07 '25 18:07 sc0ttkclark