To start to work with the plugin, you need to have a Telegram bot. That's possible to create a new one
or use an existing.
You can find the complete manual about this in the official Telegram docs.
In a few words, that's only necessary to enter a service name, similar name ending with "bot" and get
an API token as a result. After, you can change bot data to change its avatar or description.
Then your bot is ready, save its ID and token in the special plugin settings.
Important! Please, keep in mind, your bot webhook will be changed to the plugin
request's listener URL. So if you use this bot for any other webhook operations, this
process might be broke.
This is possible to prevent the webhook URL change via custom code, but you'll need to add
the plugin requests listener and handler to this URL also.
There are a few predefined views of the auth link itself and its icon before the text. You can see
how it will look in a small preview, lower the link view setting.
That's also possible to disable all built-in views and styles. Select "None" value for both settings,
and then just style .wptgauth-link
element using your custom CSS.
To output the link, use the [telegram_auth_link]
shortcode. Set the link text you need
between the opening and closing tags of the shortcode. You can pass extra link attributes by the
shortcode attributes.
For example:
[telegram_auth_link title="Login via Telegram" style="margin: 1rem;"]Login
here[/telegram_auth_link]
To not output the login link for logged-in users, use the special setting. It allows to output
nothing, default WordPress string, like "Howdy, USERNAME", or custom HTML.
Custom HTML setting supports all registered shortcodes. Also, it has a few dynamic variables to be
replaced by the actual user data, such as [user_first_name]
or [user_avatar_url]
. There is also a
[logout_url]
variable available to make possible to logout by click.
[user_avatar_url]
shortcode can have inline attributes supported by the native WP
function.
