
craigedmonds
Retired Forum Member-
Posts
65 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Hotfixes
Everything posted by craigedmonds
-
PLease delete this thread. Opended by accident.
-
Vulnerability report (click jacking)
craigedmonds replied to kingsleymensah's topic in General Discussion
Errr........Why does WHMCS not provide this protection already, built in? -
How to verify admin logins outside WHMCS using POST and php
craigedmonds replied to craigedmonds's topic in Developer Corner
I figured it out. First I grab the hash from tbladmins table based on correct selection of username, then do the following which gives me true or false. password_verify() is a buit in php function: https://www.php.net/manual/en/function.password-verify.php if (password_verify($password, $hash)) -
I want to be able to verify admin users through an external api I am building. There already exists an api for clients called: ValidateLogin and in the api doc appears a page for it API:Get Admin Details but page is empty. See: https://docs.whmcs.com/API:Get_Admin_Details My question is: does anyone have any code I can use to pass a username and password to the database and verify them? I can see that the password is encrypted and hashed inside of tbladmins and not sure what php code or query I can use to validate the admin details. TIA
-
When we create an article inside of WHM KB, it makes the URL like this: https://www.jucra.com/whmcs/knowledgebase/23/Web-Hosting We dont want it like that, we want it like this: https://www.jucra.com/whmcs/kb/23/ Is this possible through some kind of configuration within htaccess or WHMCS admin itself? We will also need to redirect al the old posts to the new format EG: https://www.jucra.com/whmcs/knowledgebase/23/Web-Hosting > https://www.jucra.com/whmcs/kb/23/ TIA
-
Thanks. That has pointed me in the right direction!! This is what I have now when someone selects certain products. Ideally would be nice to have it above the cart but I will keep looking. This is the code I ended up with. I just manually define the special products and then loop through the cart. Seems to work. <?php add_hook('ShoppingCartViewCartOutput', 1, function($vars) { //define list of products that need to show a warning $array_of_special_items[] = array( 'special_pid' => 33, 'special_product_name' => "Mailtrust Professional Email Accounts", ); $array_of_special_items[] = array( 'special_pid' => 79, 'special_product_name' => "Hosted Microsoft Exchange", ); //grab cart contents $products_list = $vars["cart"]["products"]; //loops through the cart items $count = 0; foreach($products_list as $x) { //get product id $pid = $products_list[$count]["pid"]; //loop through array_of_special_items to get any matching products $count_special = 0; foreach($array_of_special_items as $x) { $special_pid = $array_of_special_items[$count_special]["special_pid"]; $special_product_name = $array_of_special_items[$count_special]["special_product_name"]; if($special_pid == $pid) { $show_warning = true; $array_of_special_items_names[] = $special_product_name; } $count_special = $count_special + 1; } //end loop $array_of_special_items $count = $count + 1; } //end loop $products_list //prepare cart warning for special products if($show_warning == true) { //prepare the list of products that match special items foreach($array_of_special_items_names as $names) { $special_items_list_html .= "<div class='special-names'>$names</div>"; } $return = ' <style> .special-names { background-color: #a94442; color: white; margin-bottom: 5px; padding: 10px; font-size: 16px; } </style> <p></p> <div class="alert alert-danger" role="alert"> <h2 style="font-weight:bold;">BEFORE YOU CONTINUE TO CHECKOUT - PLEASE READ</h2> <p>One or more of the products in your cart are regarded as SPECIAL ITEMS.</p> <p>'.$special_items_list_html.'</p> <p>This means they require additional verification before the order can be activated.</p> <p><strong>Verification may include and or all of the below.</strong></p> <p> <ol> <li>Verifcation by Phone</li> <li>Verifcation by SMS</li> <li>Verifcation by Email</li> <li>Verifcation of Photio ID</li> <li>Verifcation of Utility Bill</li> <li>Verifcation of Credit Card</li> </ol> </p> <p><strong>Verification times may vary. During normal business hours, verification can take 1-3 hours. Outside of business hours it may take longer.</strong></p> </div> '; } return $return; });
-
I have certain special products which need additional verification. So what I would like to do is: 1. When someone adds a product and goes to cart.php?a=view 2. If the product is a certain productid or marked as a special product somehow 3. Show some custom html See attachment for screenshot of what I am trying to achieve. Is this possible? And if so, how would I go about it?
-
Send Ticket Open Email only if Client
craigedmonds replied to craigedmonds's topic in Developer Corner
Nice suggestions thanks, especially the LIMIT 1 that makes pure sense. As for the score, actually that does work, because when the query starts, the score is 0, then if the email is not found in tblclients the score is increased to 1, then we check the tblcontacts and if its not found there either, the score is increased to 2. If the score = 2 then we abort sending otherwise we send (I did test this with two different email accounts, one a registered client and the other not, and worked great). Sure, I could avoid checking the tblcontacts if the email is found in tblclients but for the sake of easier to read code and the fact it's a basic select query I just quickly checked it anyway, does no harm. I could have actually used a union query to check both tables at the same time I guess and that would have made the code shorter but for the sake of what I am doing today, it works. Thanks for your input, very grateful. -
Send Ticket Open Email only if Client
craigedmonds replied to craigedmonds's topic in Developer Corner
My Final Code. if ($vars['messagename'] == 'Support Ticket Opened') { //get the from address $from = $vars['mergefields']['client_email']; //set the score $score = 0; //check inside of tblclients if $from exists $result = full_query("SELECT email FROM tblclients WHERE email = '$from'"); $rows = mysql_num_rows($result); if ($rows == 0) { $score = $score + 1; } //check inside of tblcontacts if $from exists $result = full_query("SELECT email FROM tblcontacts WHERE email = '$from'"); $rows = mysql_num_rows($result); if ($rows == 0) { $score = $score + 1; } //abort or not if($score == 2) { $return['abortsend'] = true; } } -
Send Ticket Open Email only if Client
craigedmonds replied to craigedmonds's topic in Developer Corner
Actually I figured it out. I Added a line into the hook like below and the log gave me all the variable names, then I open the log file and shows all the fields in $var. if ($vars['messagename'] == 'Support Ticket Opened') { $root = realpath($_SERVER["DOCUMENT_ROOT"]); error_log(print_r($vars, true), 3, $root.'/WHMCS-ERROR-LOG.log'); } The variable for the senders email will be: $vars['mergefields']['client_email']; -
Send Ticket Open Email only if Client
craigedmonds replied to craigedmonds's topic in Developer Corner
Great idea. However do you know how I get the email address? The documentation is a bit fuzzy. It gives a variable called $var, but what is the available items in that? As this is a hook, I have no way to output the value of $var. -
The world can send us an email to our support address, which is fine. This means ANYONE can email us. Again, thats fine. However, I ONLY want to send an autoresponder ticket open reply to those who are registered clients in the system. The problem that we are having at the moment is that spammers/cold emailers will send an email to our support address and of course we send back a "ticket opened" email, which usually ends up not being delivered, resulting in our mails getting blocked to legitainte users. Is there a hook I can "hook into" to stop sending the email if the email is not a client? FOR EXAMPLE: If spammer@gmail.com send an email to us, we accepts the email but DO NOT send a ticket reply. If client@gmail.com sends an email to us, we send a ticket opened reply. I have made hooks before, I am just wondering which one to use in terms checking the incoming email during support ticket creation.
-
How To Create A Custom Page in Admin?
craigedmonds replied to craigedmonds's topic in Developer Corner
Thanks Steve I will try that. -
I am running an agency and want to add a new page and a tab within the client admin section (clientssummary.php) and that page will contain various fields. The fields will not use the WHMCS custom client fields as I will store and display that data from a custom table. So when I load clientssummary.php I need to see a new tab called "Facebook Settings" and I will add a bunch of form fields which will save the data to custom table. I will then be able to create a client side page to display the checklist/data. Any tutorials out there?
-
I am working on a hook using EmailPreSend to prevent proforma invoice emails being sent to the client. (what we do is on the first of each month, for some clients, we merge all their proforma invoices into one invoice and send them the main invoice). However, I am stuck on understanding the var for "messagename". Really the API docs do not explain it very well at all. What would the message name be for $vars['messagename'] ?? Any ideas folks? <?php /* see: https://developers.whmcs.com/hooks-reference/everything-else/#emailpresend */ //prevent someone accessing this file directly if (!defined("WHMCS")) die("This file cannot be accessed directly"); add_hook('EmailPreSend', 1, function($vars) { //if this is the proforma invoice about to be sent we need to check if there //is any clients we DONT want to send proforma emails to if ($vars['messagename'] == 'My Message Name') { //this will be the proforma invoice number $relid = $vars['relid']; //list of client id's I DO NOT want to send proforma emails to $clients = array( "111", "222", ); //need to get the clientid from $relid $sql = "SELECT userid FROM tblinvoices WHERE id = $relid"; $result = full_query($sql); $data = @mysql_fetch_array ($result); $userid = $data['userid']; //check if userid is to NOT receive proforma emails if(in_array($userid, $clients)){ $merge_fields['abortsend'] = true; return; } } }); //end of hook ?>
-
Currently WHMCS offer different ways to present the urls in the KB but none of them suit my needs. I wanted to try and present them link this: mydomain.com/whmcs/kb/9999/ (where 999 is the kbarticle.id) This is so I can send a nice clean link to clients and also if we change the title of the article the url does not change. Is this possible through htaccess file or do I need to get someone to make a custom module to handle this? TIA
-
I am considering to use this project management system from wbteampro and was wondering if anyone has used it and what their opinion is. IS there like a super huge learning curve or is easy to work with?
-
Temporary Path version 7
craigedmonds replied to 3awh's topic in Installation, Upgrade, and Import Support
I already tried this: /home/marbs3958/public_html/clients/whmcsupdates/ I still get the error: The path you entered does not appear to be a valid directory. Please check it and try again. Yes, the path is valid. -
I have made a server module which connects to the rackspace mail api and all its files are stored within /whmcs/modules/servers/rackspace/. This is so the users can add/modify/delete their email accounts etc. I now need to make a hook so that when I am in the admin area editing the rackspace product, for example, increasing the mailboxes limit, I need to trigger a hook which executes some code stored within the server module in order to connect to the rackspace api. Where do I store the hook file?
-
I am in the process of creating my own integration with rackspace mail api and using GET is working no issues, but when making a POST, I am getting an error message simply saying "Resource id #210". I do notice in the post fields there is a field being generated automatically called "token". Do I need to do anything with this field? I do need to mention that the request does get through to rackspace api and I get a response, I am just suspicious about the error message being thrown. - - - Updated - - - I have solved it. There was something being echoed in the api connector.
-
Need to run hook when a package is changed for a client.
craigedmonds replied to craigedmonds's topic in Developer Corner
Ah ok. Now it makes sense. The documentation is not 100% clear. I think I get it now. Thank you very much for your help. -
Need to run hook when a package is changed for a client.
craigedmonds replied to craigedmonds's topic in Developer Corner
Thanks for replying. I have it working now becasue the actual name of the hook is called "ServiceEdit", however I now need to run the same hook when the product is added to the clients account, but in the documentation its not really clear what the name of the hook should be. I have managed to figure out that to run the hook when the service is deleted from the clients account is "ServiceDelete" so logic would suggest to me that when a service is added or created it should be "ServiceCreated" or "ServiceAdded"...but no. -
All I want to do is run a hook when I change the package for a client. Documentation says "Runs after the ChangePackage function has been successfully run." The documentation does not actually include any information on ChangePackage. Trying to run this. add_hook("ChangePackage",1,"cab_spain_update_package_details_in_wordpress"); DOES NOTHING. PLease help me as I am getting a bit pissed off with this.