Jump to content

Hook doubt


hmaddy

Recommended Posts

You'd need to query the database for that information.

It can be done like this:
 

<?php

use WHMCS\User\Client;

add_hook('OrderPaid', 1, function($vars) {
    $client = Client::find($vars['userId']);
	
	// First name: $client->firstname
	// Last name: $client->lastname
});

You can find more information about working with models in WHMCS here: https://docs.whmcs.com/Using_Models

If you're familiar with models in Laravel, you can basically use the same features as Laravel offers.

Link to comment
Share on other sites

<?php
use WHMCS\User\Client;

add_hook('OrderPaid', 1, function($vars) {
    // Perform hook code here...
         $client = Client::find($vars['userId']);
        $fname = client->firstname;
        $email = client->email;
         $orderid = $vars['orderid'];
         $userid = $vars['userid'];
         $invoiceid = $vars['invoiceid'];

?>

 

Now how can i check it whether the data is available or not.

Link to comment
Share on other sites

<?php
use WHMCS\User\Client;

add_hook('OrderPaid', 1, function($vars) {
    // Perform hook code here...
         $client = Client::find($vars['userId']);
        $fname = client->firstname;
        $email = client->email;
         $orderid = $vars['orderid'];
         $userid = $vars['userid'];
         $invoiceid = $vars['invoiceid'];

?>

 

This is also not working.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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