WP Manifestindependent plugin directory
manifest / developer / wpmudev-plugin-test

WPMU DEV Plugin Test - Forminator Developer Position

WPMU DEV Plugin Test - WordPress plugin for Google Drive integration with OAuth, file management, and automated posts maintenance

by PLEASE ADD YOU FULL NAME HERE · github.com/e-crea8/wpmudev-plugin-test

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/e-crea8/wpmudev-plugin-test/archive/refs/heads/main.zip

WPMUDEV Test Plugin

A comprehensive WordPress plugin demonstrating advanced plugin development techniques including:

  • Google Drive API integration with OAuth 2.0
  • React-based admin interfaces
  • REST API endpoints
  • Background processing with AJAX
  • WP-CLI commands
  • Automated testing
  • Dependency management

All 10 competency-based tasks completed!

Features

1. Google Drive Integration

  • OAuth 2.0 authentication with Google
  • Upload files to Google Drive
  • Create folders in Google Drive
  • List and download files
  • Modern React-based UI with full internationalization

2. Posts Maintenance

  • Scan all public posts and pages
  • Update post metadata automatically
  • Background processing with progress tracking
  • Scheduled daily automatic scans
  • WP-CLI commands for automation

3. Production-Ready Code

  • Complete test coverage (31 unit tests)
  • Security best practices (encryption, validation, sanitization)
  • WordPress Coding Standards compliant
  • Performance optimized with batch processing
  • Dependency conflict prevention

Documentation

Quick Start

Prerequisites

  • WordPress 6.1 or higher
  • PHP 7.4 or higher
  • Node.js and npm
  • Composer

Installation

# 1. Navigate to plugin directory
cd wp-content/plugins/wpmudev-plugin-test

# 2. Install PHP dependencies
composer install

# 3. Install Node dependencies
npm install

# 4. Compile assets
npm run compile

# 5. Activate plugin in WordPress admin
# Navigate to Plugins → Installed Plugins → Activate "WPMU DEV Plugin Test"

Google Drive Setup

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable Google Drive API
  4. Create OAuth 2.0 credentials
  5. Add authorized redirect URI: https://yoursite.com/wp-json/wpmudev/v1/drive/callback
  6. Copy Client ID and Client Secret
  7. In WordPress admin, go to "Google Drive Test"
  8. Enter credentials and authenticate

Posts Maintenance Setup

  1. Go to "Posts Maintenance" in WordPress admin
  2. Select post types to scan
  3. Click "Start Scan"
  4. Daily scans run automatically at midnight

Development

Composer

Install composer packages:

composer install

Build Tasks (npm)

Command Action
npm run watch Compiles and watches for changes
npm run compile Compile production-ready assets
npm run build Build production-ready bundle inside /build/ folder

Testing

# Run all tests
phpunit

# Run specific test file
phpunit tests/test-posts-maintenance.php

# Run with coverage
phpunit --coverage-html coverage/

WP-CLI Commands

# Scan all posts
wp wpmudev-test scan-posts

# Scan specific post types
wp wpmudev-test scan-posts --post-types=post,page

# Get scan statistics
wp wpmudev-test scan-stats --format=table

# Clear scan metadata
wp wpmudev-test clear-scan --yes

REST API Endpoints

Endpoint Method Description
/wpmudev/v1/drive/save-credentials POST Save Google OAuth credentials
/wpmudev/v1/drive/auth POST Start OAuth authentication
/wpmudev/v1/drive/callback GET OAuth callback handler
/wpmudev/v1/drive/files GET List Google Drive files
/wpmudev/v1/drive/upload POST Upload file to Drive
/wpmudev/v1/drive/download GET Download file from Drive
/wpmudev/v1/drive/create-folder POST Create folder in Drive

Admin Pages

Google Drive Test

Location: Admin Menu → Google Drive Test
Features:

  • Credential management
  • OAuth authentication
  • File upload with progress
  • Folder creation
  • File listing and download

Posts Maintenance

Location: Admin Menu → Posts Maintenance
Features:

  • Configurable post type scanning
  • Progress tracking
  • Batch processing
  • Daily scheduled scans
  • Scan statistics and history

Technical Details

Architecture

  • Namespace: WPMUDEV\PluginTest
  • Pattern: Singleton for all major classes
  • Frontend: React 18 with WordPress Components
  • Backend: REST API with proper authentication
  • Storage: WordPress Options API
  • Cron: WordPress Cron API

Security Features

  • Nonce verification for AJAX
  • Capability checks (manage_options)
  • Input validation and sanitization
  • Output escaping
  • Credential encryption (AES-256-CBC)
  • CSRF protection with state tokens
  • SQL injection prevention

Performance Optimization

  • Batch processing (configurable size)
  • Memory management for large datasets
  • Optimized database queries
  • Pagination support
  • Progress persistence
  • Asset minification

File Structure

wpmudev-plugin-test/
├── core/                      # Core framework classes
│   ├── class-base.php        # Base singleton class
│   ├── class-loader.php      # Plugin bootstrapper
│   ├── class-singleton.php   # Singleton pattern
│   └── class-cli.php         # WP-CLI commands
├── app/                      # Application layer
│   ├── admin-pages/          # Admin page controllers
│   │   ├── class-googledrive-settings.php
│   │   └── class-posts-maintenance.php
│   └── endpoints/            # REST API endpoints
│       └── v1/
│           └── class-googledrive-rest.php
├── src/                      # React source files
│   └── googledrive-page/
│       ├── main.jsx
│       └── scss/style.scss
├── assets/                   # Compiled assets
│   ├── js/
│   └── css/
├── tests/                    # PHPUnit tests
│   ├── test-posts-maintenance.php
│   └── test-drive-api.php
├── languages/               # Translation files
└── vendor/                  # Composer dependencies

Troubleshooting

Google Drive authentication fails

  • Verify OAuth credentials are correct
  • Check redirect URI matches exactly
  • Ensure Google Drive API is enabled
  • Check for HTTPS requirement in production

Posts scan doesn't complete

  • Check PHP memory limit
  • Reduce batch size
  • Check for JavaScript errors in console
  • Verify user has manage_options capability

Build fails

  • Run npm install and composer install
  • Check Node.js version (12+ required)
  • Clear node_modules and reinstall
  • Check for disk space

Support

For issues or questions:

  1. Check documentation files
  2. Review inline code comments
  3. Run unit tests to verify functionality
  4. Check WordPress debug.log

Credits

Developed for: WPMU DEV - Forminator Developer Position
WordPress Version: 6.1+
PHP Version: 7.4+
License: GPL-2.0-or-later

Changelog

Version 1.0.0 (January 2025)

  • ✅ Complete Google Drive integration with React UI
  • ✅ Full OAuth 2.0 authentication flow
  • ✅ Posts Maintenance with background processing
  • ✅ WP-CLI commands for automation
  • ✅ Comprehensive unit test coverage
  • ✅ Dependency management with PHP-Scoper
  • ✅ Production-ready build optimization
  • ✅ Complete documentation

Status: All 10 competency-based tasks completed ✅
Test Coverage: 31 unit tests passing
Code Quality: WordPress Coding Standards compliant
Documentation: 2,500+ lines