=== Ninja Drive for Google Drive - All-in-One Solution ===
Contributors: plugininja, abdullaharham
Tags: google drive, file manager, embed, gallery, media library
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.0.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect Google Drive with WordPress to browse, manage, embed, and share Drive files and folders directly from your dashboard.

== Description ==

**Ninja Drive** is a complete **Google Drive plugin for WordPress** that lets you connect, browse, and manage your Google Drive directly from the WordPress dashboard. Use it as a WordPress file manager for Google Drive, a media library extension, a Google Drive embed plugin, and a client file sharing tool — all in one.

With Ninja Drive, you can build a file browser, a Google Drive gallery, an embedded document viewer, a media player, and an upload form, all in one plugin.

**Disclaimer:** Ninja Drive is an independent, third-party plugin and is not affiliated with, endorsed by, or an official partner of Google LLC. "Google Drive" and related trademarks belong to Google LLC. Ninja Drive simply connects to the publicly available Google Drive API using your own authorized account.

<a href="https://plugininja.com/ninja-drive/">Official Website</a> | <a href="https://plugininja.com/docs-category/ninja-drive/">Documentation</a> | <a href="https://www.youtube.com/@plugininja" target="_blank">Video Tutorials</a> | <a href="https://plugininja.com/support-portal/" target="_blank">Support</a>

https://youtu.be/D80GjbQT-Qw

#### Ninja Drive is for you if you want to:

* Manage Google Drive files without ever leaving WordPress
* Let visitors or clients upload files directly to your Drive
* Embed documents, videos, audio, galleries, and sliders on any page using widget builder
* Serve downloadable products securely from Google Drive
* Improve your WordPress media library with Google Drive storage and use everywhere through Classic Editor
* Restrict file and folder access by user role, password, or login status

### Features

**Easy Setup** - Quickly connect your account to WordPress and start managing files without complicated configurations.

**Widget Builder** - Create custom display widget to show your files in list, grid, slider, or gallery formats.

**Google Drive File Manager** - Perform complete file operations like upload, download, rename, move, copy, delete, share links, and create folders right from your WordPress dashboard.

**File Browser Widget** - Display a customized Google Drive file browser for chosen folders on your website to allow your user to navigate selected folders.

**Gallery** - Allow users to preview, and download your gallery images and get notifications download notifications via email and admin dashboard.

**Media Library Integration (Pro)** - Use Google Drive files as WordPress media attachments and sync between both platforms.

**Multiple Account Support (Pro)** - Connect multiple accounts and switch between them easily.

**Auto Sync (Pro)** - Automatically sync your Cloud folders when you have been assigned and allowed.

**File Uploader (Pro)** - Enables visitors or clients to upload files directly to your Google Drive account from a public or private page. Have preview mode which is only visible only own uploaded files/image and more options.

**Media Player (Pro)** - Play Google Drive audio and video files (Custom thumbnail) with the option to restrict downloads and create custom playlists width different layouts.

**Search Box Widget (Pro)** - Place a search box anywhere on your site so visitors can search your Google Drive files instantly.

**Slider Carousel Widget (Pro)** - Create interactive sliders to showcase Google Drive images, videos, or documents in a visually engaging way with different layouts.

**One-Click Import to Media Library (Pro)** - Import Google Drive files directly into your WordPress media library with a single click.

**Embed Drive Files** - Embed documents, PDFs, images, audio, videos, and folders directly into posts or pages using blocks, Elementor widgets, or shortcodes.

**Advanced Search** - Easily locate files and folders within your connected Google Drive using powerful search filters.

**File List** - Display files in a structured, readable list, grid, compact, table, gallery, timeline layout for better organization.

**Share & Download Links** - Generate clean public and password protected Share or Download links for your files to share with visitors or team members with the given time. 

**Fully Responsive** - Your file browser, galleries, and embeds adapt perfectly to any device, from desktop to mobile.

**User Access Control (Pro)** - Assigned Folders, manage permissions according to User & Role based.

**Appearance Options** - Customize colors, layouts, and styles to match your website's design.

**Auto Save Feature** - Automatically saves your settings so changes are never lost.

**Notification Emails (Pro)** - Get instant email notifications whenever files are uploaded, downloaded, or deleted.

### Integrations

**Media Library Integration (Pro)** - Use Google Drive files as WordPress media attachments and sync between both platforms.

**Integration for Gutenberg Editor** - Get multiple blocks for embedding files, Galleries, file browsers and more.

**Integration for Elementor** - Access multiple widgets to add content into any Elementor layout using builtin Elementor widgets.

**Classic Editor Integration** - Insert Google Drive files and links directly into Classic Editor content.

**File Uploader for Contact Form 7** - Allow uses to upload images to your selected google drive folder.

**Integration for WooCommerce (Pro)** - Sell Google Drive files through WooCommerce with secure delivery.

**Integration for Easy Digital Downloads (Pro)** - Serve your digital downloads securely from Google Drive.

**Integration for Tutor LMS (Pro)** - Use Google Drive videos and files as LMS course materials and attachments.

**File Uploader for WPForms (Pro)** - Receive User uploaded files from WPForms with filters options.

**File Uploader for Gravity Forms (Pro)** - Receive User uploaded from Gravity Forms file fields.

**File Uploader for Ninja Forms (Pro)** - Receive User uploaded files from Ninja Forms with filters options.

**File Uploader for Formidable Forms (Pro)** - Receive User uploaded files from Formidable with filters options.

**File Uploader for Fluent Forms (Pro)** - Receive User uploaded files from FluentForm with filters options.

== External Services ==
 
This plugin connects to the Google Drive API services to enable integration with your Google Drive account. It allows the plugin to upload, view, edit, and manage files directly from your Google Drive, providing seamless synchronization and document management.

=== What data is sent and when ===
- When you authorize the plugin, it requests permission (OAuth 2.0) to access your Google Drive files.
- The plugin sends authentication tokens and API requests to the Google Drive API endpoints when you perform actions such as uploading, fetching, or editing files.
- No data is shared with any third-party services other than Google.
- The plugin does not store or transmit sensitive user data beyond what is required for Drive access and file operations.

=== Why this data is sent ===
The data exchange is necessary to:
- Retrieve and display Google Drive file lists.
- Upload and manage files within Google Drive.
- Display embedded documents such as Google Sheets or Docs in your WordPress admin or site content.

=== Service provider information ===
**Service Provider:** Google LLC
**Service Used:** Google Drive API
**Terms of Service:** https://policies.google.com/terms
**Privacy Policy:** https://policies.google.com/privacy
**Google Drive API Terms of Service:** https://developers.google.com/workspace/drive/api/terms
**Google API Services User Data Policy:** https://developers.google.com/terms/api-services-user-data-policy

**Service Provider:** Microsoft Corporation
**Service Used:** Office Online Viewer
**Terms of Service:** https://www.microsoft.com/en-us/legal/terms-of-use
**Privacy Policy:** https://www.microsoft.com/en-us/privacy/privacystatement

**Service Provider:** Freemius Inc.
**Service Used:** Freemius - plugin licensing, activation, and usage analytics
**Terms of Service:** https://freemius.com/terms/
**Privacy Policy:** https://freemius.com/privacy-policy/

=== How to revoke access ===
This integration ensures your files are managed securely through Google's trusted infrastructure. You may revoke access at any time from your Google Account's security settings.

Important: After authorization, all communications occur directly between your server and the cloud storage servers over encrypted channels. No data passes through or is stored on our servers, and we do not access or collect your files.

== Contribute ==
Ninja Drive is an open-source project. You can view the full sources (unminified JS) and contribute to the project on GitHub: https://github.com/plugininja/ninja-drive

== Screenshots ==
1. Google Drive file manager inside the WordPress admin dashboard
2. Widget Builder - configure file browser, gallery, slider, and search widgets
3. Front-end Google Drive file browser on a WordPress page
4. Google Drive media player for video and audio files
5. Google Drive gallery and slider carousel layouts
6. Elementor widgets and Gutenberg blocks for Google Drive embeds

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` or install via **Plugins → Add New**
2. Activate the plugin
3. Follow these steps to create Google App credentials and connect your Drive:

### **Create Google Project & App Credentials**

**Step 1: Create a Google Project**
- Go to Google Cloud Console
- Click **"New Project"** or select an existing project
- Enable **Google Drive API** (APIs & Services → Library → Google Drive API → Enable)

**Step 2: Set Up App Information**
- Go to **APIs & Services → OAuth consent screen**
- Add your **app name** and choose audience (**Internal** or **External**)
- Fill in required fields (user support email, developer contact)

**Step 3: Create OAuth Credentials**
- Go to **APIs & Services → Credentials**
- Click **"+ CREATE CREDENTIALS" → "OAuth client ID"**
- Choose **"Web application"**
- **Copy the Redirect URI** from your plugin settings (Ninja Drive → Settings → Own App)
- Paste it in **Authorized redirect URIs**
- Copy your **Client ID** and **Client Secret**

**Step 4: Add Google Drive Permissions (Scopes)**
- The plugin automatically requests: `https://www.googleapis.com/auth/drive`
- This allows full access to files, folders, and sharing permissions

**Step 5: Publish the App (For Multiple Websites)**
- Add more redirect URIs for different sites
- Set publishing status to **"In production"**

**Step 6: Connect in WordPress**
- Go to **Ninja Drive → Settings → Own App**
- Paste your **Client ID** and **Client Secret**
- Click **Authorize** and complete Google OAuth flow

== Frequently Asked Questions ==

= Do files get copied to my server? =
No. Files remain in Google Drive. The plugin streams or embeds them directly.

= How is the security? =
Data is transferred using encrypted keys. No Google Drive account IDs or file IDs are exposed on the frontend. The plugin uses OAuth 2.0 for authentication and secure access to your Google Drive account.

= Can I use my own Google Cloud app? =
Yes. In **Settings → Own App**, enter your OAuth Client ID and Secret.

= Which file types can I embed? =
Most common formats include images, audio, video, PDFs, Google Docs, and many more.

= Can I restrict access to certain files or folders? =
Yes. You can limit visibility by user role, logged-in status, or password-protect modules. Planned updates will allow per-user private folders.

= Can visitors upload files to my Google Drive? =
Yes. The File Uploader Widget and WooCommerce Upload integration allow visitors or customers to upload files directly to your connected Google Drive account.

= Can I embed files in Elementor or Gutenberg? =
Yes. The plugin provides widgets for Elementor and blocks for Gutenberg to embed files, galleries, media players, and upload forms. More integrations are coming soon.

= Is it possible to sell files from Google Drive? =
Yes. You can securely sell downloadable files through WooCommerce or Easy Digital Downloads directly from Google Drive.

= Will it affect my site speed? =
No. The plugin uses caching and pagination for large folders to maintain fast browsing. Files are streamed directly from Google Drive, not hosted on your server.

= Can I search files on Google Drive from my site? =
Yes. The Search Box Widget allows visitors to search your Google Drive files in real-time using advanced filters.

= Can I customize the appearance of file browsers and galleries? =
Yes. You can adjust layouts, colors, styles, and more. Custom CSS support is also coming soon for full control.

= How secure is the connection to Google Drive? =
All communications happen directly between your server and Google Drive over encrypted channels. No files are stored on our servers, and OAuth authentication ensures secure access.

= Can I generate direct download links? =
Yes. The plugin allows you to create clean, direct download links for files without requiring visitors to visit Google Drive.

= Does it support video and audio streaming? =
Yes. The Media Player Widget lets you stream audio and video with optional download restrictions and custom playlists.

= Can I integrate it with other plugins? =
Yes. Currently supported integrations include WooCommerce, Easy Digital Downloads, Tutor LMS, Elementor, ACF, Contact Form 7, Gravity Forms, Ninja Forms, and Formidable Forms. More are planned.

= Can I use my own Google Cloud credentials? =
Yes. Under Settings → Own App, you can enter your OAuth Client ID and Secret to use your own Google Cloud app instead of the default.

= Are file changes reflected automatically? =
Yes. Changes in Google Drive, such as renaming or moving files, are updated automatically in the plugin modules. Auto Sync is also available in the Pro version.

= Does it work on mobile devices? =
Yes. All modules, galleries, file browsers, and embeds are fully responsive and optimized for desktops, tablets, and smartphones.

= Can I use Ninja Drive to create a client file sharing portal? =
Yes. Combine the File Browser, Gallery, and File Uploader widgets with Access Control to build a private client portal where customers can view, upload, and download files from your Google Drive.

== Translation ==
Ninja Drive is translation-ready. If you would like to help translate this plugin into your language, you can contribute via the WordPress.org translation platform for this plugin.

== Shortcodes ==
Use the built-in shortcode builder to generate parameters automatically.
Example: `[ninja-drive id="1"]`

== Changelog ==

= 2.0.1 =
* New: One-click Google authorization is now available in the free version
* New: Full dashboard and file management API now available in the free version
* New: Free users can now delete download and share links
* Improved: Gallery widget spacing and border radius now support per-device responsive values
* Improved: Auth guard refactored with dedicated useAuthGuard hook to eliminate cascading re-render loops
* Fixed: Infinite loading when accounts exist but none is set as active
* Fixed: Premature redirect on page refresh before auth state is resolved from Redux
* Fixed: Redirect now goes to the first accessible page instead of hardcoded /settings/accounts
* Fixed: Redirect blocked before authentication state is fully determined
* Fixed: Search location detection issue
* Fixed: Embed document preview not rendering correctly in the free version
* Fixed: Permission handling issue in file operations

= 2.0.0 =
* New: Elementor widget support - File Browser, Gallery, Embed Documents, Media Player, Search Box, File List, and Slider Carousel widgets for Elementor
* New: Classic Editor integration - insert Google Drive files directly from the Classic Editor toolbar
* New: Contact Form 7 integration - attach Google Drive files to CF7 form submissions
* New: Slider Carousel widget - display Drive images as a responsive, auto-playing slider on the frontend
* New: Form upload integrations for Gravity Forms, Ninja Forms, WPForms, Formidable Forms, and Fluent Forms (premium)
* New: WooCommerce integration - deliver digital products directly from Google Drive (premium)
* New: Easy Digital Downloads integration - serve EDD products from Google Drive (premium)
* New: Media Library integration - use Google Drive as a WordPress media source (premium)
* Improved: File Uploader - folder creation on upload, improved permission handling and redirect support
* Improved: Frontend CSS classes now carry plugin prefix to prevent theme and plugin conflicts
* Improved: Separated admin and frontend vendor scripts for faster page load
* Improved: REST API controllers refactored for better performance and security
* Fixed: Various bug fixes and stability improvements

= 1.0.0 =
* Initial release with file browser, embeds, media player, gallery, search, media library sync, and WooCommerce/LMS support.

== Upgrade Notice ==

= 2.0.1 =
Patch release with auth flow fixes, responsive gallery improvements, and expanded free features including one-click auth, full dashboard access, and delete link support.

= 2.0.0 =
Major release. Adds full Elementor widget suite, Classic Editor integration, Contact Form 7 support, Slider Carousel widget, and several premium integrations (WooCommerce, EDD, form plugins). Review your widget configurations after upgrading.

= 1.0.0 =
Initial release of Ninja Drive