/**
  * Create object using a donor ID.
  *
  * @param   int $donor_id
  * @return  Charitable_user
  * @access  public
  * @static
  * @since   1.0.0
  */
 public static function init_with_donor($donor_id)
 {
     $user_id = charitable_get_table('donors')->get_user_id($donor_id);
     $user = charitable_get_user($user_id);
     $user->set_donor_id($donor_id);
     return $user;
 }
 /**
  * The callback method for the campaigns shortcode.
  *
  * This receives the user-defined attributes and passes the logic off to the class.
  *
  * @param   array $atts User-defined shortcode attributes.
  * @return  string
  * @access  public
  * @static
  * @since   1.4.0
  */
 public static function display($atts)
 {
     $defaults = array();
     $args = shortcode_atts($defaults, $atts, 'charitable_my_donations');
     ob_start();
     /* If the user is logged out, redirect to login/registration page. */
     if (!is_user_logged_in()) {
         echo Charitable_Login_Shortcode::display(array('redirect' => charitable_get_current_url()));
         return;
     }
     $user = charitable_get_user(get_current_user_id());
     $view_args = array('donations' => new Charitable_Donations_Query(array('output' => 'posts', 'donor_id' => $user->get_donor_id(), 'orderby' => 'date', 'order' => 'DESC', 'number' => -1)));
     charitable_template('shortcodes/my-donations.php', $view_args);
     return apply_filters('charitable_my_donations_shortcode', ob_get_clean(), $args);
 }
<?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>&nbsp;<?php 
_e('Campaigns Backed', 'reach');
?>
&nbsp;<span class='separator'>/</span>&nbsp;<span class="number"><?php 
echo $campaigns->post_count;
?>
</span>&nbsp;<?php 
_e('Campaigns Created', 'reach');
?>
</div><!-- .author-activity-summary -->
Esempio n. 4
0
<?php

/**
 * The template used to display the profile form.
 *
 * @author 	Studio 164a
 * @package Charitable/Templates/Account
 * @since 	1.0.0
 * @version 1.3.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$form = $view_args['form'];
$donor = charitable_get_user(wp_get_current_user());
/**
 * @hook 	charitable_user_profile_before
 */
do_action('charitable_user_profile_before');
?>
<form method="post" id="charitable-profile-form" class="charitable-form" enctype="multipart/form-data">
	<?php 
/**
 * @hook 	charitable_form_before_fields
 */
do_action('charitable_form_before_fields', $form);
?>
	
	<div class="charitable-form-fields cf">
Esempio n. 5
0
/**
 * Get the Charitable_User object of the currently viewed author on an author archive.
 *
 * @return  Charitable_User
 * @since   1.0.0
 */
function reach_get_current_charitable_user()
{
    return charitable_get_user(reach_get_current_author()->ID);
}