Developer guide
Architecture, adding a provider, templates, functions, URLs and stored data.
Architecture
- Free (namespace
Siteryn\SiterynSocialLogin) boots after WooCommerce and firessiteryn_sl_loaded. Its extension API version isSITERYN_SL_API_VERSION(1.0). - Pro (namespace
SiterynPro\SiterynSocialLogin) boots onsiteryn_sl_loaded, uses only Free's public hooks and firessiteryn_sl_pro_loaded;Plugin::is_pro_active()checks it. - Every display location renders through the
siteryn_sl_render_locationaction; every sign-in goes through the start and callback endpoints. - The settings schema lives in
Admin\FieldRegistry(filterable); Pro adds its own tabs saved in its own option.
Adding a provider
Extend Siteryn\SiterynSocialLogin\Providers\AbstractOAuth2Provider and declare get_id(), get_label(), get_icon(), get_brand_colors(), get_settings_fields(), the authorize, token and user-info endpoint methods, get_scopes() and map_profile(). Override uses_pkce() (default true) or get_token_auth_method() (post or basic) when needed. For a non-OAuth handshake implement ProviderInterface or extend AbstractProvider.
add_action( 'siteryn_sl_register_providers', function () {
siteryn_sl_register_provider( new My_Provider() );
} );
Registering gives you a Providers card (Enable, callback URL, name and your fields, stored as provider_{id}_{field} in siteryn_sl_settings; secret fields are write-only), the button everywhere, and the whole sign-in, linking and registration flow. Fields with 'required' => true must be filled before the provider is active. Provider IDs must match ^[a-z0-9_]{1,32}$ and never change.
Functions and shortcodes
| Function | Returns |
|---|---|
siteryn_sl_buttons( array $args = array() ) | Prints the buttons (same arguments as the shortcode plus location and redirect_to) |
siteryn_sl_get_buttons( array $args = array() ) | The buttons HTML |
siteryn_sl_get_linked_accounts( int $user_id = 0 ) | The user's links, keyed by provider ID |
siteryn_sl_register_provider( ProviderInterface $provider ) | Whether the provider was registered |
siteryn_sl_is_running() | Whether Free is fully loaded |
Shortcodes: [siteryn_social_login] and [siteryn_social_login_accounts] (see Shortcodes). Pro block: siteryn-social-login/buttons with the attributes layout, buttonStyle, shape, alignment, heading and redirectTo.
URLs
| URL | Purpose |
|---|---|
/siteryn-social-login/start/{provider}/ | Starts an attempt. Query: redirect_to, location, lang; for linking intent=link and _wpnonce; Pro's popup adds display=popup |
/siteryn-social-login/callback/{provider}/ | Where providers return (GET, or POST for Apple) |
?siteryn_sl_action=start|callback&siteryn_sl_provider={id} | The same endpoints with plain permalinks |
/my-account/social-accounts/ | Linked accounts (WooCommerce endpoint social-accounts). Disconnect posts siteryn_sl_action=siteryn_sl_unlink |
admin-ajax.php | Settings saving and Pro license actions (admin only, nonce-protected) |
Templates
Copy a file from the plugin's templates/ folder to yourtheme/siteryn-social-login/. Each template has an @version; an older copy in your theme triggers an admin notice.
| Template | Variables |
|---|---|
buttons.php (1.0.0) | $buttons (id, label, provider_label, url, icon, brand_style), $args, $classes |
linked-accounts.php (1.0.0) | $rows, $form_action, $unlink_action, $nonce_action |
Container classes: siteryn-sl--layout-{stacked|inline|icons}, --style-…, --shape-…, --align-… and --location-…. Buttons carry siteryn-sl__button--{provider}.
JavaScript
document.dispatchEvent( new CustomEvent( 'siteryn-sl:reset' ) );
Re-enables every button group after an extension took over a sign-in the customer abandoned (Pro's popup uses it).
Stored data
| Data | Where |
|---|---|
| Free settings (including provider credentials) | option siteryn_sl_settings |
| Installed versions | options siteryn_sl_version, siteryn_sl_pro_version |
| Pro settings | option siteryn_sl_pro_settings |
| Pro license key, status, update check | options siteryn_license_social-login_{key,status,update} |
| In-flight attempts | transients siteryn_sl_state_* (10 minutes, single use) and the cookie siteryn_sl_browser |
| Rate-limit counters | transients siteryn_sl_rate_* |
| Linked identities | user meta _siteryn_sl_uid_{provider} and _siteryn_sl_link_{provider} |
| Last sign-in language (multilingual sites) | user meta _siteryn_sl_lang |
| Background license check | WP-Cron event siteryn_sl_pro_license_refresh (twice daily) |
No custom database tables. The plugin contacts only the providers you configure (when a customer signs in); Pro also contacts Siteryn.com for license checks.
Every action and filter is listed in the Hooks reference.