# Google Login & User Registration Implementation Plan

To allow users to seamlessly register, log in, and interact with the Wisdom1 site using their Google accounts, we will use a secure OAuth bridging plugin. This is the industry-standard approach for WordPress.

## Recommended Plugin
**Nextend Social Login and Register**
- Free for Google integration.
- Highly secure (uses native Google OAuth 2.0).
- Does NOT store user passwords.
- Automatically creates a native WordPress "Subscriber" account upon first login, granting them permission to comment.

## Step 1: Google Cloud Configuration (Manual Setup)
Before activating the plugin on the site, you must generate secure OAuth credentials from your Google account.
1. Log into the [Google Developer Console](https://console.cloud.google.com/).
2. Create a new Project (e.g., "Wisdom1 Auth").
3. Navigate to **APIs & Services > OAuth consent screen** and configure it for "External" users.
4. Navigate to **Credentials > Create Credentials > OAuth client ID**.
5. Select **Web application** as the application type.
6. Under **Authorized redirect URIs**, add the specific URL the Nextend plugin generates (this will be provided once the plugin is installed, typically `http://wisdom1.local/wp-login.php?loginSocial=google`).
7. Once created, you will be provided a **Client ID** and a **Client Secret**. Keep these secure.

## Step 2: WordPress Plugin Setup
1. Install and activate the `nextend-facebook-connect` plugin.
2. Navigate to **Settings > Nextend Social Login**.
3. Enable the Google provider.
4. Paste the **Client ID** and **Client Secret** generated in Step 1.
5. Verify the connection through the plugin's test panel.

## Step 3: Custom Theme Integration (Development)
Rather than relying on the plugin's default styling, we will seamlessly integrate the login flow into the `wisdom1` theme's aesthetic.

### Modifications Required:
1. **`comments.php`**: 
   - Intercept the logged-out state. 
   - Replace the standard name/email/website form fields with a prominent, beautifully styled **"Continue with Google"** button.
   - When clicked, this button will direct the user through the Google OAuth flow and redirect them back to the article, fully logged in.
2. **`functions.php`**:
   - Ensure the user's Google display name is correctly mapped to their WordPress display name so that comments render beautifully.

## Verification
- Test clicking "Continue with Google" as a logged-out guest.
- Authenticate with a personal Google account.
- Verify that a new WordPress user is provisioned in the database.
- Verify the user is redirected back to the article and is able to leave a personalized comment.
