Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions TECHNICAL.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
### Support Email Diagnostic Info

The "Support E-Mail" link on the CommonsBooking admin dashboard (`CommonsBooking → Dashboard`) pre-fills an email to `mail@commonsbooking.org` with a diagnostic snapshot of the installation. This reduces back-and-forth by ensuring support requests arrive with the context needed to reproduce issues.

**Code location:** `templates/dashboard-index.php`

The body is built as a plain PHP string and passed through `rawurlencode()` before being placed in the `mailto:` href. The link is output via `esc_attr()`.

#### Fields included

| Field | Source | Notes |
|---|---|---|
| Installations-URL | `home_url()` | Always |
| WP-Version | `get_bloginfo('version')` | Always |
| PHP-Version | `phpversion()` | Always |
| CB-Version | `COMMONSBOOKING_VERSION` | Always |
| Theme | `wp_get_theme()->get('Name'/'Version')` | Always |
| Locale | `get_locale()` | Always |
| WP_DEBUG | `defined('WP_DEBUG') && WP_DEBUG` | Always |
| PHP-Memory-Limit | `ini_get('memory_limit')` | Always |
| Permalink-Structure | `get_option('permalink_structure')` | Always |
| Multisite | `is_multisite()` | Only when true |
| WP-Cron | `DISABLE_WP_CRON` constant | Only when disabled |
| External-Object-Cache | `wp_using_ext_object_cache()` | Only when active |
| Active known-problematic plugins/themes | `is_plugin_active()` + `wp_get_theme()` | Only when any are active |
| Max-Upload-Size | `wp_max_upload_size()` | Always |
| CB Settings | `get_option('commonsbooking_options_*')` | Always (booking comments, iCal, API, cache adapter, bookings page) |
| Active plugins | `get_plugins()` + `get_option('active_plugins')` | Always |

#### Adding a new field

Append a line to `$support_body` inside the PHP block before `$support_href` is built:

```php
$support_body .= 'My-Field: ' . my_wp_function() . "\r\n";
```

For conditional fields (only shown when non-default), wrap in an `if`:

```php
if ( some_condition() ) {
$support_body .= 'My-Flag: active' . "\r\n";
}
```

#### Maintaining the known-problematic plugin list

The `$known_problematic_plugins` array maps plugin file paths (as registered in WordPress) to human-readable names. The list is sourced from the [FAQ](docs/en/documentation/faq/problems-and-answers.md). When a new incompatibility is documented in the FAQ, add it here too:

```php
$known_problematic_plugins = [
// ...
'new-plugin/new-plugin.php' => 'New Plugin Display Name',
];
```

The plugin file path is always `folder-name/main-file.php` — the same string stored in the `active_plugins` option.

---

### Formatter

We adhere to [PHPCS](https://github.com/PHPCSStandards/PHP_CodeSniffer) rules defined in the [phpcs.xml](https://github.com/wielebenwir/commonsbooking/blob/master/.phpcs.xml.dist) rules file, as it is a mature tool and well established in the Wordpress-Plugin development scene.
Expand Down
24 changes: 23 additions & 1 deletion docs/de/documentation/faq/problems-and-answers.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
# Probleme und Antworten
# Probleme und Antworten

## Was sendet der „Support E-Mail"-Link?

Der Link **Support E-Mail** im CommonsBooking-Dashboard (`CommonsBooking → Dashboard`) öffnet dein E-Mail-Programm mit einer vorausgefüllten Nachricht, die eine Diagnosezusammenfassung deiner Installation enthält. So kann das Support-Team dein Problem nachvollziehen und lösen, ohne zunächst Rückfragen stellen zu müssen.

Folgende Informationen werden automatisch eingefügt:

- **Website-URL** — die Adresse deiner WordPress-Installation
- **WordPress-Version**, **PHP-Version**, **CommonsBooking-Version**
- **Aktives Theme** (Name und Version)
- **Locale** (Spracheinstellung)
- **WP_DEBUG**-Status (aktiviert/deaktiviert)
- **PHP-Speicherlimit**
- **Permalink-Struktur**
- **CB-Einstellungen** — ob Buchungskommentare, der iCal-Feed und die API aktiviert sind, der verwendete Cache-Adapter sowie die konfigurierte Buchungsseite
- **Maximale Upload-Größe**
- **Alle aktiven Plugins** mit ihren Versionen
- Alle derzeit aktiven **bekannten inkompatiblen Plugins oder Themes** (siehe Abschnitte weiter unten)

Falls deine Installation ein **WordPress-Multisite**-Netzwerk ist, **WP Cron deaktiviert** hat oder einen **externen Objekt-Cache** (z. B. Redis oder Memcached) verwendet, wird dies ebenfalls vermerkt — jedoch nur, wenn es zutrifft, damit die E-Mail übersichtlich bleibt.

Passwörter, Nutzerdaten oder Buchungsinhalte werden nicht übermittelt. Du kannst die vorausgefüllte Nachricht vor dem Senden einsehen und bearbeiten.

### Anzeige Kalender-Widget im Admin-Bereich

Expand Down
22 changes: 22 additions & 0 deletions docs/en/documentation/faq/problems-and-answers.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Problems and answers

## What does the Support E-Mail link send?

The **Support E-Mail** link on the CommonsBooking dashboard (`CommonsBooking → Dashboard`) opens your email client with a pre-filled message body containing a diagnostic snapshot of your installation. This helps the support team reproduce and diagnose your issue without needing to ask follow-up questions.

The following information is included automatically:

- **Site URL** — the address of your WordPress installation
- **WordPress version**, **PHP version**, **CommonsBooking version**
- **Active theme** name and version
- **Locale** (language setting)
- **WP_DEBUG** status (enabled/disabled)
- **PHP memory limit**
- **Permalink structure**
- **CB settings** — whether booking comments, the iCal feed, and the API are enabled, the cache adapter in use, and the configured bookings page
- **Max upload size**
- **All active plugins** with their versions
- Any **known-incompatible plugins or themes** that are currently active (see sections below)

If your installation is a **WordPress Multisite**, has **WP Cron disabled**, or uses an **external object cache** (e.g. Redis or Memcached), those facts are noted as well — but only when they apply, to keep the email tidy otherwise.

No passwords, user data, or booking content is included. You can review and edit the pre-filled message before sending it.

### Calendar widget display in the admin area

If there are problems displaying the calendar in the booking admin area (the admin backend), see the image below on the right, one possible solution is to disable or remove and reinstall the ["Lightstart" (wp-maintenance-mode) plugin](https://wordpress.org/plugins/wp-maintenance-mode).
Expand Down
82 changes: 81 additions & 1 deletion templates/dashboard-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,87 @@
<h3><?php echo esc_html__( 'Support', 'commonsbooking' ); ?></h3>
<ul>
<li><a href="https://commonsbooking.org/documentation" target="_blank"><?php echo esc_html__( 'Documentation & Tutorials', 'commonsbooking' ); ?></a></li>
<li><a href="mailto:mail@commonsbooking.org?body=%0D%0A%0D%0A-----------%0D%0A%0D%0AInstallations-URL: <?php echo home_url(); ?>%0D%0A%0D%0ACB-Version: <?php echo commonsbooking_sanitizeHTML( COMMONSBOOKING_VERSION ); ?>" target="_blank"><?php echo esc_html__( 'Support E-Mail', 'commonsbooking' ); ?></a></li>
<?php
$support_body = "\r\n\r\n-----------\r\n\r\n";
$support_body .= 'Installations-URL: ' . home_url() . "\r\n\r\n";
$support_body .= 'WP-Version: ' . get_bloginfo( 'version' ) . "\r\n";
$support_body .= 'PHP-Version: ' . phpversion() . "\r\n";
$support_body .= 'CB-Version: ' . COMMONSBOOKING_VERSION . "\r\n";
$support_body .= 'Theme: ' . wp_get_theme()->get( 'Name' ) . ' ' . wp_get_theme()->get( 'Version' ) . "\r\n";
$support_body .= 'Locale: ' . get_locale() . "\r\n";
$support_body .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) && WP_DEBUG ? 'enabled' : 'disabled' ) . "\r\n";
$support_body .= 'PHP-Memory-Limit: ' . ini_get( 'memory_limit' ) . "\r\n";
$support_body .= 'Permalink-Structure: ' . ( get_option( 'permalink_structure' ) ?: '(default/plain)' ) . "\r\n";

if ( is_multisite() ) {
$support_body .= 'Multisite: yes' . "\r\n";
}
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
$support_body .= 'WP-Cron: disabled' . "\r\n";
}
if ( wp_using_ext_object_cache() ) {
$support_body .= 'External-Object-Cache: active' . "\r\n";
}

// Check for known incompatible plugins (see FAQ)
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$known_problematic_plugins = [
'wp-maintenance-mode/wp-maintenance-mode.php' => 'Lightstart (wp-maintenance-mode)',
'all-in-one-event-calendar/all-in-one-event-calendar.php' => 'All-in-One Event Calendar',
'redis-cache/redis-cache.php' => 'Redis Object Cache',
'ultimate-member/ultimate-member.php' => 'Ultimate Member',
'autoptimize/autoptimize.php' => 'Autoptimize',
];
$active_problematic = [];
foreach ( $known_problematic_plugins as $plugin_file => $plugin_name ) {
if ( is_plugin_active( $plugin_file ) ) {
$active_problematic[] = $plugin_name;
}
}
// Also check for the incompatible GridBulletin theme
if ( 'gridbulletin' === wp_get_theme()->get_template() ) {
$active_problematic[] = 'GridBulletin (active theme)';
}
if ( $active_problematic ) {
$support_body .= "\r\nActive known-problematic plugins/themes:\r\n";
foreach ( $active_problematic as $name ) {
$support_body .= ' - ' . $name . "\r\n";
}
}

$support_body .= 'Max-Upload-Size: ' . size_format( wp_max_upload_size() ) . "\r\n";

$cb_general = get_option( 'commonsbooking_options_general', [] );
$cb_advanced = get_option( 'commonsbooking_options_advanced-options', [] );
$cb_api = get_option( 'commonsbooking_options_api', [] );
$support_body .= "\r\nCB Settings:\r\n";
$support_body .= ' Booking-Comments: ' . ( ! empty( $cb_general['booking-comment-active'] ) ? 'enabled' : 'disabled' ) . "\r\n";
$support_body .= ' iCal-Feed: ' . ( ! empty( $cb_advanced['feed_enabled'] ) ? 'enabled' : 'disabled' ) . "\r\n";
$support_body .= ' API: ' . ( ! empty( $cb_api['api-activated'] ) ? 'enabled' : 'disabled' ) . "\r\n";
$support_body .= ' Cache-Adapter: ' . ( $cb_advanced['cache_adapter'] ?? 'filesystem' ) . "\r\n";
$bookings_page_id = $cb_general['bookings_page'] ?? '';
$bookings_page_title = $bookings_page_id ? get_the_title( (int) $bookings_page_id ) : '(not set)';
$support_body .= ' Bookings-Page: ' . $bookings_page_title . ' (ID: ' . ( $bookings_page_id ?: 'none' ) . ')' . "\r\n";

$all_plugins = get_plugins();
$active_plugins = get_option( 'active_plugins', [] );
if ( $active_plugins ) {
$support_body .= "\r\nActive plugins:\r\n";
foreach ( $active_plugins as $plugin_file ) {
$plugin_data = $all_plugins[ $plugin_file ] ?? null;
$plugin_name = $plugin_data ? $plugin_data['Name'] : $plugin_file;
$plugin_version = $plugin_data ? $plugin_data['Version'] : '?';
$support_body .= ' - ' . $plugin_name . ' ' . $plugin_version . "\r\n";
}
}

$support_href = 'mailto:mail@commonsbooking.org'
. '?subject=' . rawurlencode( 'Support Request - CommonsBooking' )
. '&body=' . rawurlencode( $support_body );
?>
<li><a href="<?php echo esc_attr( $support_href ); ?>" target="_blank"><?php echo esc_html__( 'Support E-Mail', 'commonsbooking' ); ?></a></li>
<li><a href="https://commonsbooking.org/contact/" target="_blank"><?php echo __( 'Contact & Newsletter', 'commonsbooking' ); ?></a></li>
</ul>
<p> <?php echo esc_html__( 'CommonsBooking Version', 'commonsbooking' ) . ' ' . commonsbooking_sanitizeHTML( COMMONSBOOKING_VERSION . ' ' . COMMONSBOOKING_VERSION_COMMENT ); ?></p>
Expand Down
Loading