WP Manifestindependent plugin directory
manifest / users / custom-login-signup-plugin

Custom Login & Signup

Custom login and signup forms with role-based dashboards and admin access restriction.

by Osama Ali · github.com/osama-ali-software-engineer/custom-login-signup-plugin

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/osama-ali-software-engineer/custom-login-signup-plugin/archive/refs/heads/main.zip

Custom Login & Signup — Modern, responsive custom login and registration forms with shortcodes, admin settings and safe uninstall. NOTE: Uninstalling the plugin (or using the plugin's uninstall action) will delete ALL users who are not Administrators. Back up your database before proceeding.

Description

This plugin provides a lightweight, modern login and registration UI that integrates with WordPress user system.

Key features:

  • Two shortcodes: [cls_login_form] and [cls_register_form].
  • Modern responsive templates (glassmorphism + gradient look).
  • Creates two pages on activation ("CLS Login" and "CLS Register") that contain the shortcodes.
  • Removes created pages on deactivation so plugin functionality is removed while plugin files remain.
  • Admin settings page with an explicit "Uninstall plugin data" action that warns and requires confirmation.
  • Destructive uninstall: uninstall.php (and the settings uninstall action) deletes plugin data and removes all users who are not Administrators — irreversible. Always backup before uninstall.

Installation

  1. Upload the plugin directory 'custom-login-signup' to the /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' screen in WordPress admin.
  3. On activation the plugin will create two pages:
    • CLS Login (contains [cls_login_form])
    • CLS Register (contains [cls_register_form])
  4. Visit the pages or embed the shortcodes anywhere inside your theme or content.

Usage

Shortcodes:

  • [cls_login_form] — renders the login card.
  • [cls_register_form] — renders the registration card.

Templates:

  • templates/login-form.php
  • templates/register-form.php

You can edit the HTML/CSS in those files to change markup or styling. For future-proof overrides, you may copy the template files to your theme and require a small override loader if you implement it (not included by default).

Assets:

  • assets/css/cls-style.css (enqueued handle: cls-style)
  • assets/js/cls-script.js (enqueued handle: cls-script)

Form fields expected by the plugin handler:

  • Login: cls_user_login, cls_user_pass, cls_login_nonce
  • Register: cls_user_login, cls_user_email, cls_user_pass, cls_register_nonce (Registration template also includes cls_user_pass_confirm for client-side validation — server-side confirm-password check is recommended; see notes.)

Settings

Admin menu: Settings -> Custom Login Signup

  • Shows plugin-created page IDs.
  • Shows a clear uninstall warning and a checkbox that must be checked before plugin data is removed.
  • The uninstall action at this page runs the same cleanup code as uninstall.php.

Admin action:

  • admin-post.php?action=cls_uninstall_data — handled by the plugin and protected with a nonce and capability checks.

Uninstall & Deactivation behavior (Important!)

Activation:

  • Creates two pages containing the shortcodes and stores their post IDs in option 'cls_pages'.

Deactivation:

  • The plugin's deactivation hook deletes the pages it created and deletes the 'cls_pages' option. This removes the visible form functionality from the site while keeping plugin files in place.

Uninstall (plugin deletion or Settings -> Uninstall plugin data):

  • uninstall.php is executed when the plugin is deleted via the Plugins screen.
  • Both uninstall.php and the settings uninstall action call cleanup code that:
    • Deletes plugin-created pages (login/register).
    • Deletes plugin options (cls_pages and any others added).
    • Iterates all users and deletes every user who does NOT have the 'administrator' capability.
  • This is destructive and irreversible. A clear confirmation is presented in the settings page, but uninstall.php will run without additional UI confirmation when the admin deletes the plugin via the Plugins screen. Always back up your database before uninstalling.

Hooks & Extensibility

Actions (examples you can add):

  • cls_register_success (not implemented by default) — you can add this in includes/class-cls-forms.php after creating a user to allow extra actions (email, analytics).
  • cls_forms_enqueue_assets — filter or action point if you add it to extend styles/scripts.

Filters you might add:

  • cls_redirect_after_login — filter URL to redirect users after login.
  • cls_redirect_after_register — filter URL after registration.

(If you want, I can add explicit action/filter points to the plugin so you can hook custom workflows.)

Security & Validation

  • Nonces are used in forms (cls_login, cls_register).
  • Server-side validation is implemented for required fields and duplicate username/email checks. The register form performs client-side password matching but you should add server-side confirm-password checks and stronger password strength checks if required.
  • Always sanitize and validate any extra fields you add.

Customization notes

  • To change styling, edit assets/css/cls-style.css or enqueue another stylesheet from your theme to override it.
  • To add reCAPTCHA or other anti-spam protection, integrate the provider in templates and validate server-side in includes/class-cls-forms.php (handle_register()).
  • To avoid deleting pages on deactivation, change the deactivation hook to set posts to 'draft' instead of deleting them.

Troubleshooting

  • Form not showing: confirm page contains the shortcode and that the plugin is active.
  • CSS/JS not loading: check your theme or optimization plugins that may concatenate or defer assets. Handles are 'cls-style' and 'cls-script'.
  • Registration fails: check for duplicate username/email, or check transient errors set by the plugin (used to display errors).
  • Uninstall did not run: If you used FTP to remove plugin files instead of the Plugins UI, uninstall.php was not executed. Always use the Plugins screen to ensure uninstall.php runs.

Changelog

1.0.0

  • Initial release — custom login and signup shortcodes, activation-created pages, deactivation cleanup, settings uninstall action, uninstall.php destructive cleanup (deletes non-admin users).

Frequently Asked Questions

Q: Will uninstall remove administrators? A: No — the plugin's uninstall logic skips users who have the Administrator capability. All other users will be deleted.

Q: Can I preserve some non-admin users? A: Yes — modify includes/admin-settings.php::run_cleanup() and uninstall.php to skip certain user IDs, roles, or emails. If you want, I can provide code to export users to CSV before deletion.

Q: Is there an undo? A: No. Deletion of users is permanent unless you have a backup.

Screenshots

  1. Login card (modern glass/gradient)
  2. Register card with password confirmation

License

This plugin is open-source software, licensed under the GPLv2 or later.

Additional notes

  • Backup before uninstall. Test on staging if you plan to run the destructive uninstall.
  • If you want server-side confirm-password validation or an export-before-delete feature, I can add that to the plugin.