XF 2.2 A few more things...

Screenshot 2020-07-23 at 10.41.16.png
Today marks the day when the alpha stage of XenForo 2.2 comes to an end and we mark that occasion by unleashing the first public beta. Look out for an announcement on that shortly.

Before that, however, we wanted to highlight a few more things that we've been working on over the last couple of weeks. Some of these you will be aware of as they have been running here for some time and we may have mentioned them elsewhere. Others are slightly more subtle...

Image and video improvements​

Lazy loading​

Last year Google paved the way for Native lazy loading images. Lazy loading images is a fantastic way to reduce page loading times and data usage as rather than loading all images on a page, it instead loads images as you scroll, just before the images enter your browser's viewport.

Since then browser support for the standard has ballooned with all major browsers including Chrome, Firefox, Edge (Chromium based) and even Safari* adding support for it. So now seemed like a great time to start supporting it in XF too.

This is actually one of those features that is there but is hard to see but there is a good visualisation of it in the web.dev demo and you should also see it if you inspect the "Network" tab in the "Developer tools" of your preferred browser while browsing through an image-heavy thread.

* While Safari supports lazy loading images it is currently marked as an experimental feature which can be enabled in macOS Big Sur Safari Tech Preview or iOS 14 Beta.

Dimensions​

We now, where possible, specify width/height attributes on many images used across the software where the dimensions are known. This attempts to avoid costly browser reflows in many circumstances and is also beneficial to image lazy loading.

A significant image where we did not previously know the dimensions was the public logo style property. We have now added a couple of new style properties so these can be specified:

dimensions.png


Specifying these dimensions is also helpful for cases where you might use an SVG image as your logo as they do not generally have predefined dimensions.

New lightbox​

The lightbox interface which displays image attachments in their fullscreen glory has been much improved in XenForo 2.2. As well as some much needed functionality (better pinch-to-zoom support) and improved stability it has also afforded us the flexibility of implementing some cool features to XenForo Media Gallery.

Screenshot 2020-07-23 at 10.41.16.png


Don't just take my word for it, click on some of the images in this post to check it out!

Write before registering improvements​

After we first announced Writing before registering we were asked to add a few additional indications that content was pending and this seemed reasonable so we were happy to oblige!

Users will now get a reassuring reminder that their content will be posted once their registration is complete:

localhost_22x_register_complete.png


And once they have completed their registration they will be able to go straight to viewing the content by clicking the very handy "View your content" button.

1595442244900.png


There are a few additional improvements on their way as we progress through the beta.

API additions​

XenForo 2.2 includes a fairly huge array of REST API improvements which are difficult to go into significant detail here but here's a brief overview:
  • Support for accessing the API user's alerts and marking them as read/unread.
  • Support for creating an arbitrary alert (similar to the admin CP method).
  • Support for marking conversations read/unread.
  • Filter conversations to unread only.
  • Support for marking threads and forums read.
  • By extension, expose read/unread state to forums, threads and posts.
  • When calling GET threads/, information about the first unread post, if applicable.
  • Support thread moving.
  • Expanded thread filtering: unread only, by thread type.
  • Expose search forums to the API.
  • Allow lookups based on a user's email address (with requisite admin permission).
  • Support for looking up a user based on a session ID or a remember cookie. This allows easier/seamless integrations in situations where the XF cookies are available (on the same domain or a sub-domain, depending on XF cookie config).
  • Support for temporary login tokens that allow you to log a user into an arbitrary XF user.
  • Basic stats endpoint to get site totals, online user counts and basic info about the latest registration.
  • Include HTML-parsed output in things like posts, conversation messages, etc. HTML uses a new BB code renderer to avoid dependencies on XF HTML.
  • Return view_url with a number of data types. This provides the canonical URL to that content within XF.
You can find the latest version of the documentation which includes these new endpoints at our REST API endpoints [BETA] page.

Search forum widget​

xenforo.com_community_ (1).png

Search forums are our new way to surface content. If you have forgotten how they work, it is essentially a new node type that behaves very similarly to a forum, but rather than allowing users to create and reply to threads it is instead a curated list of threads based on the criteria that you define.

We have a couple of test examples on this very forum including Fixed bugs and Implemented suggestions where we display a list of threads with a specific prefix in certain forums.

They really are great but you may wish to highlight the content from these forums in different ways so we have added the ability to display them as a widget.

Much like many of our thread based widgets you can display them in a "simple" list, much like the one pictured here. There is also a "full" list which displays them as a forum view type thread list and an "expanded" list which displays them with a snippet of their first post content.


Embedded JavaScript for XF install/upgrade​

While a somewhat rare occurrence (unless you happen to be @Chris D who experiences it on almost every single upgrade that he does) it is not unheard of for the one-click upgrade process to apparently get stuck due to a JavaScript error. The reasons for this are not quite clear but generally it involves some sort of race condition whereby the one-click upgrade system manages to load and cache a partially uploaded core JS file which then prevents our auto form submission process from moving onto the next step.

From 2.2 we now embed only the required JavaScript right there in the upgrader templates. No external dependencies. No frills. Simples.

Profile post / comment attachments​

For XenForo 2.1 we added rich text formatting to profile posts and comments. For XenForo 2.2 we're giving you attachments for profile posts and comments! Users with permission may now upload images, videos and other attachments straight to their profile posts and their comments.

This is, of course, permission controlled so if you do not want this enabled on your forum that is no problem.

Thread searcher additions​

The "thread searcher" is a general concept in the software that is used mostly in the Admin control panel for a couple of features. Notably it is the interface which is used to select the criteria for which threads should appear in "Search forums" and it is the same system that allows you to set the criteria for the "Batch update threads" tool.

To add even more flexibility to these systems, we've added some new criteria.

You can now filter by thread type:

xenforo.com_community_admin.php_threads_batch-update.png


You can exclude specific forums from your search:

xenforo.com_community_admin.php_threads_batch-update (2).png


And we now also have support for relative date options so you can search for threads either created or last replied to in the last X hours|days|weeks|months|years:

xenforo.com_community_admin.php_threads_batch-update (3).png


xenforo.com_community_admin.php_threads_batch-update (4).png

Username change reasons​

When a user wants to change their username they are now asked to provide a reason.

xenforo.com_community_account_account-details.png


This is usually optional but you can set it to be required by changing this option:

xenforo.com_community_admin.php_options_groups_users_.png

LinkableInterface

One final thing for the developers here is a new PHP interface which can be implemented on any Entity class that represents an item of content where you might have one, or more, other classes that may need to get its link, its route or its title.

This means that handler-based systems such as XF\Bookmark\AbstractHandler can have a default method which returns the value of the method from that interface rather than each handler implementing its own logic.

Similar thread suggestion headings​

Coming directly from a suggestion made yesterday, following the unveiling of our new Similar threads suggestion facility, the list of suggested threads now gets its own heading to prompt the user to consider the contents of the list.

The headings are context sensitive, so the message will be different depending upon the type of thread being composed.




Screenshot 2020-07-23 at 10.26.39.png Screenshot 2020-07-23 at 10.26.28.png

Not everything works out the way we want...​

For the most part, when the constant debates are over about which icons should be used for which buttons 😜 and the dust settles you are faced with the latest iteration of the XenForo 2.2 rich text editor and it is - by any measure - a real step forward.

Amongst all of the positive changes we made, we implemented a very well intentioned, and potentially very useful feature called the "Quick insert button". But, it wasn't meant to be. While for the most part it did a great job, it didn't work totally as expected on all devices and, as such, we took the decision to remove it.

RICH TEXT EDITOR
QUICK INSERT BUTTON
R.I.P
2020 - 2020

Gone but not forgotten. Who knows? It may make a return one day.
 
I'm going to have to wait until tomorrow to install now, so that I'm not my own self fulfilling prophecy.

It's no fun testing locally. Not enough anxiety when things go wrong.
 
  • Support for temporary login tokens that allow you to log a user into an arbitrary XF user.
Nice additions to the API !

I have one question, with the new auth/login-token endpoint, would it be secure to deploy a public mobile application with a super user key scoped to the Auth endpoint and then be able to login as another user using their user/password combination?

I want to be able to login from a mobile app to XenForo but I don't want to manually generate an api key for each user. This temporary login token seems to be of help in that regard but I'm still not sure how to use the login-token generated from auth/login-token.
 
Support for temporary login tokens that allow you to log a user into an arbitrary XF user.
Can you expand on this a little? Is this a feature to allow a user, with the right permissions, to log in as another user? This was literally on my list of things to do, but would be great if this is already in core now, lol.
 
This temporary login seems to be of help in that regard but I'm still not sure how to use the login-token generated from auth/login-token.
You can redirect the user to /login/api-token?token=<token> and that logs them in so it may not help you entirely.

Although there is the auth/from-session endpoint too now so if you can get the remember cookie value or user's session ID then you can log them in with that.
 
Can you expand on this a little? Is this a feature to allow a user, with the right permissions, to log in as another user? This was literally on my list of things to do, but would be great if this is already in core now, lol.
Sort of similar to my above reply. There is a new auth/login-token endpoint in the REST API which returns a login token.

The result looks like this btw:

JSON:
{
    "login_token": "voFx5tAyk7HZpKL3u1HbjABCD23C5WjE",
    "login_url": "https://example.com/login/api-token?token=voFx5tAyk7HZpKL3u1HbjABCD23C5WjE&remember=1",
    "expiry_date": 1595512736
}

You can visit that URL and you become logged in as that user.
 
Sort of similar to my above reply. There is a new auth/login-token endpoint in the REST API which returns a login token.

The result looks like this btw:

JSON:
{
    "login_token": "voFx5tAyk7HZpKL3u1HbjABCD23C5WjE",
    "login_url": "https://example.com/login/api-token?token=voFx5tAyk7HZpKL3u1HbjABCD23C5WjE&remember=1",
    "expiry_date": 1595512736
}

You can visit that URL and you become logged in as that user.
Take my money... 💰💰💰

This is great news. Side question, let's say I am an admin and I create this token so I can log in as a user, is there an endpoint/function for me to force expire this token? Or is it as simple as deleting a record in the DB that houses the token?
 
Feel sorry for Quick Insert Button, I loved the idea and when I saw it's removed from XF I thought you guys made it optional ON/OFF, but... surprised that it's gone :(
 
We've been checking in on the quick insert button from time to time and it is okay, I wouldn't feel sorry for it. It is moving onto bigger and better things. It's got a few job interviews lined up. I'm sure it will land on its feet.
 
Thanks for all the hard work!

Of my personal TOP 3 you nailed 2. 2 outta 3 ain't bad a'tall! :)

Profile post / comment attachments​

For XenForo 2.1 we added rich text formatting to profile posts and comments. For XenForo 2.2 we're giving you attachments for profile posts and comments! Users with permission may now upload images, videos and other attachments straight to their profile posts and their comments.

This is, of course, permission controlled so if you do not want this enabled on your forum that is no problem.
Yes this was a Top-3er for me. Thank you for adding it.

Another concern I harped on was better MG integration for the purposes of discovery. Attachment Mirroring is an awesome first step in that direction and I already have plans for it! My #3 didn't come true but I think I can cope with the copious amounts of surprise additions and cool features! Can't wait to play around with search forums and thread types. Game changers! And more!

It's apparent XF listens and even keeps an eye on those suggestions that get lost on page 33. Keep up the good work and crack open a beer or fizzy water! I salute you!
 
Last edited:
We've been checking in on the quick insert button from time to time and it is okay, I wouldn't feel sorry for it. It is moving onto bigger and better things. It's got a few job interviews lined up. I'm sure it will land on its feet.
If this whole developer thing doesn't work out for you... stand up comic for sure. :P
 
Feel sorry for Quick Insert Button, I loved the idea and when I saw it's removed from XF I thought you guys made it optional ON/OFF, but... surprised that it's gone :(

The idea behind the Quick Insert Button was good, the implementation however was not good. Especially on mobile devices the button was rather annoying.

49bfbl.webp
 
Top Bottom