Developer guide
Open the popup from your code, override its templates, react to its events and extend it.
Architecture
| Free | Pro | |
|---|---|---|
| Namespace | Siteryn\SiterynLoginRegisterPopup | SiterynPro\SiterynLoginRegisterPopup |
| Boot | siteryn_lrp_loaded (on plugins_loaded) | siteryn_lrp_pro_loaded; features on init (priority 11) while licensed |
| Handles | siteryn-lrp (CSS and JS) | siteryn-lrp-pro (CSS and JS) |
| Settings option | siteryn_lrp_settings | siteryn_lrp_pro_settings |
| Settings page | admin.php?page=siteryn-login-register-popup | Same page, its own tabs (pro_*) |
Free does all logging in, registration and password resets through WooCommerce (WooCommerce\CustomerAuth). Pro never copies that logic: it extends Free only through its hooks, script API and templates.
Data stored
| Name | What |
|---|---|
siteryn_lrp_settings | Free settings (only changed keys are needed; defaults fill the rest) |
siteryn_lrp_version | Installed Free version |
siteryn_lrp_outdated_templates (transient) | Cached list of outdated theme template overrides |
_transient_siteryn_lrp_rl_* | Attempt counters, hashed keys, expire within an hour (object cache when available) |
siteryn_lrp_pro_settings | Pro settings, including the builder layout and redirect rules |
siteryn_lrp_pro_version | Installed Pro version |
siteryn_lrp_pro_license_key, _license_status, _license_update | License key (not autoloaded), cached status and update info |
| User meta / customer data | Pro custom registration fields (see where values are saved) |
Accounts themselves are created and stored by WooCommerce. Uninstall removes the options above (on every site of a network), never customer accounts.
AJAX endpoints
| Action | Nonce field / action | Fields |
|---|---|---|
siteryn_lrp_login | woocommerce-login-nonce / woocommerce-login | username, password, rememberme, redirect |
siteryn_lrp_register | woocommerce-register-nonce / woocommerce-register | email, username*, password*, redirect, custom fields |
siteryn_lrp_lost_password | woocommerce-lost-password-nonce / lost_password | user_login |
siteryn_lrp_refresh_nonces | - | Returns fresh nonces for cached pages |
* Only when WooCommerce does not generate them. All are POST to admin-ajax.php for logged-out visitors only, rate limited, and refused when the Origin is not your site. The script also sends lang and redirect_source (opener when the opener chose the destination, else page).
{ "success": true, "data": { "message": "…", "redirect": "…", "view": "login" } }
{ "success": false, "data": { "code": "…", "message": "…", "fields": { "email": "…" }, "nonces": { … } } }
HTTP status: 400 validation, 403 credentials/nonce/disabled/cross-site, 405 not POST, 409 already logged in, 429 rate limited (with Retry-After). Pro adds the public REST route POST /wp-json/siteryn-lrp-pro/v1/license/refresh, which only schedules a license check (at most every 5 minutes).
Templates
Copy a file from the plugin's templates folder to yourtheme/siteryn-login-register-popup/ and edit it there. Each file has an @version tag; an admin notice lists theme copies older than the plugin's.
| Template | Purpose |
|---|---|
popup.php | Dialog shell: overlay, close button, views container |
login-form.php | Log in view |
register-form.php | Register view (only when registration is enabled) |
lost-password-form.php | Lost-password view |
field.php | One form field, used for every field of every view |
Keep every data-siteryn-lrp-* attribute, field name and the view section ids (siteryn-lrp-view-{view}) in your copies. Without JavaScript the forms post WooCommerce's own fields and nonces to My Account.
Opening from your code
<button type="button" data-siteryn-lrp-open="register">Join</button> <a href="#siteryn-lrp-login" data-siteryn-lrp-redirect="/checkout/">Log in and check out</a>
Or in PHP: siteryn_lrp_link( array( 'view' => 'register' ) ) echoes the same link as the shortcode.
JavaScript API
| Method | Description |
|---|---|
SiterynLRP.open( view, trigger ) | Opens on a view; focus returns to trigger on close |
SiterynLRP.close() | Closes and restores focus and page scrolling |
SiterynLRP.switchView( view, focus ) | Shows a view |
isOpen(), currentView(), hasView( view ), getView( view ) | State helpers |
showNotice( view, message, type ), clearNotice( view ) | Text message under the heading; type is error, success or info |
setFieldError( input, message ), clearFieldErrors( form ) | Field errors with aria-invalid |
setBusy( form, busy ), isBusy( form ) | Submitting state |
refreshNonces() | Fetches fresh nonces into the forms |
Events on document (event.detail.view set): siteryn-lrp:ready, siteryn-lrp:open (detail.trigger), siteryn-lrp:close, siteryn-lrp:view, siteryn-lrp:submit (detail.form, detail.data: the outgoing FormData, append to it synchronously), siteryn-lrp:success and siteryn-lrp:error (detail.data). Pro adds siteryn-lrp-pro:auto-open (detail.reason: delay, scroll or exit-intent) and the cancelable siteryn-lrp-pro:social-click (detail.provider, detail.url).
document.addEventListener( 'siteryn-lrp:success', function ( event ) {
if ( 'login' === event.detail.view ) {
// Your analytics call.
}
} );
CSS variables
Set on .siteryn-lrp: --siteryn-lrp-z, --siteryn-lrp-width, --siteryn-lrp-radius, --siteryn-lrp-padding, --siteryn-lrp-bg, --siteryn-lrp-text, --siteryn-lrp-muted, --siteryn-lrp-border, --siteryn-lrp-accent, --siteryn-lrp-accent-hover, --siteryn-lrp-accent-text, --siteryn-lrp-overlay, --siteryn-lrp-error, --siteryn-lrp-error-bg, --siteryn-lrp-success, --siteryn-lrp-success-bg, --siteryn-lrp-info-bg, --siteryn-lrp-field-radius, --siteryn-lrp-button-radius, --siteryn-lrp-font-size. Pro adds --siteryn-lrp-heading-size and --siteryn-lrp-logo-width. The root also carries siteryn-lrp--anim-{slide|fade|none} and siteryn-lrp--mobile-fullscreen.
Multilingual
wpml-config.xmlmakes the heading and button texts translatable per language, plus the shortcode'stextandlogged_in_text(Pro:social_labelandsocial_shortcode).- Requests are answered in the page's language, including WooCommerce's emails sent during the request.
- The
Multilingualhelper class is public:current_language(),switch_language(),translate_object_id(),wc_page_permalink(),register_string(),translate_string()and more.
PHP API
| Method | Returns |
|---|---|
WooCommerce\AccountSettings::registration_enabled() | Whether registration is allowed (filtered) |
WooCommerce\PageContext::should_load_popups() | Whether popups load on this request (filtered) |
Frontend::is_active() / Frontend::get_views() | Whether the popup is printed / view id => template |
FormFields::get( $view ) | A view's normalized fields |
WooCommerce\CustomerAuth::login(), register(), send_password_reset() | Sign in, create a customer, send the reset email (no nonce or rate-limit checks: verify the request first) |
Settings::get( $key ) / get_all() | Free settings |
Ajax::redirect_is_explicit() | Whether the opener chose the destination |
SpeculativeLoading::path_pattern( $url ) | A speculative-loading exclusion pattern for a page on this site |
All hooks are listed in the Hooks reference.