/** * Display a link to edit your profile when you are logged in and viewing your author profile. * * @param int $author_id * @return string * @since 1.0.0 */ function reach_author_edit_profile_link($author_id) { if (!reach_has_charitable()) { return ''; } if (get_current_user_id() != $author_id) { return ''; } $profile_page = charitable_get_permalink('profile_page'); if (!$profile_page) { return ''; } return sprintf('<a href="%s" title="%s" class="button">%s</a>', esc_url($profile_page), esc_attr__('Edit your profile', 'reach'), __('Edit Profile', 'reach')); }
<?php /** * Partial template displaying the author's activity summary in the banner. * * @package Reach */ if (!reach_has_charitable()) { return; } $user = charitable_get_user(reach_get_current_author()->ID); $campaigns = Charitable_Campaigns::query(array('author' => $user->ID)); ?> <div class="author-activity-summary"> <span class="number"><?php echo $user->count_campaigns_supported(); ?> </span> <?php _e('Campaigns Backed', 'reach'); ?> <span class='separator'>/</span> <span class="number"><?php echo $campaigns->post_count; ?> </span> <?php _e('Campaigns Created', 'reach'); ?> </div><!-- .author-activity-summary -->
/** * Returns the campaign section settings. * * @param int $priority * @return array[] * @access private * @since 1.0.0 */ private function get_campaign_section($priority) { if (!reach_has_charitable()) { return array(); } $campaign_setings = array('priority' => $priority, 'title' => __('Campaigns', 'reach'), 'active_callback' => 'charitable_is_campaign_page', 'settings' => array('campaign_feature_background' => array('setting' => array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'), 'control' => array('control_type' => 'Reach_Customizer_Retina_Image_Control', 'label' => __('Background image for campaign summary block', 'reach'), 'priority' => $priority + 1)), 'campaign_section_break_1' => array('setting' => array('sanitize_callback' => '__return_true'), 'control' => array('control_type' => 'Reach_Customizer_Misc_Control', 'type' => 'line', 'priority' => $priority + 2)), 'campaign_media_placement' => array('setting' => array('default' => 'featured_image_in_summary', 'transport' => 'refresh', 'sanitize_callback' => array($this, 'sanitize_campaign_media_placement')), 'control' => array('type' => 'hidden', 'priority' => $priority + 3)))); if (class_exists('Charitable_Videos')) { $campaign_setings['settings']['campaign_media_placement']['control'] = array('type' => 'radio', 'label' => __('Where would you like the campaign video and featured image to be displayed?', 'reach'), 'priority' => $priority + 3, 'choices' => array('featured_image_in_summary' => __('Featured image in summary, video before content.', 'reach'), 'video_in_summary' => __('Video in summary, featured image before content.', 'reach'))); } return apply_filters('reach_customizer_campaign_section', $campaign_setings); }