Sub-Sponsors
Overview
The Sub-Sponsors Management page allows administrators to manage sub-sponsors, which represent individual websites, properties, or campaigns under a main sponsor. This hierarchical structure enables granular tracking and management of advertising relationships.
What are Sub-Sponsors?
Sub-sponsors are child entities of main sponsors. They represent:
- Individual Websites - Specific sites within a network (e.g., "Pornhub" under "TrafficJunky")
- Campaigns - Separate advertising campaigns from the same sponsor
- Properties - Different properties or brands owned by one company
- Affiliate Sub-IDs - Different tracking IDs for the same affiliate
Hierarchy Structure
Main Sponsor (tblSponsors)
├── Sub-Sponsor A (tblSubSponsors)
│ ├── Banner 1 (tblBannerAssets)
│ └── Banner 2
├── Sub-Sponsor B
│ └── Banner 3
└── Direct Banner (no sub-sponsor)
Key Features
- Create and manage sub-sponsors under parent sponsors
- Filter by parent sponsor
- Track banner counts per sub-sponsor
- Real-time search functionality
- Enable/disable sub-sponsors with active/inactive status
System Requirements
PHP Requirements
Required PHP Extensions
Required PHP Functions
Database Requirements
- MySQL 5.7+ / MariaDB 10.3+
- InnoDB engine for transaction support
- User must have SELECT, INSERT, UPDATE, DELETE permissions
External Dependencies
Accessing the Page
Navigation Path
- Log into the admin panel
- Navigate to Advertising section in the main menu
- Click Sub-Sponsors
Direct URL
https://yourdomain.com/ct/admin/subsponsors.php
Navigation Buttons
The page header includes navigation buttons to related advertising pages:
[Screenshot: Header with navigation buttons showing Sub-Sponsors as active]
Page Layout
Header Section
The page header contains:
[Screenshot: Page header with title and navigation]
Controls Section
Below the header, a control bar provides:
[Screenshot: Controls section with search, filter, and add button]
Sub-Sponsor Grid
Sub-sponsors are displayed in a responsive card grid layout:
- Desktop: Multiple columns (auto-fill, minimum 350px per card)
- Mobile: Single column layout
- Cards show sub-sponsor details with shadow effects
[Screenshot: Sub-sponsor grid showing multiple cards]
Sub-Sponsor Management
Sub-Sponsor Card Layout
Each sub-sponsor card displays:
[Screenshot: Single sub-sponsor card with all elements labeled]
Parent Sponsor Badge
Below the sub-sponsor name, a gray badge shows:
Under: [Parent Sponsor Name]
This clearly identifies which main sponsor owns this sub-sponsor.
Banner Count Display
A highlighted green section shows the banner count:
Status Badges
Adding a New Sub-Sponsor
Step 1: Open the Add Modal
Click the green "Add New Sub-Sponsor" button in the controls section.
[Screenshot: Add New Sub-Sponsor button highlighted]
Step 2: Fill in Sub-Sponsor Details
The modal form contains the following fields:
Parent Sponsor (Required)
Sub-Sponsor Name (Required)
Website URL
Contact Email
Description
Status
Step 3: Save the Sub-Sponsor
Click "Save Sub-Sponsor" to create the sub-sponsor.
Success Response:
- Modal closes automatically
- Sub-sponsor grid refreshes
- Success notification appears
- New sub-sponsor appears in the grid
Error Response:
- Error message displays
- Form remains open for correction
[Screenshot: Sub-sponsor modal with filled form]
Editing Sub-Sponsors
Accessing Edit Mode
- Find the sub-sponsor card in the grid
- Click the Edit button
[Screenshot: Edit button on sub-sponsor card]
Edit Modal
The edit modal is identical to the add modal, pre-populated with existing data:
- Parent Sponsor - Can be changed to move sub-sponsor
- Name - Current name (editable)
- URL - Current URL (editable)
- Contact Email - Current email (editable)
- Description - Current description (editable)
- Status - Current status (editable)
Saving Changes
Click "Save Sub-Sponsor" to apply changes. The grid will refresh automatically.
Deleting Sub-Sponsors
Delete Process
- Find the sub-sponsor card
- Click the Delete button (red)
- Confirm in the popup dialog
Delete Restrictions
The system checks for associated banners before deletion:
If banners exist:
→ Error: "Cannot delete sub-sponsor with active banners"
→ Deletion blocked
If no banners:
→ Sub-sponsor deleted
→ Success message displayed
Confirmation Dialog
A JavaScript confirmation appears:
"Are you sure you want to delete this sub-sponsor? This action cannot be undone."
[Screenshot: Delete confirmation dialog]
Filtering and Search
Search Functionality
The search box performs real-time filtering across:
- Sub-sponsor name
- Sub-sponsor URL
- Parent sponsor name
Type at least 1 character to begin filtering. Results update as you type.
Parent Sponsor Filter
The dropdown filter allows viewing sub-sponsors for a specific parent:
[Screenshot: Parent sponsor filter dropdown open]
Combined Filtering
Search and filter work together:
- Select a parent sponsor from dropdown
- Type in search box to further filter
- Results show only matches within the selected sponsor
Best Practices
Naming Conventions
Organization
- Create sub-sponsors for distinct properties - Each website or campaign should be separate
- Use descriptions - Add helpful context about each sub-sponsor
- Keep URLs updated - Ensure URLs are current for easy reference
- Regular cleanup - Deactivate or delete unused sub-sponsors
When to Use Sub-Sponsors
Use sub-sponsors when:
- A sponsor has multiple websites
- You need separate tracking for different campaigns
- Different affiliate sub-IDs are used
- Banner performance should be tracked per-property
Don't use sub-sponsors when:
- Sponsor only has one website
- All banners should be tracked together
- Simplicity is preferred over granular tracking
Troubleshooting
Common Issues
"Cannot delete sub-sponsor with active banners"
Cause: The sub-sponsor has banners assigned that must be removed first.
Solution:
- Navigate to Banner Management
- Filter by this sub-sponsor
- Delete or reassign banners to a different sub-sponsor
- Return to delete sub-sponsor
Parent Sponsor dropdown is empty
Cause: No active sponsors exist in the system.
Solution:
- Navigate to Sponsors Management
- Create at least one sponsor with Active status
- Return to Sub-Sponsors page
- Refresh the page
Sub-sponsor not appearing after save
Possible Causes:
- Name or parent sponsor missing
- Database error
- CSRF token expired
Solutions:
- Check browser console for errors
- Refresh the page and try again
- Verify all required fields are filled
- Check database connection
Search not returning expected results
Cause: Search only matches name, URL, and parent sponsor name.
Solution:
- Verify the search term exists in one of these fields
- Check for typos
- Try shorter search terms
Database Queries for Debugging
List All Sub-Sponsors
SELECT ss.id, ss.name, s.name as parentsponsor, ss.url, ss.active
FROM tblSubSponsors ss
JOIN tblSponsors s ON ss.parentsponsorid = s.id
ORDER BY s.name, ss.name;
Count Banners per Sub-Sponsor
SELECT ss.name, s.name as parent, COUNT(ba.id) as bannercount
FROM tblSubSponsors ss
JOIN tblSponsors s ON ss.parentsponsorid = s.id
LEFT JOIN tblBannerAssets ba ON ss.id = ba.subsponsorid
GROUP BY ss.id
ORDER BY bannercount DESC;
Find Orphaned Sub-Sponsors
-- Sub-sponsors without a valid parent (shouldn't exist with FK)
SELECT ss.
FROM tblSubSponsors ss
LEFT JOIN tblSponsors s ON ss.parentsponsorid = s.id
WHERE s.id IS NULL;
Sub-Sponsors by Parent Sponsor
SELECT
s.name as sponsor,
s.sponsorcode,
COUNT(ss.id) as subsponsorcount
FROM tblSponsors s
LEFT JOIN tblSubSponsors ss ON s.id = ss.parentsponsorid
GROUP BY s.id
ORDER BY subsponsorcount DESC;
Translatable Strings
The following strings should be added to backendtranslations.md for internationalization:
Page Title and Navigation
subsponsorstitle = "Sub-Sponsors Management"
subsponsorssubtitle = "Manage individual sites and properties under main sponsors"
breadcrumbsubsponsors = "Sub-Sponsors"
Buttons and Actions
btnaddsubsponsor = "Add New Sub-Sponsor"
btnsavesubsponsor = "Save Sub-Sponsor"
btnedit = "Edit"
btndelete = "Delete"
btncancel = "Cancel"
Form Labels
labelparentsponsor = "Parent Sponsor"
labelsubsponsorname = "Sub-Sponsor Name"
labelwebsiteurl = "Website URL"
labelcontactemail = "Contact Email"
labeldescription = "Description"
labelstatus = "Status"
Filter Labels
filterallsponsors = "All Parent Sponsors"
Card Labels
cardunder = "Under:"
statactivebanners = "Active Banners"
Status Options
statusactive = "Active"
statusinactive = "Inactive"
Messages and Notifications
msgsubsponsorsaved = "Sub-sponsor saved successfully"
msgsubsponsordeleted = "Sub-sponsor deleted successfully"
msgconfirmdelete = "Are you sure you want to delete this sub-sponsor? This action cannot be undone."
msgnosubsponsors = "No sub-sponsors found"
msgclickadd = "Click \"Add New Sub-Sponsor\" to create your first sub-sponsor."
Error Messages
errornameparentrequired = "Name and parent sponsor are required"
errorcannotdeletebanners = "Cannot delete sub-sponsor with active banners"
errorsubsponsornotfound = "Sub-sponsor not found"
errorloadingsubsponsors = "Error loading sub-sponsors"
errorsavingsubsponsor = "Error saving sub-sponsor"
errordeletingsubsponsor = "Error deleting sub-sponsor"
errorinvalidcsrf = "Invalid CSRF token"
Placeholders
placeholdersearch = "Search sub-sponsors..."
placeholdername = "Individual site or property name"
placeholderurl = "https://example.com"
placeholderemail = "contact@example.com"
placeholderdescription = "Description of this sub-sponsor property"
placeholderselectsponsor = "Select Parent Sponsor"
Modal Titles
modaladdsubsponsor = "Add New Sub-Sponsor"
modaleditsubsponsor = "Edit Sub-Sponsor"
Navigation Buttons
navsponsors = "Sponsors"
navbanners = "Banners"
navaddbanner = "Add Banner"
navbannerzones = "Banner Zones"
navsubsponsors = "Sub-Sponsors"
navstatistics = "Statistics"
Info Labels
infowebsite = "Website:"
infoemail = "Email:"
infostatus = "Status:"
Related Documentation
- Sponsors Management - Manage main sponsors
- Banner Management - Manage banner ads
- Add Banner - Create new banners
- Banner Zones - Manage placement zones
Changelog
This documentation is part of the ComusThumbz Admin Guide series.*