Jump to content

DennisMidjord

Level 2 Member
  • Content count

    253
  • Joined

  • Last visited

  • Days Won

    4

DennisMidjord last won the day on January 31

DennisMidjord had the most liked content!

Community Reputation

8 Neutral

About DennisMidjord

  • Rank
    Level 2 Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. DennisMidjord

    Custom form in WHMCS

    Thanks again, @brian! Great. I read about 'whereIn', but I did '->whereIn('packageid', ('60, 61')' instead and couldn't get it working. I'll update my code to match yours 🙂
  2. DennisMidjord

    Custom form in WHMCS

    Send me your details (PayPal or something like that), and I'll send a few bucks for the help 🙂 I went with the following code: contactphone.tpl: {if $sent} {include file="$template/includes/alert.tpl" type="success" msg=$LANG.phoneSupportRequest.sent textcenter=true} {/if} {if $errormessage} {include file="$template/includes/alert.tpl" type="error" errorshtml=$errormessage} {/if} <div class="container"> <div class="row"> {if !$sent} <form action="contactphone.php" method="post" enctype="multipart/form-data" role="form"> <input type="hidden" name="action" value="send" /> <div class="form-group"> <label for="inputName" class="col-sm-3 control-label">{$LANG.contactemail}</label> <div class="col-sm-7"> <input type="text" name="email" value="{$name}" class="form-control" id="inputName" /> </div> </div> <div class="form-group"> <div class="text-center"> <button type="submit" class="btn btn-primary">{$LANG.contactsend}</button> </div> </div> </form> {/if} </div> </div> contactphone.php <?php use WHMCS\ClientArea; use WHMCS\Database\Capsule; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->initPage(); $contactFormSent = false; $email = $_POST["email"]; $phonenumber = Capsule::table('tblclients') ->where('email', '=', $email)->value('phonenumber'); $clientid = Capsule::table('tblclients') ->where('email', '=', $email)->value('id'); // Check if client has an active Phone Support product (id 92) $hasPhoneSupport = Capsule::table('tblhosting') ->where('userid', '=', $clientid) ->where('packageid', '=', '92') ->where('domainstatus', '=', 'Active') ->count(); // Check if client has an active VPS (either ID 60 or 61) $hasVPS = Capsule::table('tblhosting') ->where('userid', '=', $clientid) ->where('packageid', '61') ->where('domainstatus', '=', 'Active') ->orWhere('userid', '=', $clientid) ->where('packageid', '60') ->where('domainstatus', '=', 'Active') ->count(); if( $action == "send" ) { if(!$phonenumber){ $ca->assign(errormessage, "No phone number has been set for you account"); } elseif($hasVPS == 0 AND $hasPhoneSupport == 0) { $ca->assign(errormessage, "You have no phone support subscription"); } else { $command = 'OpenTicket'; $postData = array( 'deptid' => '2', 'name' => "Replace with client's username", 'email' => "Replace with client's email", 'subject' => "Phone Support Request", 'message' => $phonenumber, 'priority' => 'Medium', 'useMarkdown' => 'true', ); $adminUsername = 'Admin'; $results = localAPI($command, $postData, $adminUsername); $ca->assign("sent", true); } } $ca->setTemplate('contactphone'); $ca->output(); If a client has no valid subscription: If the message was sent successfully:
  3. DennisMidjord

    Custom form in WHMCS

    Nevermind, managed to fix it 😄 It had to use the following: $ca->assign(errormessage, "No phone number has been set for you account"); Thanks for all your help @brian! Please let me buy you a cup of coffee 😄
  4. DennisMidjord

    Custom form in WHMCS

    Thanks for all your help @brian! - I'm really glad. You've helped me so much with various problems 🙂 It's going to be a custom page or embedded into the current 'submitticket.php' website. I haven't decided yet - but I know how to do both. I'm just not strong in PHP. I also know about the Open Ticket API as I've used it for various WHMCS Hooks 🙂 I've managed to achieve what I want by doing this: <?php use WHMCS\ClientArea; use WHMCS\Database\Capsule; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->initPage(); $email = $_POST["email"]; $phonenumber = Capsule::table('tblclients') ->where('email', '=', $email)->value('phonenumber'); $clientid = Capsule::table('tblclients') ->where('email', '=', $email)->value('id'); // Check if client has an active Phone Support product (id 92) $hasPhoneSupport = Capsule::table('tblhosting') ->where('userid', '=', $clientid) ->where('packageid', '=', '92') ->where('domainstatus', '=', 'Active') ->count(); // Check if client has an active VPS (either ID 60 or 61) $hasVPS = Capsule::table('tblhosting') ->where('userid', '=', $clientid) ->where('packageid', '61') ->where('domainstatus', '=', 'Active') ->orWhere('userid', '=', $clientid) ->where('packageid', '60') ->where('domainstatus', '=', 'Active') ->count(); if(!$phonenumber){ $errormessage = "No phone number has been set for you account"; } elseif($hasVPS == 0 AND $hasPhoneSupport == 0) { $errormessage = "You have no phone support subscription"; } else { $command = 'OpenTicket'; $postData = array( 'deptid' => '2', 'name' => "Dennis", 'email' => "test@test.com", 'subject' => "Phone Support Request", 'message' => $phonenumber, 'priority' => 'Medium', 'useMarkdown' => 'true', ); $adminUsername = 'Admin'; $results = localAPI($command, $postData, $adminUsername); $successMessage = "A supporter will contact to you soon"; } $ca->setTemplate('contactphone'); $ca->output(); And then a simple template file with the following: {if $errormessage} {include file="$template/includes/alert.tpl" type="error" errorshtml=$errormessage} {/if} <div class="container"> <div class="row"> <form action="contactphone.php" method="post" enctype="multipart/form-data" role="form"> <input type="text" name="email" placeholder="Email" /> <input type="submit" name="submit" /> </form> </div> </div> We don't do phone support, except if the client purchases a specific product (either a product called Phone Support or a VPS). When the client wants to talk to us, they should input his email in a form (not logged in necessarily), and the code should check whether there's a phone number assigned to the user, and if he qualifies for phone support. How would I go about showing the errors or a success message?
  5. DennisMidjord

    Custom form in WHMCS

    How would we go about creating a custom form in WHMCS? The form should only take one input (email address). When the client submits this, the value will be checked against the WHMCS database, and if a phone number is found, a ticket should be created containing the client's phone number. I can't seem to find a way for WHMCS to accept custom user input. Can't that be done?
  6. DennisMidjord

    Anyone know what happened to BusyRack.com?

    And seems like the license server works just fine now. What happens if their license server shuts down for good? Is that just too bad?
  7. DennisMidjord

    Anyone know what happened to BusyRack.com?

    We're in the same situation. Would love to see it working again as we recently bought the module.
  8. DennisMidjord

    Multiple Ip Access ban account

    Have you setup any form of captcha on the login forms? That would probably solve most of your issues.
  9. DennisMidjord

    Changing where a product in the cart links to

    Thanks for the great answer, @brian! 🙂 I'm gonna stick with the "simple" solution for now (as it seems to work just fine, and I don't plan to mess with the name of the 'Categories' item :P), but I'll definitely save your post for later!
  10. Hi, We're trying to change where products in the sidebar in the cart-menu links to. I've tried this so far without luck: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function($secondarySidebar) { $secondarySidebar->getChild('Categories')->getChild('Webhosting')->setUri('webhosting.php'); }); Any idea if it's possible at all? I can remove the category-section just fine using 'removeChild('Categories')'. Edit: I obviously made a typo. That has been fixed now - but now I see an error on every other page like " Error: Call to a member function getChild() on null in " Edit2: I might have fixed it by doing this: add_hook('ClientAreaSecondarySidebar', 1, function($secondarySidebar) { if (!is_null($secondarySidebar->getChild('Categories'))) { $secondarySidebar->getChild('Categories')->getChild('Webhosting')->setUri('webhosting.php'); } }); Is that the correct way to do it?
  11. DennisMidjord

    RewriteRules doesn't work in WHMCS

    Hi, I'm having trouble rewriting some of the URLs in WHMCS. WHMCS is installed in /client directory. I want to rewrite all of the product URL (/client/cart.php?gid=1 fx) to /client/cart/<id> or similar. I've tried this to rewrite it to /client/gid/<id>: RewriteEngine on RewriteBase / RewriteRule ^gid/([^/]*)\.html$ /cart.php?gid=$1 [L] But that didn't work. I'm doing this in the .htaccess file in the /client/ directory. Any idea why that won't work? Edit: Managed to make it work... Forgot to put the rules above the ones created by WHMCS.
  12. DennisMidjord

    Answer and Close ticket

    What, are you sure? That has never happened to us. It even says in the documentation that it's only for 'Open' or 'Answered':
  13. DennisMidjord

    Answer and Close ticket

    @brian! we're already using the Auto Close feature, but that doesn't help us in this case. It'll just leave us with a bunch of tickets with 'Customer Reply'-status which will need to be changed to 'Answered' in order for the Auto Close feature to close them. And in that case, we might as well close the ticket manually. 🙂
  14. DennisMidjord

    Answer and Close ticket

    It seems like a lot of clients have no idea that they can close their ticket when their issue is solved. We want to add a button called "Answer and Close ticket" to make it more obvious for the customer that they should close tickets when an issue is fixed. I've been trying to mess with this for some time now, but it can't seem to make it work. Has anyone done this before in WHMCS?
×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated