=== Gemeindetresor – geschützte Ablage für FeG-Gemeinden ===
Contributors: eduardwiebe77
Donate link: https://www.paypal.com/ncp/payment/4QTUARLZWFZ3C
Tags: members, registration, restrict content, church, documents
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Privacy-friendly member area for churches: registration, local bot protection, admin approval, per-page access and a protected document library.

== Description ==

Gemeindetresor ("church vault") is a small, privacy-first plugin for the internal area of a church website. It was made for FeG churches (Free Evangelical Churches) in Germany, but every church can use it for free. It replaces large membership plugins when you only need registration, login, protected pages and a document library.

* **Registration** `[feg_intern_registrierung]` with double opt-in. The request reaches the admins only after the e-mail address is confirmed. The password is set later via the WordPress password link.
* **Local bot protection:** honeypot, signed time stamp, rate limit (salted IP hash only, temporary), arithmetic task or your own security question, disposable address list, optional DNS/MX check. Cloudflare Turnstile is optional and off by default.
* **Approval screen** (Users → FeG Intern approvals): approve with a role, reject or delete. Decisions are logged without IP addresses. Pending accounts cannot log in.
* **Login** `[feg_intern_login]` and logout link `[feg_intern_logout]`. Member roles can be kept out of the dashboard.
* **My account** `[feg_intern_konto]`: members change their name, e-mail address and password and log out without the dashboard. Optional automatic "Log in" / "Log out" menu entry.
* **Access per page/post** by role. Protected content is hidden from search, feeds, REST API, sitemaps and menus and sent with noindex / no-cache headers.
* **Protected document library** `[feg_intern_ablage]`: folder cards, search, drag & drop upload, versions, per-folder permissions, "strict" folders that even administrators cannot open, download only after login and role check, security self-test, audit log, one server backup ZIP, import from the media library.
* **Quiet mode** (on after installation): no e-mails to users until you switch it off.
* Import of page restrictions from Ultimate Member (read only, with preview).
* Translation ready (translations via translate.wordpress.org).

The plugin is free. If it helps your church, a donation is welcome (link on the settings page).

**Not official:** This plugin is not affiliated with or endorsed by the Bund Freier evangelischer Gemeinden in Deutschland KdöR. "FeG" only describes who the plugin was made for.

= Privacy =

Stored: registration data (name, e-mail, message, time of consent), the decision log and the library log (no IP addresses). Unconfirmed requests expire (default 48 hours). For the rate limit only a salted, daily changing IP hash is kept for a short time. Personal data exporter and eraser are included. Nothing is sent to the plugin author.

= External services =

By default the plugin uses no external service.

**Cloudflare Turnstile (optional, off by default).** Only if you tick "Use Cloudflare Turnstile on the registration form" and enter your keys, the registration page loads `https://challenges.cloudflare.com/turnstile/v0/api.js` in the visitor's browser (Cloudflare then receives the visitor's IP address and browser data), and on submit the plugin sends the Turnstile answer and your secret key to `https://challenges.cloudflare.com/turnstile/v0/siteverify` to check that the visitor is human. Cloudflare terms: https://www.cloudflare.com/website-terms/ – Privacy policy: https://www.cloudflare.com/privacypolicy/

The security self-test only requests a test file on your own website. The optional DNS/MX check uses your server's DNS resolver.

= Daily use =

* **New request:** a person fills in the registration form and confirms the e-mail address. Then the admins get a notice.
* **Approve:** Users → FeG Intern approvals. Choose a role and click approve; the person gets an e-mail to set the password. Or reject, or delete the account. Every decision is logged.
* **Log in:** members use the login page. With "My account" they change name, e-mail address and password and log out without the dashboard.
* **Protect a page:** in the editor tick the allowed roles in the box "FeG Intern: Access".
* **Find files:** members open the document library, click a folder card or use the search. Downloads work only after login and with the right role.
* **Upload:** people with upload rights click "Upload files" and drag the files in. A file with the same name in the same folder becomes a new version; older versions stay available.
* **Manage the library** (menu "Document library"): Files (move, delete, versions), Folders & permissions (new folders, roles per folder, "strict"), Import from media library, Backup (one ZIP), Log, Settings (file types, size, self-test).
* **Quiet mode:** as long as it is on, users get no e-mails. Switch it off under Settings → FeG Intern when everything works.

= Support =

Questions or problems? Write to eduardwiebe77@gmail.com. Please include your WordPress version and what you did before the problem appeared.

== Installation ==

1. Install the plugin via Plugins → Add New, or upload the ZIP. Activate it.
2. Create pages: login `[feg_intern_login]`, registration `[feg_intern_registrierung]` and a start page for the internal area.
3. Choose these pages, the assignable roles and notification addresses under Settings → FeG Intern.
4. Protect pages with the box "FeG Intern: Access" in the editor.
5. Put `[feg_intern_ablage]` on a protected page. Check folders and the self-test under Document library.
6. When everything works, switch off the quiet mode (Settings → FeG Intern → E-mails).

== Frequently Asked Questions ==

= Does the plugin contact external servers? =

No. Only if you enable Cloudflare Turnstile yourself (see "External services").

= Are files in the media library protected? =

No. Media library files can always be opened by their direct link. Use the protected document library instead.

= How safe is the document library? =

Files are delivered only after login and a role check. On Apache an `.htaccess` file blocks direct links; on nginx you need a server rule or the constant `FEGI_LIB_DIR` pointing outside the web root. The self-test tells you whether direct access is blocked. People with access to the server itself (hosting, FTP) can still read the files.

= What happens on uninstall? =

By default nothing is deleted. Deleting settings/logs and deleting library files are two separate options. User accounts are never deleted.

= Is this an official FeG plugin? =

No. It is a private, free project. It is not affiliated with the Bund FeG.

= Where can I get help? =

Write an e-mail to eduardwiebe77@gmail.com.

== Screenshots ==

1. Login form.
2. Registration form with security question and privacy consent.
3. Approval screen for new registrations.
4. Settings: pages, e-mails and approval.
5. Document library for members (folder cards and search).
6. Document library admin: files, versions and upload.
7. Folders and permissions per role.
8. Library settings with security self-test.

== Changelog ==

= 1.2.9 =
* Security: nonces are verified before any request data is read (approval and library admin actions); capability checks unchanged.
* Uploads to the protected library now use wp_handle_upload().
* Removed an unnecessary direct include of a core admin file.
* Activation no longer requires the PHP mbstring extension (fallbacks added).
* Admin notices are limited to the plugin's own screens and the Plugins screen.

= 1.2.8 =
* New plugin name "Gemeindetresor – geschützte Ablage für FeG-Gemeinden"; slug and text domain `gemeindetresor`.
* Bundled .po/.mo translation files removed; translations come from translate.wordpress.org. No functional changes; options, shortcodes, roles and stored data unchanged.

= 1.2.7 =
* Login form `[feg_intern_login]` redesigned as a small centred card like the WordPress login: every label above its field, all fields and the "Log in" button exactly the same width, "Stay logged in" aligned, "Forgot your password?" and "Request access" centred below the card. Clean on phones (16px fields, no zoom, no horizontal scrolling).
* Registration form `[feg_intern_registrierung]` in the same card look: labels above the fields, equal field widths, consent checkbox aligned with its text, full-width button. Messages have the same width as the card.
* "Change my details" in the "My account" box: one column, every field the same width as the login card, the password part as a heading with a line instead of an indented box, full-width save button. Accent colour now the green of the theme (var(--php-c-primary)), like the login card and the document library.
* All layout rules are scoped to the plugin's own containers and protected against theme styles (inline labels, fixed widths), so the forms look the same with any theme. Presentation only; no change to login, registration, permissions or stored data.

= 1.2.6 =
* New "My account" box `[feg_intern_konto]` for logged-in members: greeting, change first name, last name and e-mail address, set a new password (twice, with a strength hint) and a "Log out" button. Changing the e-mail address or the password needs the current password; after 5 wrong attempts the form pauses for 15 minutes. Saved with nonce, sanitising and wp_update_user(); clear messages in plain language. Visitors who are not logged in see a short note with a link to the login page.
* The box is shown automatically at the top of the internal start page (setting, on by default) and not twice if the shortcode is already on the page.
* Automatic menu entry (setting, on by default): "Log in" for visitors and "Log out" for logged-in people at the end of the menu shown in the header. The menu can be chosen in the settings; "Automatic" uses the menu with the link to the internal area. The entry is a real menu item, so the theme gives it the same look as the other entries.
* Settings page: new section "Log in, log out and my account".
* Clean on phones: full-width fields and buttons, first and last name side by side from tablet width.

= 1.2.5 =
* Document library → "Files" redesigned as folder tiles in the look of the library on the website ([feg_intern_ablage]): icon, name, short description, number of files, subfolder names and the "Strictly protected" badge. Tiles sit side by side on desktop and tablet and stack on phones.
* A tile opens in place and shows its subfolders as small tiles and its files as clean rows with date, size, uploader and versions, plus Download, Move (with folder selection), Delete and the older versions.
* Strictly protected folders the administrator may not open are shown as a locked tile without contents.
* The library stylesheet is now also loaded on the document library admin screen (scoped, in admin blue).
* Layout only: no change to fields, permissions, saving or stored data.

= 1.2.4 =
* Document library → "Settings" rebuilt as clear cards (Upload, Notification, Storage, Automatic backup, Log, Self-test, Uninstall). The maximum size has its unit right next to the field, the allowed file types form a tidy grid (two columns on phones), selects are full width on phones.
* Security self-test: a clear status line at the top ("The protected folder is locked from outside." or a warning); the technical server instructions (nginx, wp-config) are now in a collapsed "Technical notes for the webmaster" box.
* "Import from media library", "Backup" and "Log" tabs, the plugin settings page and the approvals page tidied for phones: tables become stacked cards, role lists become checkbox grids, tabs form an even grid.
* The admin stylesheet is now also loaded on the plugin settings page and the approvals page.
* Layout only: no change to fields, permissions, saving or stored data.

= 1.2.3 =
* "Folders & permissions" redesigned (desktop and phone): one card per top-level folder with its name as heading and the short description as text; name and description are edited behind an "Edit name and description" toggle with full-width fields. Permissions as tidy two-column checkbox lists with headings, "Strict" next to them (below on phones). Subfolders as a plain list with an "Edit" toggle each. Buttons of equal width; on phones the tabs form an even grid.
* "Files" tab on phones: each top-level folder is a card with its subfolders nested, files as stacked rows.
* New stylesheet `assets/css/admin.css`, loaded only on the document library screen. Inline layout styles moved there.
* Folder cards in `[feg_intern_ablage]` no longer overflow on narrow screens.
* Layout only: no change to fields, permissions, saving or stored data.

= 1.2.2 =
* Prepared for WordPress.org: name "Gemeinde Intern für FeG", slug and text domain `gemeinde-intern-fur-feg`.
* Security hardening: all HTML output is escaped late with `wp_kses()`; inline JavaScript handlers moved to an enqueued admin script.
* Removed redundant `suppress_filters` arguments (no change in behaviour).
* German translation completed.

= 1.2.1 =
* Document library overview: "Recently added" list removed; files are shown inside their folders.
* Folder card titles no longer hyphenate mid-word.

Older entries: see `changelog.txt`.

== Deutsche Anleitung ==

Gemeindetresor ist ein interner Bereich für Gemeinde-Webseiten: Registrierung, Freigabe, geschützte Seiten und eine geschützte Ablage. Kostenlos. Kein offizielles Plugin des Bundes FeG.

= Installation =

1. Plugins → Installieren, „Gemeindetresor“ suchen (oder ZIP hochladen) und aktivieren.

= Einrichtung =

1. Drei Seiten anlegen: „Anmelden“ mit `[feg_intern_login]`, „Zugang beantragen“ mit `[feg_intern_registrierung]` und eine Startseite für den internen Bereich.
2. Unter Einstellungen → FeG Intern diese Seiten auswählen, Rollen und E-Mail-Adressen für Benachrichtigungen eintragen.
3. Auf der Startseite `[feg_intern_ablage]` einfügen und in der Box „FeG Intern: Zugriff“ die erlaubten Rollen ankreuzen.
4. Unter Ablage → Einstellungen prüfen, ob der Selbsttest „Bestanden“ zeigt.
5. Zum Schluss den Stillmodus ausschalten, damit E-Mails an Benutzer verschickt werden.

= Benutzung =

1. Neue Anfragen erscheinen unter Benutzer → FeG Intern Freigaben. Rolle wählen und „Freigeben“ klicken. Die Person bekommt eine E-Mail zum Setzen des Passworts.
2. Mitglieder melden sich auf der Seite „Anmelden“ an und sehen die Ablage.
3. Wer Upload-Rechte hat, lädt Dateien mit „Dateien hochladen“ hoch.

= FAQ =

**Werden Daten an fremde Server geschickt?** Nein. Nur wenn Sie Cloudflare Turnstile selbst einschalten.

**Sind Dateien in der Mediathek geschützt?** Nein. Vertrauliche Dateien gehören in die Ablage.

**Wo bekomme ich Hilfe?** Schreiben Sie eine E-Mail an eduardwiebe77@gmail.com.

**Was passiert beim Löschen des Plugins?** Standardmäßig wird nichts gelöscht. Benutzerkonten werden nie gelöscht.
