2 Logic
DeineStrainReviews edited this page 2025-11-20 17:44:31 +01:00

How the Logic Works

graph LR
    Start((Start)) --> Config[Load Config]
    
    %% Phase 1: Deletion
    Config --> CheckDel{Phase 1:<br/>Deletion Candidates?}
    CheckDel -- "Resent > Y Days<br/>(Limit applied)" --> LogDel[📝 Write to<br/>Deletion Log]
    LogDel --> ActionDel[❌ DELETE User]
    ActionDel --> NotifyDel[📧 Email Admin]
    
    %% Phase 2: Reminder (starts after Deletion or if no deletions needed)
    CheckDel -.-> CheckRemind{Phase 2:<br/>Reminder Candidates?}
    NotifyDel -.-> CheckRemind
    
    CheckRemind -- "Reg > X Days<br/>(Limit applied)" --> ActionRemind[📧 Send<br/>Reminder Email]
    ActionRemind --> LogResend[📝 Write to<br/>Resend Log]
    LogResend --> NotifyResend[📧 Email Admin]
    
    CheckRemind -.-> Stop((Done))
    NotifyResend --> Stop

    style Start fill:#f9f,stroke:#333,stroke-width:2px
    style Stop fill:#f9f,stroke:#333,stroke-width:2px
    style ActionDel fill:#ffbfbf,stroke:#f66,stroke-width:2px
    style ActionRemind fill:#bfd6ff,stroke:#66f,stroke-width:2px
    style LogDel fill:#fff3cd,stroke:#d69c00,stroke-width:1px
    style LogResend fill:#fff3cd,stroke:#d69c00,stroke-width:1px

The plugin operates via a daily scheduled task (Cronjob) that runs automatically in the background.

🛡️ Safety First: Who gets deleted?

Before taking any action, the system performs strict checks to ensure no active members or administrators are accidentally removed.

A user is ONLY considered for processing if ALL of the following conditions are met:

  1. Email Unconfirmed: The database field emailConfirmed is NOT empty (meaning the activation link was never clicked).
  2. Group Restriction: The user is ONLY a member of the default groups:
    • ID 1 ("Everyone")
    • ID 2 ("Guests")
  3. No Other Groups: If a user has been assigned to any other group (e.g., "Moderators", "VIP", "Registered Users"), they are ignored immediately.

🔄 The Workflow

The plugin follows a priority logic every time the cronjob runs:

1. Priority: Deleting (Stage 2)

First, the system looks for users who have already received a reminder email.

  • Condition: Current Time > Resend Date + Delete Days.
  • Action: The user is permanently deleted.
  • Log: An entry is written to the "Deleted Unconfirmed Users" log.
  • Notification: If enabled, admins receive an email.

2. Secondary: Reminding (Stage 1)

Next, the system looks for users who are old enough for a reminder but haven't received one yet.

  • Condition: Current Time > Registration Date + Resend Days.
  • Check: Has this user already received a reminder? (Checks the internal Resend Log).
  • Action: A reminder email with a new activation link is sent.
  • Log: An entry is written to the "Resent Activation Emails" log.

Direct Deletion Mode (Legacy)

If you set the option "Days until resending activation email" to 0 in the configuration:

  • Condition: Current Time > Registration Date + Delete Days.
  • Action: The user is deleted immediately without warning.