Jump to content

websavers

Member
  • Content Count

    274
  • Joined

  • Last visited

  • Days Won

    3

websavers last won the day on January 19

websavers had the most liked content!

Community Reputation

9 Neutral

About websavers

  • Rank
    Level 2 Member

Recent Profile Visitors

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

  1. I'm confused as to how this is different from what's built in to WHMCS. They didn't remove this function, they just moved it to Users, which makes sense as Clients no longer have passwords - users do. It's done in the WHMCS admin under The Client Account > Users > Click the arrow to the right of the user > Password Reset That triggers the password reset process securely.
  2. When using the Project Management addon, there's no option to hide completed project tasks by default, so you have to check the box every time you view a project. This is a bigger deal with projects that have lots of tasks. Here's the hook on GitHub: https://github.com/websavers/WHMCS-Hook-Project-Management-Hide-Completed-Tasks Enjoy!
  3. Just realized the get_addon function wasn't included: /** * * For unknown reasons you can't feed GetClientsAddons * a specific addon ID. The addonid parameter it accepts * is for the parent addon, not a provisioned service's addon. * * Returns $addon array exactly like the WHMCS API * * Reference: https://developers.whmcs.com/api-reference/getclientsaddons/ * * * * @return array */ public static function get_addon($serviceid, $addonid){ $results = localAPI('GetClientsAddons', array('serviceid' => $serviceid)); $addon = null; foreach ($results['addons']['addon'] as $a){ if ($a['id'] == $addonid){ $addon = $a; break; } } return $addon; } Note: I realize an SQL query might be more efficient, however ensuring the result formatting matches the array notation and data from GetClientsAddons is important to me, and so this was the simplest way to ensure that consistency.
  4. Hey all, Here's a few functions that I include in a class found in each module's lib folder that I find super helpful. They basically work around WHMCS's occasional shortsightedness when it comes to how they expect modules to be used. Hope they help others here. /** * * Called most often by hooks.php to obtain common module * vars since they are not passed into the hook as $vars * * NOTE: This only works when directly within the module's * lib folder due to use of dirname() * * Returns $vars with module settings and lang included * * * * @return array */ public static function merge_vars(array $vars){ $modulepath = dirname(__DIR__, 1); //1 = up one $modulename = basename($modulepath); //folder name = module name // Get module settings from DB $pdo = Capsule::connection()->getPdo(); $statement = $pdo->prepare("SELECT setting,value FROM tbladdonmodules WHERE module=:modulename"); $statement->execute([':modulename' => $modulename]); $settings = $statement->fetchAll(\PDO::FETCH_KEY_PAIR); $translations = array(); // Get module translations if (empty($vars['_lang'])){ $active_lang = $GLOBALS['aInt']->language; include_once("$modulepath/lang/$active_lang.php"); $translations = array('_lang' => $_ADDONLANG); } return array_merge($vars, $settings, $translations); } /** * Called most often by hooks.php using admin footer hook * to obtain service info from request vars. * * Sadly there's two URL parameter formats: * admin/clientsservices.php?userid=149&productselect=1243 * admin/clientsservices.php?userid=149&id=1243 * # Product Addons * admin/clientsservices.php?userid=149&productselect=a559 * admin/clientsservices.php?userid=149&id=1243&aid=559 * * Returns array with service / hosting plan data * * * * @return array */ public static function get_adminarea_service(){ $id = empty($_REQUEST['id'])? $_REQUEST['productselect'] : $_REQUEST['id']; if (!empty($_REQUEST['aid'])){ //Addon good format $serviceid = $_REQUEST['id']; $aid = $_REQUEST['aid']; return self::get_addon($serviceid, $aid); } else if (str_starts_with($id, 'a')){ //Addon stupid format $aid = ltrim($id, 'a'); $serviceid = Capsule::table('tblhostingaddons')->where('id', '=', $aid)->value('hostingid'); return self::get_addon($serviceid, $aid); //Do this for consistency of data. } else{ // Regular Service $results = localAPI('GetClientsProducts', array('serviceid' => $id)); return $results['products']['product'][0]; } } Note: get_admin_area_service requires PHP 8 due to the str_starts_with function call.
  5. Try temporarily connecting the dev instance of WHMCS with the live Plesk server and attempt a provision to see if it also doesn't work there.
  6. Is there just one WHMCS install with two servers configured -- the production and test servers? Or do you also have a production and test installation of WHMCS?
  7. Here's an example of how we built it for the Plesk module here: https://github.com/websavers/WHMCS-Plesk-Fixes-Module/blob/master/plesk_fixes/hooks.php The gist is you also need to return the password back to the PreModuleCreate function so that it uses it during creation of the account, like this: return array( 'password' => $password );
  8. In the WHMCS admin, when viewing any particular client's product, there are three possible URI's / request vars used depending on what link you clicked to reach the page: 1. /whmcs/admin/clientsservices.php?userid=UID&id=PID 2. /whmcs/admin/clientsservices.php?userid=UID&productselect=PID 3. /whmcs/admin/clientsservices.php?userid=UID Which is a problem if you're developing modules using hooks that don't supply you with the product ID through a hook function parameter -- particularly the last one where we can't even *try* to derive the product ID from a REQUEST var. And so I submit this as a bug with the (pretty simple) solution being to make that consistent and always have one productid parameter, I don't care of its "id" or "productid" or "serviceid" but make it consistent. I also told them all steps necessary to reach those varying URL structures.
  9. I'm sure anyone who has tried to submit a bug to WHMCS can relate. I feel like it's truly a bug about as often as it's never lupis on House.
  10. More than a few times, I've found myself scrolling through a ticket to find an attachment, or trying to guess at filenames with a on-page text search. To avoid this hassle, I've created the hook at the following repo, free for all to use and contribute to. It provides a list of all ticket attachments in the ticket sidebar with the following capabilities: Click the attachment filename to download it Click the small message bubble to jump directly to the message it was attached to (handy for message context) It's super basic, but could be handy for more than just me! Enjoy 🙂 https://github.com/websavers/WHMCS-Ticket-Attachments-List
  11. Updated in fork to fix the 'view message' pop-up no longer being a new window, and is now a modal: https://github.com/websavers/whmcsEmailImportHook?organization=websavers&organization=websavers
  12. When upgrading to 8.3 from 8.2.x, if you have customized templates and are using the Plesk module, you'll suddenly find the $moduleoutput variable outputs nothing at all. This is because the Plesk module has been updated to not use $moduleoutput to output HTML for the login button. The login action is now entirely part of the dynamically generated module actions menu. Similarly login actions with deep links within Plesk's panel (ex: to file manager, email accounts) are *only* part of the automatic/uneditable (in the template) $tplOverviewTabOutput variable. For whatever reason this wasn't described anywhere (such as in the deprecation and removal notices) as a clear change that template developers should pay attention to. FWIW, I'm not complaining about the changes, just that they weren't detailed as a major change to how module output is shown on the product details template.
  13. I'd also like to add one additional request on this topic: that the WHMCS Client Area front-end *not* be brought down should there be licensing server problems. In other words, I think it's more than reasonable to only do license checks when accessing the WHMCS admin area. This way even if we're experiencing problems with WHMCS, it doesn't affect customers -- only admins.
  14. They did address them in tickets to those users. The gist is that the license cache would normally work great to prevent WHMCS outages when their license servers are down, however the cache is erased any time a WHMCS instance is accessed using a different URL, which could include an alternate domain, or an IP address if your web server is configured to access the WHMCS instance by IP. (Note that it doesn't need to be an actual admin of your WHMCS install accessing it via the alternate domain or IP -- it could just be bots pinging the site using that incorrect URL that cause the license cache to be erased, and so the actual WHMCS admin would never know its happening). And so John's list above is a list of possible solutions to prevent the URL being used to check in with the licensing server from changing, thus ensuring the integrity of the license cache.
  15. Hey John, this seems mostly reasonable to me, however I would say that in terms of the system URL redirect, many web apps do this, like WordPress. You simply add documentation indicating how to change the URL after a relocation. You could even supply a PHP CLI script to help make it happen. If this is reasonable for other web apps, I see no reason it's not reasonable for WHMCS. As for your selected solution: would that alert show to all admins no matter which URL they've logged in with, and only after someone (but not necessarily that admin) has attempted to access WHMCS from a URL other than the system URL? The reason I'm asking is that whomever logs in using the wrong URL (domain/IP) may not be the one who needs to see the alert to correct it. Further the WHMCS instance may be accessed by someone not even logging in at all, which apparently clears that license cache as well.
×
×
  • Create New...

Important Information

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