PHP assistance

Status
Not open for further replies.

robototitico

New Member
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 -
Code:
http://www.facebook.com/sharer.php?u=http://www.example.com/category/page

How do I combine the two in the code below? The relevant place is marked in red, with my effort which doesnt work.

Thanks

// 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 .= "http://www.facebook.com/sharer.php?u=get_permalink($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);
 

Tom

Member
Not sure if it will work but try the follwing instead. Basically just move the function call outside of the quotes.
Code:
$message .= "[B][COLOR=red]http://www.facebook.com/sharer.php?u=".get_permalink($post->ID)[/COLOR][/B]."\r\n\r\n\r\n\r\n";
 
Status
Not open for further replies.
Top