Check Plugin Configuration

Check Plugin Configuration

The plugin already runs some tests, per page request, while you’re on the administration side and requesting any TwitchPress view. The tests results can be found in the Help tab, while you’re on any of the plugins own views.

TwitchPress Troubleshooting open Help tab
Open the standard WP Help tab to see information (some tools) that apply to all views. 
TwitchPress troubleshooting Help tab
You will find a group of Status sections in the Help tab.
TwitchPress User Status you do not have a token
You’re own Twitch account authorization and permissions are tested in the User Status section.

 

TwitchPress User Status ready setup working
This is how the User Status section will look once you complete the Setup Wizard.

 

TwitchPress App Status no application token not ready
The status of your Twitch app credentials can be viewed in the App Status section.

 

TwitchPress App Status ready working setup
Now we see that app credentials have been entered into the Setup Wizard or Settings page.

 

TwitchPress Channel Status no channel token found
This section tests the main channel, the official channel, probably you’re own channel.

 

Troubleshooting

Various tests are performed to try different areas of the plugin. Each missing or incorrect value requires a different approach to troubleshooting. So don’t get carried away trying to make the plugin work, without being pointed in the right direction by another guide or by asking me!

The one possible fix that you can try for all scenarios is completing the Setup Wizard again. You will find a button to start that in the Installation section of the Help tab you’ve just been looking at above.

Sandbox-Mode

Sandbox-Mode

A recent bug with Ultimate Member roles reminded me how difficult it is to create Twitch subscriber based features without a channel that offers a subscription program to perform testing. The alternative is sandbox-mode which makes use of sample data from Twitch.tv and other sources, to behave as if API calls have been made.

Development Only

This feature is intended for developers during development of beta versions. A sandbox is an environment designed for practice, testing new code, and not for testing a live site. Never activate this mode on a live-site.

 

TwitchPress Sandbox Mode Active

Sandbox Generator

The Sandbox-mode Generator option allows the mode to generate random data, rather than simply using hardcoded values. This requires a developer to create a procedure that will generate seemingly valid values. This is done based on validation parameters that would normally be applied to each value of data. So in many cases, we wouldn’t be able to tell the difference. TwitchPress Sandbox Mode Generator

A generator procedure won’t always (or even often) simply create random values though. My initial need was to generate WP users, based on real Twitch channels and randomly generate subscription data for those users. So I require both real data (to ensure some real validation and real API calls work correctly) and randomly generated data for the purpose of testing new procedures i.e. a procedure that would otherwise need real visitors to register and use features. I can’t get enough people to do that, at the time I need them to and at a rate that is helpful to me while I watch the log. I created something that would be the next best thing.

Generator Off Option

When the Sandbox-Mode Generator box isn’t checked, TwitchPress will only use hardcoded data which involves manual entry and can be time-consuming. This is ideal for very precise tests, which are normally small anyway.

The generator is off by default and not every feature in the plugin will be supported due to the work involved.

False/Failed Returns Option

This option allows a little more natural behavior to be applied. A lot of functions won’t always return a full set of records or a response that we can do much with. A real response might include an error and contain very little data compared to a successful response.

TwitchPress Sandbox Mode False ReturnsIn some cases, it is entirely normal to get a short response i.e. when we query if someone is a subscriber to our own Twitch channel, but they aren’t. The Twitch API will respond with a very basic and small set of values when compared to a positive response which would tell us far more.

We need false/failed responses from the API to ensure the plugin handles them properly. So when in sandbox mode we need the same behavior. This means I have to make TwitchPress randomly switch between the data and the tester/developer will see a natural randomness during testing just as if they were processing many Twitch channels/users for real.

Help Maintain Test Data

The more test data the quicker we can fix any bugs that come up. This will be a simple task of copying and pasting samples from API documentation. If you know GitHub then this is a task you can get involved with. Just 30 minutes of your time, adding more sample data or just suggesting samples in the form of GitHub issues.

Here is an image of the sample data offered by Twitch.tv within developer documentation for their API.

Twitch Example API Response if user is subscribed to the channel