Function Reference: geodir_send_friend
Summary
Send Email to a friend.
Description
This function let the user to send Email to a friend.
Email content will be used WP Admin -> Geodirectory -> Notifications -> Other Emails -> Send to friend
Deprecated
1.6.26
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Package
GeoDirectory
Parameters
- $request
- (array) (required) {
The submitted form fields as an array.- Default: None
Change Log
Since: 1.0.0
Type
Array
Actions
‘geodir_before_send_to_friend_email’ [Line: 415]
‘geodir_after_send_to_friend_email’ [Line: 437]
Filters
‘geodir_send_to_friend_after_submit_redirect’ [Line: 452]
Source File
geodir_send_friend() is located in geodirectory-functions/custom_functions.php [Line: 375]
Source Code
function geodir_send_friend( $request ) { global $wpdb; // strip slashes from text $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; $yourname = sanitize_text_field($request['yourname']); $youremail = sanitize_email($request['youremail']); $frnd_subject = sanitize_text_field($request['frnd_subject']); $frnd_comments = sanitize_text_field($request['frnd_comments']); $pid = absint($request['pid']); $to_email = sanitize_email($request['to_email']); $to_name = sanitize_text_field($request['to_name']); if ( $pid && 'publish' == get_post_status ( $pid ) ) { check_ajax_referer( 'send_to_frnd_'.$pid ); }else{ gd_die(); } /** * Called before the send to friend email is sent. * * @since 1.0.0 * * @param array $request { * The submitted form fields as an array. * * @type string $sendact Enquiry type. Default "email_frnd". * @type string $pid Post ID. * @type string $to_name Friend name. * @type string $to_email Friend email. * @type string $yourname Sender name. * @type string $youremail Sender email. * @type string $frnd_subject Email subject. * @type string $frnd_comments Email Message. * * } */ do_action( 'geodir_before_send_to_friend_email', $request ); geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email /** * Called after the send to friend email is sent. * * @since 1.0.0 * * @param array $request { * The submitted form fields as an array. * * @type string $sendact Enquiry type. Default "email_frnd". * @type string $pid Post ID. * @type string $to_name Friend name. * @type string $to_email Friend email. * @type string $yourname Sender name. * @type string $youremail Sender email. * @type string $frnd_subject Email subject. * @type string $frnd_comments Email Message. * * } */ do_action( 'geodir_after_send_to_friend_email', $request ); $url = get_permalink( $pid ); if ( strstr( $url, '?' ) ) { $url = $url . "&sendtofrnd=success"; } else { $url = $url . "?sendtofrnd=success"; } /** * Filter redirect url after the send to friend email is sent. * * @since 1.0.0 * * @param string $url Redirect url. */ $url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url ); wp_redirect( $url ); gd_die(); }