Skip to content

ENHANCEMENT: Improve admin UX for Email Confirmation status#61

Open
flintfromthebasement wants to merge 1 commit into
strangerstudios:devfrom
flintfromthebasement:feature/improve-ux-confirmation-status
Open

ENHANCEMENT: Improve admin UX for Email Confirmation status#61
flintfromthebasement wants to merge 1 commit into
strangerstudios:devfrom
flintfromthebasement:feature/improve-ux-confirmation-status

Conversation

@flintfromthebasement

Copy link
Copy Markdown

Closes #60

Summary

This PR significantly improves the admin UX for email confirmation status by adding a dedicated Edit Member panel, status columns on list views, and cleaning up existing row action behavior.

Changes

1. Edit Member Panel (PMPro 3.0+)

Added a dedicated "Email Confirmation" panel to the Edit Member screen that shows:

  • Status: Confirmed / Pending / Not Required (with color-coded badge)
  • Email address the confirmation was/will be sent to
  • Levels requiring confirmation vs. levels not requiring it (lists which of the member's levels require confirmation)
  • Admin actions:
    • Validate Now - mark user as confirmed without them clicking the link
    • Resend Confirmation Email - send a new confirmation email
    • Require Re-confirmation - generate new key and require user to confirm again
    • Send Confirmation Email - for users who never had one

The panel only appears when at least one of the member's levels requires confirmation, so it's contextually relevant rather than always present.

Files: includes/class-pmpro-member-edit-panel-email-confirmation.php

2. Status Columns

Added "Email Confirmed" column to both:

  • Members List (pmpro_manage_memberslist_columns / pmpro_manage_memberslist_custom_column)
  • Users list (manage_users_columns / manage_users_custom_column)

The column shows:

  • Confirmed (green badge) - user clicked the confirmation link
  • Pending (yellow badge) - confirmation email sent but not yet clicked
  • (gray) - confirmation not required for any of their levels

This provides at-a-glance visibility without needing to click into row actions. The row actions are kept as a quick-access secondary option.

3. Row Action Cleanup

Fixed issues from #60:

  • Stop showing status for users who were never required to confirm: Row actions now check if any of the user's levels actually require confirmation using pmproec_isEmailConfirmationLevel(). If none do, no actions appear.
  • Localize "Validated" string: Changed from bare 'Validated' to esc_html__( 'Validated', 'pmpro-email-confirmation' ).
  • Fix error message: Changed copy-pasted "Could not reset sessions. User not found." to "Could not validate user. User not found."

4. CSS Styling

Added css/admin.css with color-coded badge styles:

  • Green for confirmed
  • Yellow for pending
  • Gray for not required

CSS loads only on relevant admin pages (users.php, pmpro-memberslist, pmpro-member).

5. Version Bump

Updated from 0.9 to 1.0 with full changelog entry in readme.txt.

Technical Notes

  • Panel class extends PMPro_Member_Edit_Panel (PMPro 3.0+ API)
  • Reuses existing helpers: pmproec_isEmailConfirmationLevel(), pmproec_resend_confirmation_email(), pmproec_generateNewKey()
  • Respects the pmproec_validate_user_cap filter (default edit_users) for all admin actions
  • All new strings are localized via esc_html__() / esc_attr__()
  • Admin CSS loads only on relevant pages

Testing Steps

  1. Edit Member panel:

    • Go to Memberships > Members List
    • Click a member who has a level with "Require email validation" enabled
    • Look for the "Email Confirmation" tab/panel
    • Verify status, levels list, and actions appear correctly
    • Test each action button
  2. Status columns:

    • Go to Memberships > Members List
    • Confirm "Email Confirmed" column appears and shows correct status badges
    • Go to Users > All Users
    • Confirm column also appears there
  3. Row actions:

    • On Members List or Users list, hover over a row for a user with a confirmation-required level
    • Verify "Validate User" and "Resend Confirmation Email" actions appear (if pending)
    • Verify "Validated" appears (if already confirmed)
    • Check a user with no confirmation-required levels - no actions should appear
  4. Edge cases:

    • Member with multiple levels (some requiring confirmation, some not)
    • Member who was manually added (never had a confirmation requirement)
    • Member who changed email address (if "Require re-confirmation on email change" is enabled)

Screenshots

(Would include screenshots here if I had a test environment set up)

Notes

  • The panel only shows for existing users (not during "Add New Member" flow, since there's no user ID yet)
  • The row actions are kept as a complementary quick-access method alongside the column
  • The "Reset Email Confirmation" feature referenced in the issue (step 3c) reuses the existing pmproec_generateNewKey() function
  • Optional items from the issue (timestamps, bulk actions, frontend account view) are out of scope for this PR but could be follow-ups

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Addresses issue strangerstudios#60 by adding multiple UI improvements:

1. Added dedicated "Email Confirmation" panel to Edit Member screen (PMPro 3.0+)
   - Shows confirmation status, email address, and which levels require confirmation
   - Provides admin actions: Validate Now, Resend Email, Require Re-confirmation
   - Only appears for members with at least one confirmation-required level

2. Added "Email Confirmed" status column to Members List and Users list
   - Shows Confirmed/Pending/— status with color-coded badges
   - Only displays status for members whose levels require confirmation
   - Provides at-a-glance visibility without needing to click into row actions

3. Fixed row action behavior
   - Row actions now only appear for users whose levels actually require confirmation
   - "Validated" status is now properly localized
   - Fixed copy-pasted error message from "Could not reset sessions" to "Could not validate user"

4. Added CSS styling for status badges in tables and panels

Technical notes:
- Panel class extends PMPro_Member_Edit_Panel
- Reuses existing helpers: pmproec_isEmailConfirmationLevel(), pmproec_resend_confirmation_email(), pmproec_generateNewKey()
- Respects pmproec_validate_user_cap filter for all actions
- Admin CSS loads only on relevant pages

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve admin UX for Email Confirmation status: add an Edit Member panel + status column

1 participant