Quote:
Originally Posted by queke
I am curious how you verify when a business owner tries to claim their listing? Like how do you know they are the business.
|
That's an excellent question. Before, I had the verification process just as a simple form for them to submit their info, and it would have had to been verified manually. But fuck that.
This morning, I built a new auto approval process. I still have it set to manual admin approval though for testing.
Your timing with this question was impeccable
This is how I plan my agent:
Business Claim Verification System - Brantford Insider
Overview
Build a system where business owners can claim their listings. After verification (phone or email) and admin approval, they receive a "Verified Owner" badge on their listing.
User Flow
Business Owner Flow
1. Owner visits business listing page
2. Clicks "Claim This Business" button
3. Fills out claim form (name, email, phone, role at business)
4. Chooses verification method: Phone or Email
5. Phone: Receives verification code, calls/visits site to enter it
6. Email: Receives magic link, clicks to verify
7. Claim goes to admin queue for final approval
8. Once approved, listing shows "Verified Owner" badge
Admin Flow
1. New claims appear in WP Admin → Business Claims
2. Admin sees: business name, claimant info, verification status
3. Admin can: Approve, Reject (with reason), Request more info
4. Approved claims add verified badge to listing
---
Technical Implementation
Phase 1: Data Structure
New ACF Fields (add to includes/acf-fields.php)
// Business Claim Status Group
- claim_status: select (unclaimed, pending, verified, rejected)
- claim_verified_date: date
- claim_owner_name: text
- claim_owner_email: email
- claim_verification_method: select (phone, email)
New Database Table: wp_business_claims
CREATE TABLE wp_business_claims (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
business_id BIGINT NOT NULL,
claimant_name VARCHAR(255),
claimant_email VARCHAR(255),
claimant_phone VARCHAR(50),
claimant_role VARCHAR(100),
verification_method ENUM('phone', 'email'),
verification_code VARCHAR(20),
verification_code_expires DATETIME,
email_verified TINYINT DEFAULT 0,
phone_verified TINYINT DEFAULT 0,
status ENUM('pending', 'email_sent', 'code_sent', 'verified', 'approved', 'rejected') DEFAULT 'pending',
rejection_reason TEXT,
admin_notes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP,
INDEX (business_id),
INDEX (status)
);
Phase 2: Backend Infrastructure
New File: includes/claim-verification.php
- cbd_create_claims_table() - Creates DB table on activation
- cbd_generate_verification_code() - 6-digit code generator
- cbd_send_verification_email() - Magic link email
- cbd_verify_email_token() - Validates email links
- cbd_verify_phone_code() - Validates phone codes
- cbd_submit_claim() - AJAX handler for claim form
- cbd_get_claim_status() - Check if business is claimed
New File: includes/claim-admin.php
- Admin menu page: "Business Claims"
- List table showing all claims with filters
- Approve/Reject actions with AJAX
- Email notifications to claimant on status change
Phase 3: Frontend Templates
New Template: templates/page-claim-business.php
- Claim form with fields:
- Business selector (if coming from generic page)
- Your Name
- Your Email
- Your Phone
- Your Role (Owner, Manager, Marketing, etc.)
- Verification Method (Phone / Email radio)
- Terms acceptance checkbox
- AJAX submission
- Success/error messaging
Modify: templates/single-business-restaurant.php (and other single templates)
- Add "Claim This Business" button (if unclaimed)
- Add "Verified Owner" badge (if claimed & approved)
- Button links to /claim-business/?business_id=XXX
New Template Section: Verification Code Entry
- Simple form to enter 6-digit code
- Or: Email link lands on verification confirmation page
Phase 4: Email Templates
Verification Email
Subject: Verify your ownership of [Business Name] on Brantford Insider
Hi [Name],
You requested to claim [Business Name] on Brantford Insider.
Click here to verify your email: [MAGIC LINK]
This link expires in 24 hours.
If you didn't request this, ignore this email.
Phone Verification Instructions
Subject: Your verification code for [Business Name]
Hi [Name],
Your verification code is: [6-DIGIT CODE]
Enter this code at: [VERIFICATION URL]
This code expires in 1 hour.
Claim Approved Email
Subject: Your claim for [Business Name] has been approved!
Hi [Name],
Great news! Your claim for [Business Name] on Brantford Insider has been approved.
Your listing now shows a "Verified Owner" badge.
To request changes to your listing, contact us at [email].
---
Files to Create/Modify
NEW FILES
1. custom-business-directory/includes/claim-verification.php - Core claim logic
2. custom-business-directory/includes/claim-admin.php - Admin interface
3. custom-business-directory/templates/page-claim-business.php - Claim form page
4. custom-business-directory/assets/css/claim-form.css - Claim form styles
5. custom-business-directory/assets/js/claim-form.js - AJAX handling
MODIFY FILES
1. custom-business-directory/custom-business-directory.php - Include new files, register activation hook
2. custom-business-directory/includes/acf-fields.php - Add claim status fields
3. custom-business-directory/templates/single-business-restaurant.php - Add claim button & badge
4. custom-business-directory/templates/single-business-service.php - Add claim button & badge
5. custom-business-directory/templates/single-business-retail.php - Add claim button & badge
6. custom-business-directory/templates/single-business.php - Add claim button & badge
7. custom-business-directory/assets/css/style.css - Badge styles
---
Implementation Order
1. Database & ACF Fields - Create table, add fields
2. Claim Form Page - Frontend form that submits claims
3. Email/Phone Verification - Code generation and validation
4. Admin Interface - View and manage claims
5. Badge Display - Show verified badge on listings
6. Claim Button - Add to all single business templates
7. Testing - Full flow testing on Brantford site
---
Security Considerations
- Rate limit claim submissions (1 per business per email per 24h)
- Verification codes expire (1h phone, 24h email)
- Sanitize all inputs
- Nonce verification on all forms
- Email verification tokens are one-time use
- Admin-only approval (no auto-approve)
---
Badge Design
.verified-owner-badge {
display: inline-flex;
align-items: center;
background: linear-gradient(135deg, #10B981 0%, #059669 100%);
color: white;
padding: 6px 12px;
border-radius: 20px;
font-size: 13px;
font-weight: 600;
}
.verified-owner-badge::before {
content: "✓";
margin-right: 6px;
}
---
Estimated Components
| Component | Complexity | Priority |
|--------------------------|------------|----------|
| Database table | Low | P0 |
| ACF fields | Low | P0 |
| Claim form page | Medium | P0 |
| Email verification | Medium | P0 |
| Phone code verification | Low | P0 |
| Admin claims list | Medium | P0 |
| Approve/Reject actions | Low | P0 |
| Badge on listings | Low | P1 |
| Claim button on listings | Low | P1 |
| Email templates | Low | P1 |
---
Test Plan
1. Submit claim for unclaimed business
2. Choose email verification → receive email → click link
3. Verify claim shows in admin as "verified, pending approval"
4. Admin approves → badge appears on listing
5. Submit another claim for same business → should show "already claimed"
6. Test phone verification flow
7. Test rejection flow with reason
8. Test expired verification codes
The system is being built right at this very moment.
