Skip to content

Commit

Permalink
implement advertised but missing handling of groups in view_order
Browse files Browse the repository at this point in the history
  • Loading branch information
gchriz committed Dec 25, 2021
1 parent 281f122 commit 18f444b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions functions.inc.php
Expand Up @@ -1056,12 +1056,13 @@ function mod_nwi_posts_getall(int $section_id, bool $is_backend, string $query_e
$sql = sprintf(
"SELECT " .
" *, " .
" (SELECT `position` FROM `%smod_news_img_groups` AS `t4` WHERE `t4`.`group_id`=`t1`.`group_id`) as `gposition`, " .
" (SELECT COUNT(`post_id`) FROM `%smod_news_img_tags_posts` AS `t2` WHERE `t2`.`post_id`=`t1`.`post_id`) as `tags`, " .
" (SELECT `post_id` FROM `%smod_news_img_posts` AS `t3` WHERE `t3`.`$order_by` > `t1`.`$order_by` AND `section_id`='$section_id' $active ORDER BY `$order_by` $direction LIMIT 1 ) as `next`, ".
" (SELECT `post_id` FROM `%smod_news_img_posts` AS `t3` WHERE `t3`.`$order_by` < `t1`.`$order_by` AND `section_id`='$section_id' $active ORDER BY `$order_by` $prev_dir LIMIT 1 ) as `prev` " .
"FROM `%smod_news_img_posts` AS `t1` WHERE `section_id`='$section_id' $filter ".
"$query_extra ORDER BY `$order_by` $direction $limit",
TABLE_PREFIX, TABLE_PREFIX, TABLE_PREFIX, TABLE_PREFIX
"$query_extra ORDER BY gposition ASC, `$order_by` $direction $limit",
TABLE_PREFIX, TABLE_PREFIX, TABLE_PREFIX, TABLE_PREFIX, TABLE_PREFIX
);

$query_posts = $database->query($sql);
Expand Down

2 comments on commit 18f444b

@remmedia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a rollback as otherwise it is impossible to have an order outside groups.
The Fixed order of groups makes ordering e.g. by date impossibel!

@instantflorian
Copy link
Contributor

@instantflorian instantflorian commented on 18f444b Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please open an issue or register in the WBCE forum and post your problem with a example what exactly does not work there. It's awkward if someone who never appeared in the WBCE context before and has nearly no Github activity just claims "needs a rollback".

Please sign in to comment.