wenjay tew

Forum Replies Created

Viewing 25 posts - 26 through 50 (of 86 total)
in reply to: Only display items that are not categorised. #192568

wenjay tew
Participant

Thanks. im trying to create a new topic for another question, it doesnt allow me

The below code is pasted on function.php
It allows us to automatically send a notification via email when a visitor downloads a file from WPDM on Website.

I have pasted the below code on function.php, however, I found out that it is only able to display a single character for the field “Company” when it is sent notification email (the field is an extra field created using Advanced Custom Fields.) refer screenshot below.

i have check all the script it was fine. is there anything wrong with the core code? or bugs?

https://pasteboard.co/XBPNft0Nhr3p.png


/** * This code notifies via email when visitor downloaded a file from wpdm. last updated 14Nov2023 */

add_action("wpdm_before_email_download_link", "your_function", 10, 2);
function your_function($post, $package){
    $package_data = get_post( $package['ID'] );
    $headers = 'From: NSW Download Center <example@nxxxxxxx.com>' . "\r\n";
    $headers .= 'Content-type: text/html' . "\r\n";
	
	//If it's in the trash, you won't be able to download it.
	if( $package['post_status'] == 'trash' ){
        status_header( 403 );
        die;
    }

    // Set the time zone to Asia/Singapore
    date_default_timezone_set('Asia/Singapore');
    $current_date_time = date('Y-m-d h:i:s A');

	$company = $post['custom_form_field']['Company-Name'];// Use Advanced custom field to send out company name.
	$file_type_array = WPDM()->package::fileTypes($package['ID'], false);// Send out file type of the packages downloaded.
	$file_types = implode(', ', $file_type_array);// Send out file type of the packages downloaded.
	
    $message = '<html><body>';
    $message .= '<strong>Attention Sales Team</strong>: A visitor has downloaded files from the NSW website. <br>This could indicate potential interest in our marketing materials or whitepaper. <br> Please review the information for possible follow-up with potential clients.
';
    $message .= '<strong>Leads/Downloader information:</strong>
';
    $message .= '<table style="border: 1px solid #ccc; background-color: #f5f5f5; border-collapse: collapse;">';
    $message .= '<tr><td style="font-weight: bold; border: 1px solid #ccc;">Name:</td><td style="border: 1px solid #ccc;">' . $post['name'] . '</td></tr>';
	$message .= '<tr><td style="font-weight: bold; border: 1px solid #ccc;">Company:</td><td style="border: 1px solid #ccc;">' . $company['EmailLock/Company'] . '</td></tr>';
    $message .= '<tr><td style="font-weight: bold; border: 1px solid #ccc;">Email:</td><td style="border: 1px solid #ccc;">' . $post['email'] . '</td></tr>';
    $message .= '<tr><td style="font-weight: bold; border: 1px solid #ccc;">Downloaded File:</td><td style="border: 1px solid #ccc;">' . $package_data->post_title . '</td></tr>';
	$message .= '<tr><td style="font-weight: bold; border: 1px solid #ccc;">File Type:</td><td style="border: 1px solid #ccc;">' . $file_types . '</td></tr>';
	$message .= '<tr><td style="font-weight: bold; border: 1px solid #ccc;">IP Address:</td><td style="border: 1px solid #ccc;">' . $_SERVER['REMOTE_ADDR'] . '</td></tr>';
    $message .= '<tr><td style="font-weight: bold; border: 1px solid #ccc;">File downloaded Date/Time:</td><td style="border: 1px solid #ccc;">' . $current_date_time . ' (GMT+8 Malaysia Time)</td></tr>';
    $message .= '</table>';
	$message .= '<br>This email is auto generated by web script when any files on NSW website download center is requested.
<br><br>';
    $message .= '<br></body></html>';

	$recipients = array(
	'Email@email.com',
	'xxxxxxx@gmail.com'
	);

$to = implode(', ', $recipients);

wp_mail($to, "Potential Leads - Visitor downloaded a file from the NSW website.", $message, $headers);
 
}

not sure if i have created mutiple post to this forum?
it seems doesnt allow me to post new topic here on the support center

in reply to: Only display items that are not categorised. #192488

wenjay tew
Participant

could u help me to forward? its very hard to work with it as it doesnt have filter to xcat.
thanks ya 🙂

in reply to: Only display items that are not categorised. #192484

wenjay tew
Participant

hi..is that fix? can i stil cant exclude it.

in reply to: Only display items that are not categorised. #192438

wenjay tew
Participant

How do i make wpdm_archive not display certain catagery.. there must be a way
I do not wan to hard code it.

in reply to: Only display items that are not categorised. #192393

wenjay tew
Participant

[wpdm_archive button_style=”primary” showcount=”0″ link_template=”link-template-default.php” xcats=”hidden” order_by=”modified” order=”desc” items_per_page=”10″]

hi I added this “xcats=”hidden” but still not working .. why?
my category slug name is “hidden” as i wan it hide and only can be found when i send them link.

it didn’t hide as shown here.

in reply to: Only display items that are not categorised. #192364

wenjay tew
Participant

hi i wan to hide specific categories only. not show specific categories. able to do so?
if not i would have to manually add categories to show one by one

in reply to: User level is blank #192359

wenjay tew
Participant
 </div>
            <div class="card-body tab-content">
    <?php $rc = 0; foreach ($levels as $role ► $name){ $rc++; ?>
        <h3 class="tab-pane fade <?php if($rc==1) echo 'show active'; ?>" role="tabcard" aria-labelledby="<?php echo $role; ?>" id="<?php echo $role; ?>" style="color: white!important;"><?php echo $name; ?></h3>
    <?php } ?>
</div>

sorry this is the code i changed

in reply to: User level is blank #192358

wenjay tew
Participant
 <div class="card-body tab-content">
    <?php $rc = 0; foreach ($levels as $role ► $name){ $rc++; ?>
        <h3 class="tab-pane fade <?php if($rc==1) echo 'show active'; ?>" role="tabcard" aria-labelledby="<?php echo $role; ?>" id="<?php echo $role; ?>" style="color: white!important;"><?php echo $name; ?></h3>
    <?php } ?>
</div>

i changed to this. its not working even. must be bug?

in reply to: User level is blank #192357

wenjay tew
Participant

still not working.

in reply to: User roles changing #192284

wenjay tew
Participant

Thanks

in reply to: User roles changing #192275

wenjay tew
Participant
// Duplicate the 'customer' role and create 'customer_a' role
add_role('Agent', 'Customer A', get_role('customer')->capabilities);

i have use this filter to duplicate.. wanted to ask if it is a correct way to do it without damaging anything?

in reply to: udb_page customize #192180

wenjay tew
Participant

What about question 1? i cant find any guides to it.

in reply to: udb_page customize #192174

wenjay tew
Participant

i have created a filter for question 1, but it doenst work.

function my_custom_dashboard_files($files) {
    // Check if a category filter is set
    if (isset($_GET['file_category_filter']) && !empty($_GET['file_category_filter'])) {
        $selected_category = sanitize_text_field($_GET['file_category_filter']);
        
        // Filter files by the selected category
        $filtered_files = array_filter($files, function($file) use ($selected_category) {
            return in_array($selected_category, $file['categories']);
        });
        
        return $filtered_files;
    }
    
    // If no category filter is set, return all files
    return $files;
}

why?


wenjay tew
Participant
This reply has been marked as private.

wenjay tew
Participant
This reply has been marked as private.

wenjay tew
Participant
This reply has been marked as private.
in reply to: wpdm_onstart_download – download email notification #191168

wenjay tew
Participant
This reply has been marked as private.

wenjay tew
Participant
This reply has been marked as private.

wenjay tew
Participant
This reply has been marked as private.

wenjay tew
Participant

hi what if i wanted to send file type to email?
`$message .= ‘File Type:’ . $post[‘file_types’] . ;
like that doesn’t work


wenjay tew
Participant
This reply has been marked as private.

wenjay tew
Participant

anny reply?

in reply to: wpdm_onstart_download – download email notification #190958

wenjay tew
Participant
$company = wpdm_acf($post['ID'], 'EmailLock/Company');
$message .= '<tr style="font-weight: bold;"><td style="border: 1px solid #000;">Company:</td><td style="border: 1px solid #000;">' . $company . '</td></tr>';

i tried this it doesn’t work iether

in reply to: wpdm_onstart_download – download email notification #190955

wenjay tew
Participant
$company = wpdm_acf([acf_EmailLock_Company], 'EmailLock/Company');
    $message .= "Company: " . $custom_data . "<br>";

Hi is the code correct? to call it out

in reply to: wpdm_onstart_download – download email notification #190893

wenjay tew
Participant

any updates?

Viewing 25 posts - 26 through 50 (of 86 total)