Messages Manager
Overview
The Admin Messages Manager provides a comprehensive moderation interface for the platform's private messaging system. Administrators can view all user conversations, handle reported messages, manage user blocks, and moderate content with a modern messenger-style interface.
Key capabilities include:
- View all conversations between users in a messenger-style interface
- Handle message reports with resolve/delete actions
- View and manage blocked user relationships
- Monitor messaging statistics (total, unread, reports, blocks)
- Delete individual messages or entire conversations
- Navigate between users and their conversations seamlessly
System Requirements
PHP Requirements
PHP Extensions Required
mysqli- Database connectivityjson- JSON encoding for AJAX responsessession- Session management for CSRF protectionmbstring- Multi-byte string handling for message content
PHP Settings
session.autostart = Off
date.timezone = Your/Timezone
Features & UI Elements
Page Header
[Screenshot: messages-header]
The page header displays:
- Title: "Messages Manager"
- Icon:
fa-envelope(envelope icon) - Breadcrumb: Dashboard / Messages
Statistics Dashboard
[Screenshot: messages-stats]
Six statistics cards show messaging overview:
Navigation Tabs
[Screenshot: messages-tabs]
Three tabs for different views:
Conversations View
[Screenshot: messages-conversations-view]
A two-panel messenger-style interface:
Left Panel - Conversation List:
- Search input field for filtering conversations
- Scrollable list of all conversations
- Each conversation shows:
- Profile image or initials
- Both usernames (User A ↔ User B)
- Last message preview (truncated to 50 chars)
- Timestamp ("2 hours ago" format)
- Unread count badge (if unread messages exist)
- Click to load conversation
Right Panel - Conversation Detail:
- Header showing both users with links to their profiles
- Scrollable message history (chronological order)
- Each message displays:
- Sender name and avatar
- Message content
- Timestamp
- "Read" indicator with read timestamp
- Delete button (individual message)
- Conversation actions:
- Delete Conversation button (deletes all messages)
Reports View
[Screenshot: messages-reports-view]
A list of reported messages requiring attention:
Each Report Card Shows:
- Reporter: Username of who filed the report
- Report Reason: spam, harassment, inappropriate, scam, or other
- Report Details: User-provided description
- Reported Message: The actual message content
- Sender: Who sent the reported message
- Receiver: Who received it
- Report Date: When the report was filed
- Message Date: When the original message was sent
Available Actions:
Blocks View
[Screenshot: messages-blocks-view]
A table showing all blocked user relationships:
Alert Messages
Success and error messages appear below the header:
- Success (green): "Report resolved successfully", "Message deleted successfully"
- Error (red): "Invalid security token", "Message not found"
Step-by-Step Usage
Viewing User Conversations
- Navigate to Admin Panel → Users → Messages
- Ensure the Conversations tab is selected
- Browse the conversation list on the left panel
- Click any conversation to load it in the right panel
- Scroll through messages chronologically
- Use the search box to filter conversations by username
Searching for Specific Users
- In the Conversations view, locate the search input
- Type a username (partial matches supported)
- The conversation list filters in real-time
- Click on a filtered result to view that conversation
Viewing a Full Conversation
- Click on any conversation in the left panel
- The right panel loads via AJAX (no page refresh)
- Messages appear in chronological order (oldest first)
- Each message shows:
- Sender name and profile link
- Message content
- Sent timestamp
- Read status with timestamp (if read)
Deleting a Single Message
- Load the conversation containing the message
- Locate the message to delete
- Click the trash icon button on that message
- Confirm the deletion when prompted
- Message is removed from the conversation
Deleting an Entire Conversation
- Load the conversation you want to delete
- Click the Delete Conversation button in the header
- Confirm the deletion when prompted
- All messages between both users are deleted
Handling Message Reports
- Click the Reports tab
- Review pending reports (sorted by date, newest first)
- For each report, read:
- The reason for the report
- Any details provided by the reporter
- The actual message content
- Choose an action:
Option A - Resolve (Keep Message):
- Click the green Resolve button
- Report is marked as resolved
- Message remains in place
- Good for false reports or minor issues
Option B - Delete Message:
- Click the red Delete Message button
- Confirm the deletion
- Message is removed from the system
- Report is automatically resolved
Option C - View Full Context:
- Click View Conversation to see surrounding messages
- This helps understand the context
- Return to Reports tab to take action
Managing User Blocks
- Click the Blocks tab
- View all blocked user relationships
- To unblock a user:
- Find the block entry
- Click the Unblock button
- Confirm the action
- Users can message each other again
Navigating to User Profiles
From any view, you can click on usernames to:
- Open the user's admin profile page (userdetails.php)
- View full user information
- Take additional moderation actions
AJAX Endpoints
Load Conversation
The page includes an AJAX endpoint for loading conversations without page refresh:
Request:
GET messages.admin.php?ajax=loadconversation&user1={userid}&user2={userid}
Response (JSON):
{
"success": true,
"messages": [
{
"messageid": 123,
"senderid": 1,
"senderusername": "johndoe",
"receiverid": 2,
"receiverusername": "janesmith",
"message": "Hello, how are you?",
"isread": 1,
"readat": "2025-01-02 10:30:00",
"createdat": "2025-01-02 10:25:00"
}
]
}
Error Response:
{
"success": false,
"error": "Conversation not found"
}
Best Practices
Report Handling Guidelines
- Response Time:
- Handle pending reports within 24 hours
- Prioritize harassment and scam reports
- Batch process spam reports
- Context Review:
- Always view the full conversation before acting
- Consider user history and patterns
- Look for provocation or context
- Action Selection:
- Resolve (no action): False reports, misunderstandings, minor issues
- Delete message: Clear policy violations, explicit content, harassment
- Escalate: Illegal content, threats, repeat offenders (ban user)
Common Report Types
Performance Tips
- Large Datasets:
- Use search to narrow results
- Handle reports promptly to reduce pending count
- Archive old conversations periodically
- AJAX Loading:
- Wait for conversation to load before taking actions
- Don't rapidly click between conversations
Troubleshooting
Common Issues
Conversation Not Loading (AJAX Error)
Cause: JavaScript error or network issue
Solutions:
- Check browser console for JavaScript errors
- Verify CSRF token is valid (refresh page)
- Check network tab for failed requests
- Clear browser cache and retry
- Verify both user IDs exist in database
Reports Not Showing
Cause: No pending reports or filter issue
Solutions:
- Check if reports exist with status='pending'
- Verify tblMessageReports table exists
- Check foreign key constraints (messages may be deleted)
- Query database:
SELECT COUNT() FROM tblMessageReports WHERE status = 'pending'
Delete Action Fails
Cause: CSRF token expired or database constraint
Solutions:
- Refresh page to get new CSRF token
- Check if message still exists
- Verify admin session is active
- Check PHP error logs for constraint violations
Search Not Filtering
Cause: JavaScript not loaded or input issue
Solutions:
- Verify JavaScript is enabled
- Check for console errors
- Try typing slowly (debounce may be active)
- Refresh page and retry
Database Issues
Missing Tables
Cause: Tables not created during installation
Solutions:
- Run CREATE TABLE statements from Installation Requirements
- Verify foreign key references (tblCMSUsers must exist first)
- Check MySQL character set compatibility
Orphaned Records
Cause: Users deleted without proper cascade
Solutions:
-- Find orphaned messages (sender doesn't exist)
SELECT m. FROM tblMessages m
LEFT JOIN tblCMSUsers u ON m.senderid = u.id
WHERE u.id IS NULL;
-- Find orphaned reports
SELECT r.* FROM tblMessageReports r
LEFT JOIN tblMessages m ON r.messageid = m.messageid
WHERE m.messageid IS NULL;
-- Clean up orphaned data
DELETE r FROM tblMessageReports r
LEFT JOIN tblMessages m ON r.messageid = m.messageid
WHERE m.messageid IS NULL;
Security Considerations
CSRF Protection
All POST actions include CSRF token validation:
if ($POST['csrftoken'] !== $SESSION['admincsrftoken']) {
die('Invalid security token');
}
Input Sanitization
- Usernames are escaped for HTML output
- Message content is sanitized to prevent XSS
- SQL queries use prepared statements
Access Control
- Only administrators can access this page
- Session validation occurs on page load
- User actions are logged (if logging enabled)
Translatable Strings
{
"messagestitle": "Messages Manager",
"messagesbreadcrumb": "Dashboard / Messages",
"messagesstattotal": "Total Messages",
"messagesstatunread": "Unread Messages",
"messagesstatreports": "Pending Reports",
"messagesstatblocks": "User Blocks",
"messagesstat24h": "Messages (24h)",
"messagesstatconversations": "Conversations",
"messagestabconversations": "Conversations",
"messagestabreports": "Reports",
"messagestabblocks": "Blocks",
"messagessearchplaceholder": "Search by username...",
"messagesconversationbetween": "Conversation between",
"messagesnoconversations": "No conversations found",
"messagesnomessages": "Select a conversation to view messages",
"messagesloaderror": "Failed to load conversation",
"messagesdeletesingle": "Delete Message",
"messagesdeleteconversation": "Delete Conversation",
"messagesconfirmdeletesingle": "Are you sure you want to delete this message?",
"messagesconfirmdeleteconversation": "Are you sure you want to delete this entire conversation? This cannot be undone.",
"messagesdeletedsuccess": "Message deleted successfully",
"messagesconversationdeleted": "Conversation deleted successfully",
"messagesreporttitle": "Message Reports",
"messagesreportby": "Reported by",
"messagesreportreason": "Reason",
"messagesreportdetails": "Details",
"messagesreportmessage": "Reported Message",
"messagesreportsender": "Sender",
"messagesreportreceiver": "Receiver",
"messagesreportdate": "Report Date",
"messagesmessagedate": "Message Date",
"messagesresolve": "Resolve",
"messagesdelete": "Delete Message",
"messagesviewconversation": "View Conversation",
"messagesresolvedsuccess": "Report resolved successfully",
"messagesnoreports": "No pending reports",
"messagesblockstitle": "Blocked Users",
"messagesblocker": "Blocker",
"messagesblocked": "Blocked User",
"messagesblockreason": "Reason",
"messagesblockedsince": "Blocked Since",
"messagesunblock": "Unblock",
"messagesunblockconfirm": "Are you sure you want to unblock this user?",
"messagesunblockedsuccess": "User unblocked successfully",
"messagesnoblocks": "No blocked users",
"messagesreadat": "Read at",
"messagesunread": "Unread",
"messagessentby": "Sent by",
"messagesagominutes": "minutes ago",
"messagesagohours": "hours ago",
"messagesagodays": "days ago",
"messagesreasonspam": "Spam",
"messagesreasonharassment": "Harassment",
"messagesreasoninappropriate": "Inappropriate Content",
"messagesreasonscam": "Scam",
"messagesreasonother": "Other",
"messageserrorcsrf": "Invalid security token",
"messageserrornotfound": "Message not found",
"messageserroractionfailed": "Action failed. Please try again."
}
Related Documentation
- User Management - User account management
- Notifications - User notification system
- Creator Profiles - Creator accounts and verification