How to setup Discord/Blesta client role site

How to setup Discord/Blesta client role site

How to setup Discord/Blesta client role site

Noah M.
Last Updated:

The Discord/Blesta client role site requires API access to Discord and Blesta to function properly. Make sure you have first created a Blesta API account and Discord bot (and that this bot is in your server) before starting.

Installing the files

Download the zip file from the link at the bottom of this page and unzip it in the directory where you would like to setup the site. This site can be run in a folder or under a subdomain. Unzip the files in the folder and navigate to vendor/config.php to fill in the config file.

Configuring the site

  • url
    • The URL where this site will be hosted (includes a / at the end).
    • Example: https://localhost/
  • discord_webhook (optional)
    • The Discord webhook where you want to be notified when a new user is linked.
  • blesta_api_user
    • The API user you created on Blesta.
  • blesta_api_key
    • The key for the API user you created on Blesta.
  • blesta_api_url
    • The API URL for your installation of Blesta
    • Example: https://localhost/blesta/api/
  • discord_bot_token
    • The Discord bot token you created. The bot must be in the server where the client role is added.
  • client_roles
    • The role(s) you want to have added to any verified user. If you have a captcha system, include the member role as users may be added to the server if they are not already in it.
    • Example: [1, 2] or [1]
  • discord_server_id
    • The server ID of the Discord server the bot is in.
  • discord_client_id
    • The client ID of the Discord bot.
  • discord_client_secret
    • The client secret of the Discord bot.

Also, be sure to whitelist (yoursite)/forms/discordLogin.php as a redirect URI on Discord.

Troubleshooting

The roles are not being added to the user

Please ensure the bot is above the user in the role hierarchy.

The site is giving an ionCube error

Please make sure you have ionCube installed. 

The site is saying invalid credentials even though they are correct

Please check your API information. This is usually caused when the API information for Blesta is invalid.

Invalid OAuth2 redirect_uri

Please ensure that this OAuth2 redirect URI is allowed on Discord: (yoursite)/forms/discordLogin.php

The file (...) encoded as type [1/74] cannot be decoded by this version of the ionCube Loader

Please make sure you are running PHP version 7.4. If your error says [1/81], make sure you are using PHP 8.1. If you are using 7.4 or 8.1 and getting this error, you may have used the wrong files (for example 8 but you're running 7).


Was this article helpful?