• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

XenWord 3.0.0.06 Changelog

LPH

Flight Director
Flight Instructor
Work on XenWord 3.0.0.06 continues. This release is not ready for release to the general public due to two important bugs relevant to WordPress 4.4.
  1. Updating of the post table in the activate method.
  2. XenForo Avatars are not showing properly on the WP side. The new code loads gravatars but will not show uploaded avatars.
I'll keep tinkering -- but -- the holiday week is over and I'm headed back to "no internet land" until December 12th. If a developer reads this and is interested in reviewing the code then please email me.

These are the current changes.

Code:
Bug Fix: Fixed activate() error, new mysql code, class-xenword-activator.php
Changed class-xenword-thread-creation.php: cleaned up repeated statements in the switch statements .
Changed class-xenword-activator.php: added WP_Session_Tokens::destroy_all()
Changed class-xenword-avatars.php: added class Avatars
Changed class-xenword-admin-notices.php: public function changed to public static functions
Changed class-xenword-action-links.php: added XenWord_Action_Links class, fixed $basename path to main file, added protected $plugin_slug
Changed /XenForo/index.php: added methods get_plugin_slug() and get_instance()
Changed class-xenword-login-xfusers.php: wrapped conditional to check $user_id is not zero 
New files: class-xenword-stylesheets.php, xenword-public.css, xenword-admin.css
Removed xenword.css
Renamed files: class-xenword-users-data.php, class-xenword-users-roles.php, class-xenword-users-admin.php
 
Last edited:

Gracie

Dogs Times Writer
There is a thread in the developer's forum with code LPH is working on for the next release of WordPress. I believe the issue is the conditionals and changing the code away from the get_avatar as a replacement of the WordPress get_avatar.

There is a thread of XenForo LPH started in May asking a means to grab the Avatar with $id_or_email. Chris gave the hint :)
 
  • Like
Reactions: LPH

LPH

Flight Director
Flight Instructor
The activation error is now fixed in the code. The bug was an embarrassing error in the main plugin file.

Maybe you could use the avatar.php for the user avatars. I'm using this file for other addons to get the avatar from a user through his id or username.

The avatar.php code is a little different because the XenWord script was replacing the WordPress get_avatar. I'd like to shift that to no longer replacing code but actually filtering. Using the add_filter would provide stronger "future proofing" of the XenWord code. I suspect the WordPress developers will eventually deprecate the pluggable.php file.

With that said, using a mysql call based on the $user_id wouldn't work in the comments area (is_object). But that's just a guess --

There is a thread in the developer's forum with code LPH is working on for the next release of WordPress.

Yes. Those with developer accounts should look in the developer forum and help get this alpha to a beta. ;)
 

LPH

Flight Director
Flight Instructor
Took time last night and this morning to clean up the organization of some files. This will make debugging easier for certain features as well as sets up expansion of some features.

Code:
Changed class-xenword-login-xfusers.php: wrapped conditional to check $user_id is not zero 
New files: class-xenword-stylesheets.php, xenword-public.css, xenword-admin.css
Removed xenword.css
Renamed files: class-xenword-users-data.php, class-xenword-users-roles.php, class-xenword-users-admin.php
 

LPH

Flight Director
Flight Instructor
Hi

@RLL and I spent a few hours this afternoon going through the class-xenword-avatars.php file. Just before we left, we started realizing it was important to split apart much of the code into blocks for easier debugging. We left before developing something, but when I got home the following idea popped into my head.

Here is the latest sections (without many of the conditionals and many of the arguments). It's the skeleton to build the class XenWord_Avatars.

PHP:
class XenWord_Avatars {

     public function construct() {
          add_filter('get_avatar', array($this, 'set_comment_avatar'), 10, 5);
     }

     private function set_avatar() {
          $avatar_img_output = $this->generate_avatar_img_tag( $avatar_uri, $size, $alt );
          return $avatar_img_output;
     }

     public function set_comment_avatar() {
          $avatar_output = $this->set_avatar( $email, $size, $alt );
          return $avatar_output;
     }

     private function generate_avatar_img_tag( $avatar_uri, $size, $alt = '' ) {
          $output_data = "<img alt='{$alt}' src='{$avatar_uri}' class='avatar avatar-{$size} width='{$size}' height='{$size}' />";
          return $output_data;
     }

}

$xenword_avatars = new XenWord_Avatars;

Of course, there is tons of work to do with the new structure but it should help us find a solution. And, of course, we might end up abandoning this direction if it becomes too complex. Generally, though, separating out code into different methods helps.
 

Gracie

Dogs Times Writer
Here is the latest sections (without many of the conditionals and many of the arguments). It's the skeleton to build the class XenWord_Avatars.

Am I correct the avatar_uri is built in the set_avatar and where you will place the conditionals for building the URL and the set_comment_avatar does the conditionals for is_numeric, is_object, and is_empty?
 
Top