A change to the Ultimate Member plugin has required an important, one-time change in the TwitchPress UM Extension. It involves removing/applying standard WordPress roles to a user who subscribes to the main Twitch channel. I’m not blogging about the way, I’m just making a quick post to help remind you and even myself how this now works.
Remove Many Roles
To handle the rare event of a user having more than one WordPress role that is paired with Twitch subscription plans, we remove them all. The issue here is that a role might be required by a user for purposes, probably not going to happen for most gaming websites though. I’m just blogging to help us troubleshooting if someone has a big issue with it.
The PHP in this above shows that the UM extension will loop through all of a users roles (they will usually have a single role) which are also paired with Twitch subscription plans. In theory, this should never be required but is a precaution to prevent a situation where users are granted multiple roles within the TwitchPress system.
This is the first funded extension for the TwitchPress system and the thanks go to a popular streamer known as Nookyyy. He didn’t just fund the work but participated in hours of testing and troubleshooting. So based on these facts he is also a contributor and together we have created a strong bridge between the Ultimate Member plugin and TwitchPress.
Twitch Subscription to UM Role
The primary purpose of the current version is to automatically change a WP users community role based on their Twitch subscription for a giving channel. If that doesn’t make much sense to you here is another way of putting it. The UM extension changes the level of access a WP user has to the website, has based on their subscription plan.
Perks Like Subscriber Only Content
Once a WP users Twitch data is synced it becomes part of the TwitchPress system first. Any plugin could be adapted to work with that data and offer our channels viewers some perks on our own websites. A common bonus for subscribing could be private content and if you know WordPress that essentially means hiding anything that can be added to a page using a shortcode.
We could hide downloads, votes, hosted videos, discount codes, and even games that interact with the Twitch API. Ultimate Member is the first plugin of its kind to be integrated with TwitchPress but I predict some other very good plugins will be too.
Professional Twitch Suite System
The bigger goal for TwitchPress is to support the creation of a Twitch suite. This is where extensions come in but without extensions the plugin is great. The core plugin focuses on sharing and importing posts with channel feeds. To use the TwitchPress UM Extension another two extensions are currently required though.
- TwitchPress Login Extension: Displays a Connect to Twitch button for login and registration using a visitors own Twitch account. This is required because it contains the code that triggers data import from Twitch. A developer could replace this extension with their own or adapt another plugin to trigger the data import.
- TwitchPress Sync Extension: This is the plugin that will focus on the flow of data to and from Twitch.tv with the primary goal of balancing requests. The only way to truly balance activity and be in control of it as website owner possibly providing a busy public service. Is it have it all go through one plugin that logs, stores, and displays data related to API requests. Well, there may be some small exceptions but the majority of calls to Kraken (Twitch API) is expected to go through the Sync Extension. This extension will be required by most TwitchPress systems, possibly all.
So far all extensions are provided free on WordPress.org and this only happens due to funding even if it is small amounts. So don’t think you need to donate hundreds to fund development. Every 10 dollars or 10 pounds or 10 euros can pay for 2-3 hours development, which is below minimum wages obviously. My own contribution is that extra time and in the end, I don’t really profit considering my costs.
I’ve released a login and registration extension on GitHub. This is a free extension and has been submitted to WordPress.org for review. If accepted, we will be able to install it via the TwitchPress Setup Wizard. All free extensions will be available in the wizard, for quick-install.
WordPress Login Via Twitch
Activating the plugin will add a new button to the Login page. Clicking it will take visitors to Twitch.tv to complete the oAuth2 procedure. The visitor will be returned to the login page (/wp-login.php) and the TwitchPress Login Extension will process values in the URL.
No Existing Account
If there is no existing account for the visitor, the extension will create one. So this extension allows quick registration.
Existing Account Found
If my extension finds an existing account, the visitor will be logged into that WP account.
At this early stage, the TwitchPress Login Extension is built for the most common requirements. How the plugin handles various scenarios, is changeable with further work and settings will be created to give administrators more option.
There is no button on the Registration page, so that will come soon. We also need a range of options for administrators to configure how they wish to handle visitors.
- Do they want registration at all or only login?
- Do they want automatic registration after the visitor clicks on the Twitch Login button or forward the visitor to the Registration form?
- Do they want the visitor to register using the normal WordPress procedure and then authorize their Twitch account once on their dashboard?
Please submit comments with suggestions or requests. Remember to use GitHub if you wish to influence the project in a more direct manner.
What is an extension?
I’ll finish by clarifying what an extension is. It’s actually just another WP plugin. The difference is that it relies on the core plugin to be active, not just installed. If the TwitchPress plugin has not been activated, you cannot activate the extension, it will simply fail when attempted. This reliance makes TwitchPress Login Extension an extension to the main plugin, no other.