Skip to content

feat(theme): replace Super Socializer with Log in with Google - #78

Merged
koechkevin merged 2 commits into
developfrom
feat/replace-super-socializer
Nov 18, 2026
Merged

koechkevin merged 2 commits into
developfrom
feat/replace-super-socializer

Conversation

@koechkevin

@koechkevin koechkevin commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Why

Super Socializer is closed on WordPress.org (since 18 Jun 2026, "Security Issue") and won't get fixes. Production runs 7.14.5, which is affected by:

The site only actually uses it for Google sign-in: about 3,278 users are Google-linked, and the theme only shows a Google button. The share bars and Facebook comments are enabled but never render, though Facebook/X login still accepts requests. This PR moves Google sign-in to rtCamp's single-purpose Log in with Google (v1.4.5, updated 6 Nov 2026). Its code is reviewed below.

Plugin review (1.4.5)

  • Matches existing users by verified email (email_verified required), so current Google users keep their accounts with no duplicates. On first login it binds the account to the Google ID (google_oauth_sub), and after that a different Google account with the same email is rejected.
  • CSRF protection: nonce plus a state token bound to a cookie (__Host- prefixed on HTTPS); wp_safe_redirect for the post-login redirect.
  • Settings can come from constants (WP_GOOGLE_LOGIN_CLIENT_ID, WP_GOOGLE_LOGIN_SECRET, WP_GOOGLE_LOGIN_USER_REGISTRATION), so the secret can stay out of the DB.

Theme changes

  • includes/functions/google-login.php (new)
    • Renders the theme's Google button with the plugin's authorization URL. The post-login redirect returns to the current page, or on /login honours ?redirect_url= (falling back to /learning-pathways). Off-site targets are rejected.
    • Suppresses the activation email for Google sign-ups. This hooks rtcamp.google_register_user at priority 5, because wp_insert_user() fires user_register (and so send_activation_link) before rtcamp.google_user_created.
    • Marks Google-authenticated accounts is_verified. This covers new sign-ups and existing unverified accounts, since Google has verified the email. verify_user_on_login() still runs after the plugin on authenticate.
    • Failed Google sign-ins go to the existing /?login_type=social error, not WP's unstyled login screen, and are logged.
    • Everything is a no-op if the plugin is inactive or unconfigured (the button is hidden).
  • assets/js/google-login.js (new): sets the plugin's CSRF state cookie on click and writes the token into state, mirroring the plugin's own login.js. The plugin's script throws on pages containing the theme's #loginform modal, so it isn't loaded.
  • OAuth callback is /login, not /wp-login.php: the plugin's redirect_uri is filtered to home_url('/login'), and academyafrica_google_login_callback() completes the sign-in there on init via wp_signon() (same authenticate chain, so verify_user_on_login() still applies). Users never see wp-login.php; custom_login_page() is unchanged apart from that.
  • Login/register templates use the helper. Removed the dead Facebook/X buttons and the the_champ_* hooks; the button styles cover the new link. ACADEMY_AFRICA_VERSION → 1.7.22.

Testing (local Docker, plugin installed)

Case Result
Existing Super Socializer Google user Same account returned, 0 new users, google_oauth_sub bound; a different Google ID for the same email is rejected
New Google user Subscriber created, is_verified=1, no emails sent (pre_wp_mail captured none)
Unverified Google email Rejected
Callback with a bogus code / without the CSRF cookie 302 → /?login_type=social (friendly error shown, reason logged)
Plain /wp-login.php Still 302 → /login
Callback on /login (mocked Google over HTTP) New user created verified + google_oauth_sub bound; returns to course page; bad code / missing cookie → /?login_type=social; off-site redirect_to → /learning-pathways; token exchange sends redirect_uri=…/login
Redirect targets Current page, ?redirect_url= path/URL honoured, https://evil… and //evil… → /learning-pathways
Click handler (headless Chrome) Cookie set, matching token in state, redirect and nonce preserved, cookie reused on second click
CI scripts (lint, short tags, asset refs, superglobals, JS) + unit tests Pass

Not tested: a real Google sign-in end to end. That needs the OAuth client to allow the environment's redirect URI. Please test it on staging before prod.

Deploy checklist (plugins aren't in Git, so this is done in wp-admin)

  1. Google Cloud console: add https://academy.africa/login (and the staging equivalent, plus http://localhost:8080/login for local testing; exact match, no trailing slash) as an authorised redirect URI on the OAuth client.
  2. Install and configure Log in with Google: client ID and secret (preferably via the wp-config.php constants), enable user registration (WP's users_can_register is off), leave One Tap off.
  3. Deploy this theme. The order between 2 and 3 doesn't matter, because the button stays hidden until the plugin is configured.
  4. Deactivate and delete Super Socializer. Then delete its the_champ_* / heateor_* options, which hold the Google, Facebook and X keys, and revoke the Facebook and X app credentials.

Known follow-ups

  • Avatars: about 3,300 users show their Google photo via Super Socializer's thechamp_avatar meta. After removal they fall back to Gravatar/default unless we add a fallback.
  • Post-login redirect: this was previously always /?login_type=social (the homepage). It now returns users to the page they signed in from.

Super Socializer (7.14.5) was closed on WordPress.org on 2026-06-18 for a
security issue and has unpatched CVEs (CVE-2026-65542 broken auth,
CVE-2026-65544 / CVE-2026-11798 XSS). The site only uses it for Google
sign-in, so move to rtCamp's single-purpose "Log in with Google" plugin.

- includes/functions/google-login.php: render the theme's Google button with
  the plugin's authorization URL (post-login redirect validated, mirrors
  custom_login_page()); suppress the activation email for Google sign-ups
  (rtcamp.google_register_user @5, before wp_insert_user fires
  user_register) and mark Google-authenticated accounts verified; send failed
  Google sign-ins to the existing /?login_type=social error and log them.
  Everything no-ops if the plugin is inactive (button hidden).
- assets/js/google-login.js: set the plugin's CSRF state cookie on click,
  as its own login.js does (that script errors next to the theme's
  #loginform modal, so it isn't loaded).
- includes/functions/login.php: let the OAuth callback
  (wp-login.php?code=&state=) through instead of redirecting it to /login.
- login/register templates use the helper; drop dead Facebook/X buttons and
  the old the_champ_* hooks; button styles cover the link.
- Bump ACADEMY_AFRICA_VERSION to 1.7.22.
Point the Log in with Google redirect_uri at the theme's /login page and
complete the sign-in there (wp_signon on init), so users never see
wp-login.php. Drop the wp-login.php callback exception in
custom_login_page(), and fall back to /learning-pathways instead of
wp-admin when the state's redirect_to is rejected.

The Google OAuth client must list https://academy.africa/login (and
http://localhost:8080/login for local testing) as authorised redirect URIs.
@koechkevin
koechkevin merged commit 2770ec1 into develop Nov 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant