• Resolved dimitrislalas

    (@dimitrislalas)


    I have trounble with the apply filters for decrypting the license key. I want to do some customizations within the functions.php file of wordpress but the function getDecryptedLIcenseKey throws me the license key encrypted. I tried doing the add_action after setup theme and plugins_loaded but still i get the key encrypted

Viewing 7 replies - 1 through 7 (of 7 total)
  • A.Tariq

    (@arsalantariq)

    Hi @dimitrislalas

    Hope you are well.

    What do you want to achieve firstly as getDecryptedLicenseKey works on license object if you have the license object you can call the licenseOBJ->getDecryptedLicenseKey(); like this but first you should have the license object. Which filter are you using for decrypting the license?

    Thanks

    Thread Starter dimitrislalas

    (@dimitrislalas)

    add_action(‘after_setup_theme’,’doit’)
    function doit(){
    $uid = get_current_user_id();

    /** @var LicenseResourceModel[] $licenses */
    $licenses = LicenseResourceRepository::instance()->findAllBy(array(‘created_by’ => $uid));

    $response = array();
    $check= array();
    foreach ($licenses as $license) {
    //$licenseData = $license->toArray();
    // Remove the hash, decrypt the license key, and add it to the response
    // unset($licenseData[‘hash’]);
    // $licenseData[‘licenseKey’] = $license->getDecryptedLicenseKey();
    $check[0]=”;
    $check[]= $license-> getCompanyName();
    //apply_filters(‘lmfwc_decrypt’,$key);
    //$response[] = $licenseData[‘licenseKey’];
    $response[] = $license->getDecryptedLicenseKey();
    }

    if($check[1]!=null){
    wpas_add_custom_field( ‘cp_name’,
    array(
    ‘title’ => __( ‘Select your Company Name’, ‘wpas’ ),
    ‘field_type’ => ‘select’,
    ‘log’ => true,
    ‘show_column’ => true,
    ‘show_frontend_detail’ => true,
    ‘sortable_column’ => true,
    ‘required’ => true,
    ‘options’ => $response )
    );}else{
    wpas_add_custom_field( ‘cpname’,
    array(
    ‘title’ => __( ‘Select your Company Name’, ‘wpas’ ),
    ‘field_type’ => ‘select’,
    ‘show_column’ => true,
    ‘show_frontend_detail’ => true,
    ‘sortable_column’ => true,
    ‘required’ => true,
    ‘options’ => array(
    ”=> ‘You dont have any products attached to a company name!’)
    ) );

    }
    }}

    • This reply was modified 4 years, 7 months ago by dimitrislalas.
    Thread Starter dimitrislalas

    (@dimitrislalas)

    I am trying to implemend this code to the functions.php file. And at the output i get the license key encrypted

    A.Tariq

    (@arsalantariq)

    @dimitrislalas let me look into this and get back to you soon.

    A.Tariq

    (@arsalantariq)

    @dimitrislalas

    Use LicenseManagerForWooCommerce\Repositories\Resources\License as LicenseResourceRepository;

    add_action(‘init’,’doit’);
    function doit() {
    $uid = get_current_user_id();`

    /** @var LicenseResourceModel[] $licenses */
    $licenses = LicenseResourceRepository::instance()->findAllBy(array('created_by' => $uid));
    
    $response = array();
    foreach ($licenses as $license) {
    $response[] = $license->getDecryptedLicenseKey();
    }

    Thanks

    Thread Starter dimitrislalas

    (@dimitrislalas)

    Thats perfect! It worked! Thank you very much. I search everythhing about what i should do with the add_action call but i couldnt find the right one.

    A.Tariq

    (@arsalantariq)

    @dimitrislalas great … thanks

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Decrypted License key’ is closed to new replies.