Marketing NSW

Forum Replies Created

Viewing 25 posts - 26 through 50 (of 86 total)
Jan 22, 2024 at 9:05 am
#192568
Participant
Marketing NSW
OP

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

Jan 15, 2024 at 7:25 am
#192488
Participant
Marketing NSW
OP

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

Jan 15, 2024 at 3:51 am
#192484
Participant
Marketing NSW
OP

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

Jan 11, 2024 at 9:12 am
#192438
Participant
Marketing NSW
OP

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

Jan 9, 2024 at 12:14 pm
#192393
Participant
Marketing NSW
OP

[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.

Jan 8, 2024 at 11:48 am
#192364
Participant
Marketing NSW
OP

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

Jan 8, 2024 at 9:55 am
#192359
Participant
Marketing NSW
OP
 </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

Jan 8, 2024 at 9:46 am
#192358
Participant
Marketing NSW
OP
 <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?

Jan 8, 2024 at 9:39 am
#192357
Participant
Marketing NSW
OP

still not working.

Jan 3, 2024 at 10:17 am
#192284
Participant
Marketing NSW
OP

Thanks

Jan 3, 2024 at 9:26 am
#192275
Participant
Marketing NSW
OP
// 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?

Dec 27, 2023 at 2:38 am
#192180
Participant
Marketing NSW
OP

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

Dec 26, 2023 at 10:18 am
#192174
Participant
Marketing NSW
OP

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?

Nov 9, 2023 at 7:09 am
#191200
Participant
Marketing NSW
OP
This reply has been marked as private.
Nov 9, 2023 at 3:12 am
#191191
Participant
Marketing NSW
OP
This reply has been marked as private.
Nov 9, 2023 at 2:26 am
#191190
Participant
Marketing NSW
OP
This reply has been marked as private.
Nov 8, 2023 at 11:21 am
#191168
Participant
Marketing NSW
OP
This reply has been marked as private.
Nov 8, 2023 at 9:19 am
#191159
Participant
Marketing NSW
OP
This reply has been marked as private.
Nov 8, 2023 at 4:01 am
#191148
Participant
Marketing NSW
OP
This reply has been marked as private.
Nov 8, 2023 at 3:41 am
#191144
Participant
Marketing NSW
OP

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

Nov 3, 2023 at 8:52 am
#191012
Participant
Marketing NSW
OP
This reply has been marked as private.
Nov 2, 2023 at 3:08 am
#190983
Participant
Marketing NSW
OP

anny reply?

Oct 31, 2023 at 10:41 am
#190958
Participant
Marketing NSW
OP
$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

Oct 31, 2023 at 10:21 am
#190955
Participant
Marketing NSW
OP
$company = wpdm_acf([acf_EmailLock_Company], 'EmailLock/Company');
    $message .= "Company: " . $custom_data . "<br>";

Hi is the code correct? to call it out

Oct 26, 2023 at 5:46 am
#190893
Participant
Marketing NSW
OP

any updates?

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