Fix: Menu system bug and donations plugin functionality#145
Fix: Menu system bug and donations plugin functionality#145demorgon989 wants to merge 15 commits intoRedDragonWebDesign:masterfrom
Conversation
MENU SYSTEM FIXES: - Fixed saveMenuItem() to query database for correct menu item ID - Fixed savePoll() with same database query approach - Fixed donation campaign menu items to save correctly - Added prefix support for donation menu items - Works on fresh installs without repair scripts DONATIONS PLUGIN FIXES: - Fixed campaign.php to work correctly once installed - Added query guards to prevent SQL errors with invalid campaign IDs - Improved duplicate filtering in populateDonationInfo() and getDonators() - Made queries MySQL strict mode compliant - Added comprehensive error handling and validation ROOT CAUSE: During afterSave callbacks, menuItemObj contained wrong menu item ID, causing new menu items to update existing records (often Home menu item). SOLUTION: Query database directly using itemname + menucategory_id + itemtype to find the actual menu item ID instead of trusting the object state. IMPACT: - Resolves menu creation/editing issues for ALL menu item types - Donations plugin now works properly after installation - Both fixes are backward compatible and production-ready Files Modified: - src/members/include/admin/managemenu/_functions.php - src/plugins/donations/include/menu_module.php - src/plugins/donations/classes/campaign.php
- Added DOCKER_INSTALL.md with step-by-step Docker setup instructions - Includes both development (local) and production (domain + HTTPS) configurations - Covers prerequisites, container setup, NGINX configuration, and troubleshooting - Updated README.md to prominently feature Docker installation option - All examples use placeholder domains and secure credential placeholders - Production-ready with security best practices and recommendations
Updated the readme to reflect improvements made by Demorgon,
- Add GD extension with JPEG and FreeType support for CAPTCHA functionality - Include essential system dependencies (libpng-dev, libjpeg-dev, libfreetype6-dev) - Add mbstring, exif, pcntl, and bcmath PHP extensions - Include development utilities (zip, unzip, mysql-client) - Improve container functionality and security features
- Fix mysqli::real_escape_string() null parameter in basic.php - Fix explode() null parameter in ipban.php - Use null coalescing operator (??) to provide empty string fallback - Maintains backward compatibility with PHP 7.0+ - Eliminates deprecation warnings in PHP 8.1 environments - Tested on live environment with full functionality confirmed
- Fix undefined array key 'p' parameter in donations index.php - Fix undefined 'value' key in form.php textarea components - Fix undefined \ variable in campaign.php - Add comprehensive fallback handling for currency information - Use null coalescing operators for robust error handling - Tested on live environment - all warnings eliminated - Maintains full PayPal integration and donation functionality
- Hide Twitter plugin from available plugins list in admin panel - Add explanatory note about deprecated plugins due to API changes - Prevent installation attempts that would cause JavaScript errors - Maintain backward compatibility for existing installations - Twitter API v1.1 deprecated, plugin no longer functional with X.com
YouTube Plugin Fixes: - Fix path resolution in youtube.php for settings page access - Fix OAuth callback URL consistency for reliable authentication - Add automatic www. domain handling for universal compatibility - Ensure callback URLs match between auth request and token exchange Plugin Deprecation Improvements: - Standardize all deprecated plugin status to 'API Deprecated' - Simplify deprecation notice text for clarity - Consistent messaging for Twitter, Facebook, and Twitch plugins These changes restore YouTube Connect functionality while maintaining backward compatibility and making the fork universally deployable.
- Initialize checkVideos array with predefined indices to prevent undefined key warnings - Maintains existing functionality while ensuring PHP 8.1 compatibility - Resolves 'Undefined array key 1' warning on YouTube Connect page
| public $donationAmounts; | ||
| private $arrDonatorList; | ||
| private function logDebug($message) { | ||
| $logFile = BASE_DIRECTORY."plugins/donations/debug.log"; |
There was a problem hiding this comment.
Why did this file lose all of its indentation?
|
|
||
| ## This Fork's Improvements | ||
|
|
||
| This fork by [Demorgon](https://github.com/demorgon989) includes the following critical bug fixes and enhancements: |
There was a problem hiding this comment.
This isn't your fork. Would need to remove your name from here.
|
|
||
| This fork by [Demorgon](https://github.com/demorgon989) includes the following critical bug fixes and enhancements: | ||
|
|
||
| - ** Fixed Menu System Bug**: Resolved a critical issue where creating/editing menu items would update wrong database records. The problem occurred because `menuItemObj` contained incorrect menu item IDs during `afterSave` callbacks, causing new menu items to overwrite existing ones (often the Home menu item). |
There was a problem hiding this comment.
Should probably split this patch into 3 PRs, one for each bullet. Smaller patches are easier to review.
| - Reduce # of SQL queries | ||
| - Lint the code | ||
| - Create developer documentation - see [the wiki](https://github.com/RedDragonWebDesign/BlueThrust5/wiki) | ||
| - Reduce # of SQL queries |
There was a problem hiding this comment.
I think your text editor did something weird down here. These shouldn't really be in the diff.
|
|
||
| If you like this fork or found it useful, please consider leaving us a star. It lets me know that folks are interested in the project and that I should spend more time on it. | ||
|
|
||
| ## This Fork's Improvements |
There was a problem hiding this comment.
I don't think we need this section of the readme. This is going to turn into a manual log of every patch we do, which is a maintenance burden. Folks can just check the commit history, PR history, issue history, etc.
|
Also, CI (the linter job) is failing. Fixing that file with no tabs/indents in it will fix most of the linter errors. |
Major Changes: - Replaced TinyMCE 3.5.7 with TinyMCE 8.1.2 (GPL licensed) - Created jquery.tinymce.js compatibility layer for backward compatibility - Updated form.php to use modern TinyMCE 8 API - Removed nested script tag issue in richTextboxJS() - Commented out CKEditor reference in viewtopic.php Key Features: - Dark theme detection for btcs4/ghost/battlecity/dark themes - Custom BBCode Quote and Code buttons preserved - Automatic toolbar button syntax conversion (comma to space) - GPL license key configuration for open source usage - Suffix '.min' configuration for proper file loading Technical Details: - jquery.tinymce.js bridges TinyMCE 3 syntax to TinyMCE 8 - Converts toolbar button lists from comma-separated to space-separated - Script URL conversion: tiny_mce.js -> tinymce.min.js - Content CSS detection for automatic dark theme switching - Width/margin CSS overrides for better layout control Testing Completed: - Editor loads with full toolbar on console and edit post pages - Dark theme (oxide-dark) applies correctly for btcs4 theme - BBCode buttons insert proper [quote] and [code] tags - Form submission and content saving works properly - jQuery 1.6.4 compatibility maintained
- Destiny theme now uses light editor instead of dark - Ghost theme continues to use dark editor - Improved theme detection logic for better theme compatibility
- Added TinyMCE upgrade details to fork improvements section - Listed version jump, security benefits, and new features - Included custom BBCode buttons and theme detection features
MENU SYSTEM FIXES:
DONATIONS PLUGIN FIXES:
ROOT CAUSE: During afterSave callbacks, menuItemObj contained wrong menu item ID,
causing new menu items to update existing records (often Home menu item).
SOLUTION: Query database directly using itemname + menucategory_id + itemtype
to find the actual menu item ID instead of trusting the object state.
IMPACT:
Files Modified: