PHP assistance

Not open for further replies.
I want to put a facebook share link to an email.

This calls the permalink for the ad - get_permalink($post->ID)
This is the facebook share link -
How do I combine the two in the code below? The relevant place is marked in red, with my effort which doesnt work.


// if the ad has been approved send email to ad owner only if owner is not equal to approver
// admin approving own ads or ad owner pausing and reactivating ad on his dashboard don't need to send email
if ($old_status == 'pending' && $new_status == 'publish' && $current_user->ID != $ad_author_id && $send_approved_email == 'yes') {

$subject = __('Your Ad Has Been Approved','cp');
$headers = 'From: '. sprintf(__('%s Admin', 'cp'), FarmAds) .' <'. get_option('admin_email') .'>' . "\r\n";

$message = sprintf(__('Hi %s,', 'cp'), $ad_author) . "\r\n\r\n";
$message .= sprintf(__('Your ad listing, "%s" has been approved and is now live on our site.', 'cp'), $ad_title) . "\r\n\r\n";

$message .= __('You can view your ad by clicking on the following link:', 'cp') . "\r\n";
$message .= get_permalink($post->ID) . "\r\n\r\n\r\n\r\n";

$message .= __('Share your ad with your friends on Facebook:', 'cp') . "\r\n";
$message .= "$post->ID)" . "\r\n\r\n\r\n\r\n";

$message .= __('Regards,', 'cp') . "\r\n\r\n";
$message .= sprintf(__('Your %s Team', 'cp'), FarmAds) . "\r\n";
$message .= $siteurl . "\r\n\r\n\r\n\r\n";

// ok let's send the email
wp_mail($mailto, $subject, $message, $headers);


New Member
Not sure if it will work but try the follwing instead. Basically just move the function call outside of the quotes.
$message .= "[B][COLOR=red]".get_permalink($post->ID)[/COLOR][/B]."\r\n\r\n\r\n\r\n";
Not open for further replies.
Award-winning Mac antivirus and Internet security software