Jump to content

JesusSuarz

Member
  • Content Count

    67
  • Joined

  • Last visited

Community Reputation

5 Neutral

About JesusSuarz

  • Rank
    Newbie

Recent Profile Visitors

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

  1. Has anyone really worked with sessions in different domains with whmcs? ... Isn't there a way to identify if a user is logged in from a sub-domain? It seems that WHMCS should add a field in the customer table that indicates whether the user is logged in or not, it would be quite a useful function. or if there is any other way then they should mention it.
  2. Hello, Why do you think it cannot be used in another domain? I have a similar theme here:
  3. Hello, I'm trying to get some way to query if a user is online. I don't want to know the current user. if not something you can define for example $clientid or $userid or $emailclient ... I am making an external site. and i need to work with user sessions. (I am making a remote connection with the api). this function does not currently exist in the api available. I've been seeing this: https://developers.whmcs.com/advanced/authentication/ however I do not see that it allows to define the user. I was also seeing this: https://docs.whmcs.com/Sessions I was able to save the cookie in the database, however I can't find any way to identify the one that belongs to each user. any idea how I can get (which users are online?) .. (please nothing to do with smarty, only php). postdata: forget to tell the method I use to get user authentication in my application. create the following code for my application: I first make a connection to the api: https://developers.whmcs.com/api/authentication/ soon ValidateLogin: https://developers.whmcs.com/api-reference/validatelogin/ soon GetClientsDetails: https://developers.whmcs.com/api-reference/getclientsdetails/ soon CreateSsoToken: https://developers.whmcs.com/api-reference/createssotoken/ // validar usuario $command = 'ValidateLogin'; $postData = array( 'email' => $email_user, //post 'password2' => $password_user, //post ); $api_login = localAPI($command, $postData); //var de id de usuario: $api_login["userid"]; // si se encuentra el user entonces traer detalles del usuario via email $clientid = array(); // array que tiene el id del cliente if ($api_login["userid"] == true) { $command = 'GetClientsDetails'; $postData = array( 'email' => $email_user, // email login ); $details_client = localAPI($command, $postData); $clientid[] = $details_client["client_id"]; } // variable del clientid es: $clientid[0]; // crear token de session $command = 'CreateSsoToken'; $postData = array( 'client_id' => $clientid[0], ); $results_ssotoken = localAPI($command, $postData); echo '<pre>'; var_dump($results_ssotoken); echo '</pre>'; this will create the url with (CreateSsoToken) where the user will be redirected for autologin, however the cookie is created only after entering the client area. that's why I don't know how to get the cookie, or identify the user. @brian! would you help me with this?
  4. in other words, I am trying to get the custom values of a product from a customer....
  5. Hello I have a variable that is printed with {debug} in the tpl template. however I want to get the result in php of this variable. I need to get $customfields from a hook. how could you access $customfields that is printed inside a product @brian! could you help me?
  6. you were right, although it was $client->isEmailAddressVerified() the () were missing at the end. here is a new version of the code written. the texts are in Spanish, sorry. 🙂
  7. sometimes the client can have 2 emails. one for your account details and one for the account owner. I need to know if the account owner's email is verified. The var: $client = Menu::context("client"); gets the email that the customer has in the account details, however this is not the email owner of the account. I hope to make myself understood correctly.
  8. after doing hundreds of tests I was able to identify that emailVerified does work. therefore the original script did work. my problem was the user I was using, it was modified directly in my database. therefore the @Sentq script works fine. I apologize for posting wrongly.
  9. after checking $client with a var_dump I realized that neither of the 2 options would work. neither emailVerified nor isEmailAddressVerified I had to use: email_verified_at email_verified_at returns the value in bool, which is null or true. here I leave the new code. <?php /** * Limit Access For Unverified Accounts * @package WHMCS ActionHook * @author Sentq <sales@whmcms.com> and JesusSuarz <info@cangurohosting.com> * @copyright Copyright (c) CanguroHosting.com 2016-2021 * @link http://www.whmcms.com/ */ if (!defined("WHMCS")) die("This file cannot be accessed directly"); use WHMCS\View\Menu\Item as MenuItem; use Illuminate\Database\Capsule\Manager as Capsule; # ¿Le gustaría evitar que las cuentas no verificadas realicen pedidos ?, configúrelo en falso para aceptar pedidos define("PREVENTUNVERIFIEDORDERS", true); # Cuántos días esperar antes de desactivar la cuenta no verificada, establezca 0 para desactivar esta función define("DEACTIVATEACCOUNTAFTERXDAYS", 0); # Cuántos días esperar antes de establecer la cuenta no verificada como cerrada, establecer 0 para deshabilitar esta función define("CLOSEACCOUNTAFTERXDAYS", 0); # No se completarán pedidos si el correo no esta verificado. add_hook("ShoppingCartValidateCheckout", 1, function($vars){ if (PREVENTUNVERIFIEDORDERS===true){ $client = Menu::context("client"); if (!is_null($client) && $client->email_verified_at!==true){ return array("¡Primero debe verificar su dirección de correo electrónico antes de completar cualquier pedido!"); } } }); # Desactivar la cuenta no verificada después de x días # http://docs.whmcs.com/Clients:Profile_Tab#Changing_a_Clients_Status add_hook("DailyCronJob", 1, function($vars){ if (intval(DEACTIVATEACCOUNTAFTERXDAYS)!==0){ $dateCreated = date("Y-m-d", strtotime("now - ".intval(DEACTIVATEACCOUNTAFTERXDAYS)." days")); $getAccounts = Capsule::table("tblclients")->where("datecreated", "=", $dateCreated)->where("email_verified", "=", 0); foreach ($getAccounts->get() as $account){ Capsule::table("tblclients")->where("id", $account->id)->update(array("status" => "Inactive")); } } }); # Cerrar cuentas no verificadas después de X días # http://docs.whmcs.com/Clients:Profile_Tab#Changing_a_Clients_Status add_hook("DailyCronJob", 1, function($vars){ if (intval(CLOSEACCOUNTAFTERXDAYS)!==0){ $dateCreated = date("Y-m-d", strtotime("now - ".intval(CLOSEACCOUNTAFTERXDAYS)." days")); $getAccounts = Capsule::table("tblclients")->where("datecreated", "=", $dateCreated)->where("email_verified", "=", 0); foreach ($getAccounts->get() as $account){ Capsule::table("tblclients")->where("id", $account->id)->update(array("status" => "Closed")); } } }); This is executed after accepting the terms in the payment options in: your_whmcs.com/cart.php?a=checkout screenshot
  10. in this case the problem is not about my code. if not on the whois server for .nl domains then the administrators of the whois server of the .nl domains should to allow more requests per day. I find it absurd that they only allow 15 searches a day.
  11. you can see it working on my whmcs 8.0.4 https://cangurohosting.com/dash/cart.php?a=add&domain=register if you are using whmcs in a folder you must check the url: '/verify-whois.php', in my case it is: url: '/dash/verify-whois.php', You must also verify that the chain of the classes in the javascript "elDominio" and the above are correct according to your template. here I leave a video: https://www.loom.com/share/5aee770fb7984616bd3eb4f7401814d3
  12. If you look at the code carefully, you'll see that it only runs when the domain is not available. also I have tested this with the domain suggestions and it works perfectly. I'm going to integrate it to the lagom template and make another video to demonstrate that it works perfectly.
  13. after checking this. I see that it does not work. could you check the code? apparently stopped working for whmcs v8 I want them to not be able to order. (If the email is not verified then it will not allow you to place the order)
  14. after seeing your theme, which by the way is old. this can be fixed as follows: $api_key = "your api key generated from the reseller portal"; $email_auth = "email from the reseller portal, it is the same from your whmcs customer account almost always"; $action = ""; $url_api_whmcs = "https://licenseapi.whmcs.com/v2/reseller/?email=$email_auth&apikey=$api_key&action=listlicenses"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url_api_whmcs); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); var_dump(curl_exec($ch)); with this you can see a list of your licenses, just change the action for what you want to recover. and ready.
  15. So to update this topic a bit, because I am also interested in showing prices in bitcoin (btc). in my case I made a hook to update the price of the coin. (and then with the daily cron task the prices will be updated). however, I face the same problem. prices appear in (0.00) the only way to fix this is to modify the currency table so that it accepts new decimal values such as 0.0000043 (7 decimal places) corresponding to $0.01 dollars. @Brian! do you think there is any other way to achieve this?
×
×
  • 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