Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    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

    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.
Viewing 3 replies - 1 through 3 (of 3 total)