ComusThumbz Documentation
Admin Login

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)

 

Note: Sub-sponsors allow you to track performance at a granular level. A sponsor like "MindGeek" might have sub-sponsors like "Pornhub", "RedTube", and "YouPorn", each with their own banners and statistics.

 

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

 

Configuration Required: This page requires the following system dependencies to function properly.

 

PHP Requirements

Requirement Minimum Recommended Notes
PHP Version 8.0 8.2+ Required for null coalescing operator
memorylimit 64M 128M Standard page operations
maxexecutiontime 30 60 For large sub-sponsor lists

Required PHP Extensions

Extension Required Purpose
mysqli Yes Database connectivity
json Yes AJAX response handling
session Yes CSRF protection, authentication

Required PHP Functions

Function Required For
bin2hex() CSRF token generation
randombytes() Secure CSRF token generation
mysqlibegintransaction() Safe delete operations
mysqlicommit() / mysqlirollback() Transaction management

Database Requirements

  • MySQL 5.7+ / MariaDB 10.3+
  • InnoDB engine for transaction support
  • User must have SELECT, INSERT, UPDATE, DELETE permissions

External Dependencies

Dependency Version Purpose
Font Awesome 6.5.1 Icons (CDN loaded)

Accessing the Page

Navigation Path

  1. Log into the admin panel
  2. Navigate to Advertising section in the main menu
  3. Click Sub-Sponsors

Direct URL

https://yourdomain.com/ct/admin/subsponsors.php

Navigation Buttons

The page header includes navigation buttons to related advertising pages:

Button Destination Purpose
Sponsors sponsorsmanagement.php Manage main sponsors
Banners bannermanagement.php Manage banner ads
Add Banner addbanner.php Create new banner
Banner Zones bannerzones.php Manage placement zones
Sub-Sponsors subsponsors.php Current page (highlighted)
Statistics statistics.php View advertising stats

[Screenshot: Header with navigation buttons showing Sub-Sponsors as active]


Page Layout

Header Section

The page header contains:

Element Description
Breadcrumb Dashboard / Sub-Sponsors
Page Title "Sub-Sponsors Management" with users icon
Subtitle "Manage individual sites and properties under main sponsors"
Navigation Buttons Quick links to related advertising pages

[Screenshot: Page header with title and navigation]

Controls Section

Below the header, a control bar provides:

Element Description
Search Box Real-time search by name, URL, or parent sponsor
Parent Sponsor Filter Dropdown to filter by parent sponsor
Add New Sub-Sponsor Green button to open add modal

[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:

Section Content
Header Sub-sponsor name, parent sponsor badge
Actions Edit and Delete buttons
Banner Count Highlighted statistic showing active banners
Info Section Website URL, email, status
Description Optional description (styled quote box)

[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:

Element Style Content
Count Value Large, bold, green text Number of banners
Label Gray text below "Active Banners"
Note: The banner count is calculated in real-time by counting records in tblBannerAssets where subsponsorid matches this sub-sponsor.

Status Badges

Status Badge Color Meaning
Active Green Sub-sponsor is active, banners display
Inactive Red Sub-sponsor disabled, banners hidden

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)

Field Details
Label Parent Sponsor
Type Dropdown select
Options All active sponsors from tblSponsors
Validation Required
Warning: Only active sponsors (active = 1) appear in the dropdown. If you don't see a sponsor, check if it's been deactivated.

Sub-Sponsor Name (Required)

Field Details
Label Sub-Sponsor Name
Type Text input
Placeholder "Individual site or property name"
Validation Required
Example "Pornhub"
Tip: Use the actual website or property name so it's easy to identify in reports.

Website URL

Field Details
Label Website URL
Type URL input
Placeholder "https://example.com"
Validation Optional, valid URL format
Example "https://www.pornhub.com"

Contact Email

Field Details
Label Contact Email
Type Email input
Placeholder "contact@example.com"
Validation Optional, valid email format
Example "ads@pornhub.com"

Description

Field Details
Label Description
Type Textarea (3 rows)
Placeholder "Description of this sub-sponsor property"
Validation Optional
Example "World's largest adult video site"

Status

Field Details
Label Status
Type Dropdown select
Options Active, Inactive
Default Active

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

  1. Find the sub-sponsor card in the grid
  2. 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)

 

Tip: You can change the parent sponsor to move a sub-sponsor from one sponsor to another. This is useful when reorganizing your advertising structure.

 

Saving Changes

Click "Save Sub-Sponsor" to apply changes. The grid will refresh automatically.


Deleting Sub-Sponsors

Delete Process

  1. Find the sub-sponsor card
  2. Click the Delete button (red)
  3. Confirm in the popup dialog

Delete Restrictions

 

Error: You cannot delete a sub-sponsor that has active banners. Remove or reassign all banners first.

 

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]


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.

 

Tip: Search is case-insensitive and matches partial strings. Searching "porn" will find "Pornhub", "RedPorn", etc.

 

Parent Sponsor Filter

The dropdown filter allows viewing sub-sponsors for a specific parent:

Option Result
"All Parent Sponsors" Shows all sub-sponsors
[Specific Sponsor] Shows only that sponsor's sub-sponsors

[Screenshot: Parent sponsor filter dropdown open]

Combined Filtering

Search and filter work together:

  1. Select a parent sponsor from dropdown
  2. Type in search box to further filter
  3. Results show only matches within the selected sponsor

Best Practices

Naming Conventions

 

Tip: Use clear, recognizable names for sub-sponsors:

 

Good Bad Why
"Pornhub" "PH Site 1" Use real site name
"TrafficJunky - Mobile Campaign" "Campaign A" Include campaign context
"ExoClick Premium" "Exo1" Be descriptive

Organization

  1. Create sub-sponsors for distinct properties - Each website or campaign should be separate
  2. Use descriptions - Add helpful context about each sub-sponsor
  3. Keep URLs updated - Ensure URLs are current for easy reference
  4. 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:

  1. Navigate to Banner Management
  2. Filter by this sub-sponsor
  3. Delete or reassign banners to a different sub-sponsor
  4. Return to delete sub-sponsor

 

Parent Sponsor dropdown is empty

Cause: No active sponsors exist in the system.

Solution:

  1. Navigate to Sponsors Management
  2. Create at least one sponsor with Active status
  3. Return to Sub-Sponsors page
  4. Refresh the page

 

Sub-sponsor not appearing after save

Possible Causes:

  • Name or parent sponsor missing
  • Database error
  • CSRF token expired

 

Solutions:

  1. Check browser console for errors
  2. Refresh the page and try again
  3. Verify all required fields are filled
  4. 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:"


Changelog

Date Version Changes
2025-01-02 1.0 Initial documentation

This documentation is part of the ComusThumbz Admin Guide series.*