fting Posted April 1, 2013 Share Posted April 1, 2013 Hi all, I would like to create a custom page in admin area. I know there's way by creating new addon, however, I can't get it out even following the instructions at http://docs.whmcs.com/Addon_Module_Developer_Docs. Anyone able to explain to me why? Any form of help is appreciated! 0 Quote Link to comment Share on other sites More sharing options...
ocosa Posted April 10, 2013 Share Posted April 10, 2013 Hi all, I would like to create a custom page in admin area. I know there's way by creating new addon, however, I can't get it out even following the instructions at http://docs.whmcs.com/Addon_Module_Developer_Docs. Anyone able to explain to me why? Any form of help is appreciated! If I understand you correctly, you are looking to create a page not addon right? If so, then this link will help you http://docs.whmcs.com/Creating_Pages. 0 Quote Link to comment Share on other sites More sharing options...
tomdchi Posted July 9, 2013 Share Posted July 9, 2013 That link is for client area not admin. Anyone have any examples of a custom page in the admin area? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 9, 2013 Share Posted July 9, 2013 have you read the following page... http://docs.whmcs.com/Admin_Area_Template_Files you could probably copy one of the existing files, rename it and try to edit it for your needs. 0 Quote Link to comment Share on other sites More sharing options...
tomdchi Posted July 9, 2013 Share Posted July 9, 2013 Thanks but those are just tpl files. You would also need a php file to drive the tpl file. That is what is missing here. I am trying to figure this out by using trial and error. I will post back when I get it all figured out. 0 Quote Link to comment Share on other sites More sharing options...
tomdchi Posted July 9, 2013 Share Posted July 9, 2013 Here is what I have so far. It is not perfect but it seems to work pretty good. This assumes that the php file is in the admin dir and the tpl file is in admin/templates dir. The purpose of this page (for me) is client specific so that is why I have tried to make the tpl look like the current admin area client profile. PHP (there are two places in the file that need a admin username) <?php require('../dbconnect.php'); if (empty($_SESSION['adminid'])) { header("location: login.php"); exit (); } require('../includes/functions.php'); require('../includes/adminfunctions.php'); require('../includes/smarty/Smarty.class.php'); global $templates_compiledir; global $customadminpath; $smarty = new Smarty(); $smarty->template_dir = ROOTDIR . ('' . '/' . $customadminpath . '/templates/'); $smarty->compile_dir = $templates_compiledir; $table = 'tbladmins'; $fields = 'template'; $where = array('id' => $_SESSION['adminid']); $result = select_query($table, $fields, $where); $data = mysql_fetch_array($result); $template = empty($data['template']) ? 'blend' : $data['template']; $smarty->assign('template', $template); $smarty->assign('pagetitle', 'PageTitle'); $smarty->assign('sidebar', 'clients'); $adminpermsarray = array(0 => "Main Homepage", 1 => "Sidebar Statistics", 2 => "My Account", 3 => "List Clients", 4 => "List Services", 5 => "List Addons", 6 => "List Domains", 7 => "Add New Client", 8 => "Edit Clients Details", 9 => "View Credit Card Details", 10 => "View Clients Products/Services", 11 => "Edit Clients Products/Services", 12 => "Delete Clients Products/Services", 13 => "Perform Server Operations", 14 => "View Clients Domains", 15 => "Edit Clients Domains", 16 => "Delete Clients Domains", 17 => "View Clients Notes", 18 => "Add/Edit Client Notes", 19 => "Delete Client", 20 => "Mass Mail", 21 => "View Cancellation Requests", 22 => "Manage Affiliates", 23 => "View Orders", 24 => "Delete Order", 25 => "View Order Details", 26 => "Add New Order", 27 => "List Transactions", 28 => "Add Transaction", 29 => "Edit Transaction", 30 => "Delete Transaction", 31 => "View Gateway Log", 32 => "List Invoices", 33 => "Create Invoice", 34 => "Manage Invoice", 35 => "Delete Invoice", 36 => "Offline Credit Card Processing", 37 => "Support Center Overview", 38 => "Manage Announcements", 39 => "Manage Knowledgebase", 40 => "Manage Downloads", 41 => "List Support Tickets", 42 => "Open New Ticket", 43 => "Manage Predefined Replies", 44 => "View Reports", 45 => "Addon Modules", 46 => "Link Tracking", 47 => "Browser", 48 => "Calendar", 49 => "To-Do List", 50 => "WHOIS Lookups", 51 => "Domain Resolver Checker", 52 => "View Integration Code", 53 => "WHM Import Script", 54 => "Database Status", 55 => "System Cleanup Operations", 56 => "View PHP Info", 57 => "View Activity Log", 58 => "View Admin Log", 59 => "View Email Message Log", 60 => "View Ticket Mail Import Log", 61 => "View WHOIS Lookup Log", 62 => "Configure General Settings", 63 => "Configure Administrators", 64 => "Configure Admin Roles", 65 => "Configure Servers", 66 => "Configure Automation Settings", 67 => "Configure Payment Gateways", 68 => "Configure Tax Setup", 69 => "View Email Templates", 70 => "View Products/Services", 71 => "Configure Product Addons", 72 => "View Promotions", 73 => "Configure Domain Pricing", 74 => "Configure Support Departments", 75 => "Configure Spam Control", 76 => "Configure Banned Emails", 77 => "Configure Domain Registrars", 78 => "Configure Fraud Protection", 79 => "Configure Custom Client Fields", 80 => "API Access", 81 => "View Flagged Tickets", 82 => "Configure Database Backups", 83 => "Manage Network Issues", 84 => "Manage Quotes", 85 => "Configure Currencies", 86 => "Configure Security Questions", 87 => "CSV Downloads", 88 => "View Billable Items", 89 => "Manage Billable Items", 90 => "Configure Client Groups", 91 => "Refund Invoice Payments", 92 => "Delete Ticket", 93 => "View Income Totals", 94 => "Manage Clients Files", 95 => "Configure Ticket Statuses", 96 => "Delete Client Notes", 97 => "Perform Registrar Operations", 98 => "Create Upgrade/Downgrade Orders", 99 => "Configure Addon Modules", 100 => "Email Marketer", 101 => "Configure Product Bundles", 102 => "View Module Debug Log", 103 => "View Clients Summary", 104 => "View Support Ticket", 105 => "Decrypt Full Credit Card Number", 106 => "Update/Delete Stored Credit Card", 107 => "Create/Edit Promotions", 108 => "Delete Promotions", 109 => "View Banned IPs", 110 => "Add Banned IP", 111 => "Unban Banned IP", 112 => "Create/Edit Email Templates", 113 => "Delete Email Templates", 114 => "Manage Email Template Languages", 115 => "Create New Products/Services", 116 => "Edit Products/Services", 117 => "Delete Products/Services", 118 => "Manage Product Groups", 119 => "Allow Login as Client", 120 => "Configure Order Statuses", 121 => "Attempts CC Captures", 122 => "Generate Due Invoices", 123 => "Create Predefined Replies", 124 => "Create Predefined Replies", 125 => "Delete Predefined Replies", 126 => "Delete Predefined Replies", 127 => "Configure Two-Factor Authentication", 128 => "View Credit Log", 129 => "Manage Credits"); $smarty->assign('admin_perms', $adminpermsarray); require('lang/english.php'); $smarty->assign('_ADMINLANG', $_ADMINLANG); $results = localAPI('getclients', '', 'admin username with access to API'); $temp1 = array(); $temp2 = array(); foreach ($results['clients']['client'] as $value) { $temp1[] = $value['id']; if ($value['companyname'] == NULL) { $temp2[] = $value['firstname'] . ' ' . $value['lastname']; } else { $temp2[] = $value['firstname'] . ' ' . $value['lastname'] . ' - ' . $value['companyname']; } } $clients = array_combine($temp1, $temp2); $smarty->assign('clients', $clients); if (isset($_POST['userid'])) { $userid = $_POST['userid']; } else { $userid = $_GET['userid']; } if (!empty($userid)) { $clientsdetails = localAPI('getclientsdetails', array('clientid' => $userid, 'stats' => true), 'admin username with access to API'); $smarty->assign('clientsdetails', $clientsdetails['client']); $sidebarstats = array('orders' => array('pending' => 0), 'invoices' => array('overdue' => $clientsdetails['stats']['numoverdueinvoices']), 'tickets' => array('awaitingreply' => $clientsdetails['stats']['numactivetickets'])); $smarty->assign('sidebarstats', $sidebarstats); $smarty->assign('userid', $userid); } $smarty->display('admin_custom_page.tpl'); tpl file {include file="$template/header.tpl"} <form name=clientselect method="GET" action="{$smarty.server.PHP_SELF}?userid={$smarty.get.userid}"> Active Client: {html_options name=userid options=$clients selected=$userid style="width:265px;" onChange="submit();"} </form> <div id="clienttabs"> <ul> <li class="tab"><a href="clientssummary.php?userid={$clientsdetails.userid}">Summary</a></li> <li class="tab"><a href="clientsprofile.php?userid={$clientsdetails.userid}">Profile</a></li> <li class="tab"><a href="clientscontacts.php?userid={$clientsdetails.userid}">Contacts</a></li> <li class="tab"><a href="clientsservices.php?userid={$clientsdetails.userid}">Products/Services</a></li> <li class="tab"><a href="clientsdomains.php?userid={$clientsdetails.userid}">Domains</a></li> <li class="tab"><a href="clientsbillableitems.php?userid={$clientsdetails.userid}">Billable Items</a></li> <li class="tab"><a href="clientsinvoices.php?userid={$clientsdetails.userid}">Invoices</a></li> <li class="tab"><a href="clientsquotes.php?userid={$clientsdetails.userid}">Quotes</a></li> <li class="tab"><a href="clientstransactions.php?userid={$clientsdetails.userid}">Transactions</a></li> <li class="tab"><a href="clientsemails.php?userid={$clientsdetails.userid}">Emails</a></li> <li class="tab"><a href="clientsnotes.php?userid={$clientsdetails.userid}">Notes (0)</a></li> <li class="tab"><a href="clientslog.php?userid={$clientsdetails.userid}">Log</a></li> </ul> </div> <div id="tab0box" class="tabbox"> <div id="tab_content" style="text-align:left;"> <img src="images/spacer.gif" width="1" height="6"/><br/> <div style="font-size:18px;">#{$clientsdetails.userid} - {$clientsdetails.firstname} {$clientsdetails.lastname}</div> <img src="images/spacer.gif" width="1" height="6"/> <div> <!-- put html here --> </div> </div> </div> {include file="$template/footer.tpl"} The admin perms array was gathered from the smarty debug output. I am sure that there is a way to get the actual perms array so if anyone knows how to do it please let me know. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.