Shop Forums WordPress Plugins Changing the order of forums in the digest

Viewing 2 reply threads
  • Author
    Posts
    • #19719
      Jamie Furlong
      Participant

      Hi Vinny,

      I received my first proper weekly digest and the forums appear random. I can’t make sense of the order in which it decides to digest. I picked up on this because the first forum in the digest is ‘Troubleshooting’. This isn’t a good look, especially as this is the first digest my subscribers will have seen! Troubleshooting is not the first forum, and neither is it the lowest ID number, so can you tell me how the digest orders the forum topics and replies? Moreover, how can I change the order?

      Cheers,

      Jamie

    • #19881
      vinny
      Keymaster

      Hi Jamie,

      Sorry for the wait. As of Digests version 1.25, you can hook into the bbpnns_queue_order_by filter to change the order.

      The default order has also been set to order by q.post_id, q.timestamp ASC, where q is the alias to bbpnns_digest_queue table.

      To change the order, do the following:

      add_filter( 'bbpnns_queue_order_by', 'my_custom_digest_order', 10, 1 );
      
      function my_custom_digest_order( $order_by )
      {
          /**
           * Available fields are:
           * - q.notification_id 
           * - q.user_id
           * - q.forum_id
           * - q.post_id
           * - q.post_type
           * - q.timestamp 
           */ 
          $order_by = 'order by q.post_id DESC'; // See http://www.mysqltutorial.org/mysql-order-by for examples.
          
          return $order_by;
      }

      Cheers,
      Vinny

    • #21383
      Jamie Furlong
      Participant

      Sorry, I missed this. Been ill! Thanks for this, Vinny.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.