2.8.4 logs

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: 2.8.4 logs

Re: 2.8.4 logs

by axew3 » Mon Apr 22, 2024 9:02 pm

Just released 2.8.4!

Code: Select all

= 2.8.4 =
*Release Date - 22 Apr, 2024*
* Fix: option 'Retrieve posts on Last Topics Widget based on phpBB user's group' to return the correct result, and the option has been improved to become: Display topics/posts on Shortcodes and Widgets based on the phpBB user's groups permissions
* Fix: improve the 'private static function last_forums_topics($ntopics = 10)' so to get only required values and make it faster. Fix and remove the code on same function.
* Add: Gutenberg w3all 'phpBB last topics block' widget
* Fix: (secondary) security bug into the function 'public static function w3all_bbcodeconvert($text)'
* Fix: minor fixes
* Logs: https://www.axew3.com/w3/forums/viewtopic.php?t=1870

Re: 2.8.4 logs

by axew3 » Mon Apr 22, 2024 7:32 pm

In the while 2.8.4 will be published very soon, probably today!
maybe today!

Code: Select all

private static function last_forums_topics($ntopics = 10){
has been finally fixed to get only required values, and shortened to be faster, the new version become:

Code: Select all

private static function last_forums_topics($ntopics = 10){

# Note that userID 2 in phpBB goes into default phpBB guest user group
# because $w3all_phpbb_usession is empty for this uid (excluded)
 global $w3all_phpbb_connection,$w3all_phpbb_usession,$w3all_config,$w3all_exclude_phpbb_forums,$w3all_wlastopicspost_max,$w3all_lasttopic_avatar_num,$w3all_get_topics_x_ugroup,$w3all_heartbeat_phpbb_lastopics_num;

 if( empty($w3all_phpbb_connection) )  return; 

 $topics = array();
 $ntopics0 = $w3all_wlastopicspost_max > $w3all_lasttopic_avatar_num ? $w3all_wlastopicspost_max : $w3all_lasttopic_avatar_num;
 $ntopics  = $ntopics0 > $ntopics ? $ntopics0 : $ntopics;
 $ntopics  = $w3all_heartbeat_phpbb_lastopics_num > $ntopics ? $w3all_heartbeat_phpbb_lastopics_num : $ntopics;
 $ntopics = $ntopics > $ntopics0 ? $ntopics : 10;
 $topics_x_ugroup = $no_forums_list = '';

 if($w3all_get_topics_x_ugroup == 1){

  if (!empty($w3all_phpbb_usession)) {
    $ug = $w3all_phpbb_usession->group_id;
    $ui = $w3all_phpbb_usession->user_id;
   } else {
     $ug = $ui = 1; // the default phpBB guest user group
    }

  # 16 ROLE_FORUM_NOACCESS into acl_roles table
  # get all forums ids which the user have no permissions to read
  $gaf = $w3all_phpbb_connection->get_results("SELECT AG.forum_id
    FROM ".$w3all_config["table_prefix"]."acl_groups AS AG
    JOIN ".$w3all_config["table_prefix"]."user_group AS UG ON( UG.user_id = ".$ui."
     AND UG.group_id = AG.group_id
     AND AG.auth_role_id = 16 )");

   if(!empty($gaf)){
      $gf = '';
       foreach( $gaf as $v ){
        $gf .= $v->forum_id.',';
       }
    $gf = substr($gf, 0, -1);
    $topics_x_ugroup = "AND T.forum_id NOT IN(".$gf.")";
   }
 }

  if ( preg_match('/^[0-9,]+$/', $w3all_exclude_phpbb_forums ))
  {
    $exp = explode(",", $w3all_exclude_phpbb_forums);
    $exc_forums_list = '';
     foreach($exp as $k => $v){
      $exc_forums_list .= "'".$v."',";
     }
    $nfl = substr($exc_forums_list, 0, -1);
    $exc_forums_list = "AND T.forum_id NOT IN(".$nfl.")";
  } else { $exc_forums_list = ''; }

      $topics = $w3all_phpbb_connection->get_results("SELECT
       T.topic_id,T.forum_id,T.topic_title,T.topic_last_post_id,T.topic_last_poster_id,T.topic_last_poster_name,T.topic_last_post_time,
       P.post_id,P.topic_id,P.forum_id,P.poster_id,P.post_time,P.post_username,P.post_subject,P.post_text,P.post_visibility,
       U.user_id,U.username,U.user_email
       FROM ".$w3all_config["table_prefix"]."topics AS T
       JOIN ".$w3all_config["table_prefix"]."posts AS P on (T.topic_last_post_id = P.post_id and T.forum_id = P.forum_id)
       JOIN ".$w3all_config["table_prefix"]."users AS U on U.user_id = T.topic_last_poster_id
       WHERE T.topic_visibility = 1
       ".$exc_forums_list."
       ".$topics_x_ugroup."
       AND P.post_visibility = 1
       ORDER BY T.topic_last_post_time DESC
       LIMIT 0,$ntopics");

     $t = is_array($topics) ? serialize($topics) : serialize(array());
     if(!defined("W3PHPBBLASTOPICS")){
      define( "W3PHPBBLASTOPICS", $t ); // see also wp_w3all.php and wp_w3all_assoc_phpbb_wp_users in this class
     }

    return $topics;
}
There are two points to know (and maybe to be fixed in the future) about last topics:
1) the serialization of the resulting array, that since Php 7.2 (if not wrong) is not necessary because a CONSTANT can be array.
But it is really a secondary aspect soon resolved on next.
2) the fact that the new added Last Topics block widget for Gutenberg, seem to be hard to be hooked so to know earlier, the number of posts for each widget (all widgets that could co-exists into a page), and so to calculate and know the max num of posts to be retrieved, useful to not call the last topics function more times to get different number of topics/posts for each widget.
This seem very hard to be resolved, if not adding an option where an admin could put the max number of topics that will be retrieved.

Anyway the point has been fixed re-calling the function with the proper num of topics to be retrieved, whenever, and only if, into a page/post, there is more than one Last Posts widget, and in the case that the first instance, that retrieve posts through the Last Topics function, call the function with a num of posts that's minor, respect the second widget that will call same function on same page/post.

[EDITED]

Re: 2.8.4 logs

by axew3 » Sun Apr 21, 2024 12:15 pm

A secondary and maybe not so important security bug (the parsed post into a shortcode it's assumed that's used only by Admins and/or Editors in WP, but it is just a stupid point of view, it is not secure) has been fixed into the function wp_w3all_remove_bbcode_tags(). I just discovered it while thinking to provide the parsing of posts content into the Last Topics widget, if the added widget come with the option post text active.
At this moment this aspect, and an advanced function that should parse the post's content in a better way for the post's content on widgets, even if it is easy to accomplish with, has been moved on some release in the very close future.

While it is probably a priority to go to fix two main queries (one is about last topics, where all about user's and user's group is retrieved but it very not necessary) because the required data for the last topics widgets/shortcode are very few: the query will be highly lightened.

Minor fixes.

Another aspect is the fact that the code, even if running without any error into any scenario, still require a good cleanup and restyle!

Ps. Do not know if would be better to add the heartbeat to the Last Topics block widgets.

And, thinking about Heartbeat user's notifications that are still not introduced into 2.8.4.
User's notifications will be added where?
We have all data we wants already, why to not use it as:
element that can be active on last topics widget, where a div will contain user's info below (or above) the last topics list if the option is active, and all about forum's notifications will be updated on heartbeat. Forum's statistics, and user's online num (the actual function about it is not perfect).

In the while 2.8.4 will be published very soon, probably today!

Re: 2.8.4 logs

by axew3 » Fri Apr 19, 2024 8:49 am

The block Widget phpBB last topics for the Gutenberg editor has been introduced on 2.8.4

gutenbergWPeditorLastopics.png
gutenbergWPeditorLastopics.png (52.06 KiB) Viewed 1070 times

Re: 2.8.4 logs

by axew3 » Thu Apr 18, 2024 12:12 pm

The same last added option for the last topics shortcode, the HeartBeat Last Topics Shortcode can be easily added, taking advantage by the same added code, to all widgets.
It can also be added all about notifications, so that the user will not have to reload the page, if a new pm or posts on a subscribed forum etc has been published in phpBB and get immediate notification in WP.

But there is a problem about widgets that are all built on the old way, and not suitable for the new Gutenberg blocks way. While shortcodes works on any template, blocks widgets are not the same and are built in a different way in wordpress now. Beside the old way, we'll try to add the new way creating a block widget for new wordpress themes.

The login widget will never more updated to work into gutenberg, because since it is possible to use any login on frontend or wp-admin given by any other external plugin, beside the default wp, it result to be not useful at all to have one into this. You do not think?

Re: 2.8.4 logs

by axew3 » Thu Apr 18, 2024 12:00 pm

About: Retrieve posts on Last Topics Widget based on phpBB user's group option, it become
Display topics/posts on Shortcodes and Widgets based on the phpBB user\'s groups permisions
... and let set it as active by default, when the integration will be activated, but leave the possibility to switch it to off, so to retrieve posts on widgets, for all users, as guests.

Top