Function Reference: geodir_payment_sidebar_show_send_to_friend
Summary
Display send to friend link on detail page sidebar when geodir_email field disabled for price package.
Description
This fixes the problem of “displaying send to friend link only when geodir_email enabled for price package”.
Global Values
- $post
- (object) (required) The current post object.
- Default: None
- $send_to_friend
- (bool) (required) True if send to friend link already rendered. Otherwise false.
- Default: None
Package
GeoDirectory_Payment_Manager
Change Log
Since: 1.3.6
Source Code
function geodir_payment_sidebar_show_send_to_friend() { global $post, $send_to_friend; if ($send_to_friend) { return; // Already shown or disabled. } if ( !(!empty($post) && geodir_is_page('detail') && !empty($post->post_type) && !empty($post->ID))) { return; } $package_info = geodir_post_package_info(array(), $post); if (!(!empty($package_info) && !empty($package_info->sendtofriend))) { return; } $field = geodir_get_field_infoby('htmlvar_name', 'geodir_email', $post->post_type); $field_icon = !empty($field) && isset($field->field_icon) ? $field->field_icon : ''; if (strpos($field_icon, 'http') !== false) { $field_icon_af = ''; } elseif ($field_icon == '') { $field_icon_af = ''; } else { $field_icon_af = $field_icon; $field_icon = ''; } $content = '' . $field_icon_af . '' . SEND_TO_FRIEND . ''; if (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { $content .= '' . SEND_FRIEND_SUCCESS . '
'; } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { $content .= '' . WRONG_CAPTCH_MSG . '
'; } /** * Filter send to friend link content on detail page sidebar info. * * @since 1.3.6 * * @param string $content Send to friend link html. * @param object $post The current post object. */ apply_filters('geodir_payment_sidebar_show_send_to_friend', $content, $post); echo $content; }