/**
  * 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.0.0
  */
 public static function display($atts = array())
 {
     $defaults = array('logged_in_message' => __('You are already logged in!', 'charitable'), 'redirect' => esc_url(charitable_get_login_redirect_url()), 'registration_link_text' => __('Register', 'charitable'));
     $args = shortcode_atts($defaults, $atts, 'charitable_login');
     $args['login_form_args'] = self::get_login_form_args($args);
     if (is_user_logged_in()) {
         ob_start();
         charitable_template('shortcodes/logged-in.php', $args);
         return ob_get_clean();
     }
     if (false == $args['registration_link_text'] || 'false' == $args['registration_link_text']) {
         $args['registration_link'] = false;
     } else {
         $registration_link = charitable_get_permalink('registration_page');
         if (charitable_get_permalink('login_page') === $registration_link) {
             $args['registration_link'] = false;
         } else {
             if (isset($_GET['redirect_to'])) {
                 $registration_link = add_query_arg('redirect_to', $_GET['redirect_to'], $registration_link);
             }
             $args['registration_link'] = $registration_link;
         }
     }
     ob_start();
     charitable_template('shortcodes/login.php', $args);
     return apply_filters('charitable_login_shortcode', ob_get_clean());
 }
 * @version 1.0.0
 */
/**
 * @var 	Charitable_Campaign
 */
$campaign = charitable_get_current_campaign();
/**
 * This will be the value from the post_status column,
 * or, if the campaign is published, 'active' or 'finished'.
 *
 * @var 	string
 */
$status = $campaign->get_status();
?>
<div class="charitable-ambassadors-campaign-creator-toolbar">
	<div class="layout-wrapper">
		<span class="campaign-status"><?php 
printf(_x('Status: %s', 'status for campaign', 'reach'), '<span class="status status-' . esc_attr($status) . '">' . ucwords($status) . '</span>');
?>
		</span>
		<a href="<?php 
echo esc_url(charitable_get_permalink('campaign_editing_page'));
?>
" class="edit-link">
			<?php 
_e('Edit campaign', 'reach');
?>
		</a>
	</div><!-- .layout-wrapper -->
</div><!-- .charitable-ambassadors-campaign-creator-toolbar -->
 /**
  * Redirect the user to the Charitable login page.
  *
  * @return  void
  * @access  public
  * @since   1.4.0
  */
 public function maybe_redirect_to_charitable_login()
 {
     if (!apply_filters('charitable_disable_wp_login', false)) {
         return;
     }
     if ('wp' == charitable_get_option('login_page', 'wp')) {
         return;
     }
     /* Don't prevent logging out. */
     if ($_SERVER['REQUEST_METHOD'] != 'GET') {
         return;
     }
     wp_safe_redirect(esc_url_raw(charitable_get_permalink('login_page')));
     exit;
 }
Beispiel #4
0
 /**
  * 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'));
 }
 public function get_error_url()
 {
     $cancel_url = charitable_get_permalink('donation_cancel_page', array('donation_id' => $this->donation_id));
     if (!$cancel_url) {
         $cancel_url = esc_url_raw(add_query_arg(array('donation_id' => $this->donation_id, 'cancel' => true), wp_get_referer()));
     }
     return $cancel_url;
 }
Beispiel #6
0
<?php

/**
 * Account links
 *
 * @package Reach
 */
if (!reach_has_charitable()) {
    return;
}
$profile_page = esc_url(charitable_get_permalink('profile_page'));
$submit_page = esc_url(charitable_get_permalink('campaign_submission_page'));
$login_page = esc_url(charitable_get_permalink('login_page'));
?>
<div class="account-links">
	<?php 
if ($submit_page) {
    ?>

		<a class="user-campaign button with-icon button-alt button-small" href="<?php 
    echo $submit_page;
    ?>
" data-icon="&#xf055;"><?php 
    _e('Create a campaign', 'reach');
    ?>
</a>

	<?php 
}
?>
        ?>
			<tr>
				<td><?php 
        echo mysql2date('F j, Y', get_post_field('post_date', $donation->ID));
        ?>
</td>
				<td><?php 
        echo $donation->campaigns;
        ?>
</td>
				<td><?php 
        echo charitable_format_money($donation->amount);
        ?>
</td>
				<td><a href="<?php 
        echo esc_attr(charitable_get_permalink('donation_receipt_page', array('donation_id' => $donation->ID)));
        ?>
"><?php 
        _e('View Receipt', 'charitable');
        ?>
</a></td>
			</tr>
			<?php 
    }
    ?>
		</tbody>
	</table>

<?php 
}
/**
 /**
  * Process the donation with PayPal.
  *   
  * @param   int $donation_id
  * @param   Charitable_Donation_Processor $processor
  * @return  void
  * @access  public
  * @static
  * @since   1.0.0
  */
 public static function process_donation($donation_id, $processor)
 {
     $gateway = new Charitable_Gateway_Paypal();
     $user_data = $processor->get_donation_data_value('user');
     $donation = new Charitable_Donation($donation_id);
     $transaction_mode = $gateway->get_value('transaction_mode');
     $paypal_args = apply_filters('charitable_paypal_redirect_args', array('business' => $gateway->get_value('paypal_email'), 'email' => $user_data['email'], 'first_name' => $user_data['first_name'], 'last_name' => $user_data['last_name'], 'address1' => $user_data['address'], 'address2' => $user_data['address_2'], 'city' => $user_data['city'], 'country' => $user_data['country'], 'zip' => $user_data['postcode'], 'invoice' => $processor->get_donation_data_value('donation_key'), 'amount' => $donation->get_total_donation_amount(), 'item_name' => html_entity_decode($donation->get_campaigns_donated_to(), ENT_COMPAT, 'UTF-8'), 'no_shipping' => '1', 'shipping' => '0', 'no_note' => '1', 'currency_code' => charitable_get_currency(), 'charset' => get_bloginfo('charset'), 'custom' => $donation_id, 'rm' => '2', 'return' => charitable_get_permalink('donation_receipt_page', array('donation_id' => $donation_id)), 'cancel_return' => home_url(), 'notify_url' => $processor->get_ipn_url(self::ID), 'cbt' => get_bloginfo('name'), 'bn' => 'Charitable_SP', 'cmd' => $transaction_mode == 'donations' ? '_donations' : '_xclick'), $donation_id, $processor);
     /**
      * Set up the PayPal redirect URL
      */
     $paypal_redirect = trailingslashit($gateway->get_redirect_url()) . '?';
     $paypal_redirect .= http_build_query($paypal_args);
     $paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
     /**
      * Redirect to PayPal
      */
     wp_redirect($paypal_redirect);
     exit;
 }
 /**
  * Payment redirect URL filter.
  *
  * @param string                  $url
  * @param Pronamic_WP_Pay_Payment $payment
  * @return string
  */
 public static function redirect_url($url, $payment)
 {
     $donation_id = $payment->get_source_id();
     $donation = new Charitable_Donation($donation_id);
     $url = self::get_return_url($donation);
     switch ($payment->get_status()) {
         case Pronamic_WP_Pay_Statuses::SUCCESS:
             $url = charitable_get_permalink('donation_receipt_page', array('donation_id' => $donation_id));
             break;
     }
     return $url;
 }
 /**
  * Reset the password.
  *
  * @return  bool|WP_Error True: when finish. WP_Error on error
  * @access  public
  * @static
  * @since   1.4.0
  */
 public static function reset_password()
 {
     $form = new Charitable_Reset_Password_Form();
     if (!$form->validate_nonce() || !$form->validate_honeypot()) {
         charitable_get_notices()->add_error(__('There was an error with processing your form submission. Please reload the page and try again.', 'charitable'));
         return;
     }
     /* The key and login must be set. */
     if (!isset($_POST['key']) || !isset($_POST['login'])) {
         charitable_get_notices()->add_error('<strong>ERROR:</strong> Invalid reset key.', 'charitable');
         return;
     }
     $user = check_password_reset_key($_POST['key'], $_POST['login']);
     if (is_wp_error($user)) {
         charitable_get_notices()->add_errors_from_wp_error($user);
         return;
     }
     /* One of the passwords was not set. */
     if (!isset($_POST['pass1']) || !isset($_POST['pass2'])) {
         charitable_get_notices()->add_error('<strong>ERROR:</strong> You must enter both passwords.', 'charitable');
         return;
     }
     /* The passwords do not match. */
     if ($_POST['pass1'] != $_POST['pass2']) {
         charitable_get_notices()->add_error(__('<strong>ERROR:</strong> The two passwords you entered don\'t match.', 'charitable'));
         return;
     }
     /* Parameter checks OK, reset password */
     reset_password($user, $_POST['pass1']);
     charitable_get_notices()->add_success(__('Your password was successfully changed.', 'charitable'));
     charitable_get_session()->add_notices();
     wp_safe_redirect(charitable_get_permalink('login_page'));
     exit;
 }
Beispiel #11
0
?>
	<p>
		<?php 
if (array_key_exists('registration_link', $view_args) && $view_args['registration_link']) {
    ?>
			<a href="<?php 
    echo esc_url($view_args['registration_link']);
    ?>
"><?php 
    echo $view_args['registration_link_text'];
    ?>
</a>&nbsp;|&nbsp;
		<?php 
}
?>
		<a href="<?php 
echo esc_url(charitable_get_permalink('forgot_password_page'));
?>
"><?php 
_e('Forgot Password', 'charitable');
?>
</a>
	</p>
	<?php 
/**
 * @hook    charitable_login_form_after
 */
do_action('charitable_login_form_after');
?>
</div>
/** 
 * By default, users are redirected to the login page if they try to access
 * the campaign form without being logged in.
 *
 * This example shows how to change the redirection to the registration page.
 *
 * NOTE: The redirection back to the campaign form will not work correctly on
 * versions of Charitable prior to 1.4.2.
 *
 * @param   string $redirect_url
 * @return  string
 */
function ed_redirect_logged_out_campaign_form_to_registration($redirect_url)
{
    $url = charitable_get_permalink('registration_page');
    $url = add_query_arg(array('redirect_to' => charitable_get_permalink('campaign_submission_page')), $url);
    return $url;
}
 /**
  * Return the URL that the donor should be redirected to.
  *
  * @param   mixed $gateway_processing
  * @param   int $donation_id
  * @return  string
  * @access  private
  * @since   1.3.0
  */
 private function get_redirection_after_gateway_processing($gateway_processing)
 {
     if (false == $gateway_processing) {
         $redirect_url = esc_url(add_query_arg(array('donation_id' => $this->donation_id), wp_get_referer()));
     } elseif (is_array($gateway_processing) && isset($gateway_processing['redirect'])) {
         $redirect_url = $gateway_processing['redirect'];
     } else {
         /* Fall back to returning the donation receipt URL. */
         $redirect_url = charitable_get_permalink('donation_receipt_page', array('donation_id' => $this->donation_id));
     }
     return $redirect_url;
 }
/**
 * Returns the URL to which the user should be redirected after signing on or registering an account. 
 *
 * @return  string
 * @since   1.0.0
 */
function charitable_get_login_redirect_url()
{
    if (isset($_REQUEST['redirect_to'])) {
        $redirect = $_REQUEST['redirect_to'];
    } elseif (charitable_get_permalink('profile_page')) {
        $redirect = charitable_get_permalink('profile_page');
    } else {
        $redirect = home_url();
    }
    return apply_filters('charitable_signon_redirect_url', $redirect);
}
 /**
  * Return the link to the login page, or false if we are not going to display it.
  *
  * @return  false|string
  * @access  public
  * @since   1.4.2
  */
 public function get_login_link()
 {
     if (false == $this->shortcode_args['login_link_text'] || 'false' == $this->shortcode_args['login_link_text']) {
         return false;
     }
     $login_link = charitable_get_permalink('login_page');
     if (charitable_get_permalink('registration_page') === $login_link) {
         return false;
     }
     if (isset($_GET['redirect_to'])) {
         $login_link = add_query_arg('redirect_to', $_GET['redirect_to'], $login_link);
     }
     return sprintf('<a href="%1$s" title="%2$s">%3$s</a>', esc_url($login_link), esc_attr($this->shortcode_args['login_link_text']), $this->shortcode_args['login_link_text']);
 }
Beispiel #16
0
 *
 * Override this template by copying it to your-child-theme/charitable/campaign/summary.php
 *
 * @author  Studio 164a
 * @package Reach
 * @since   1.0.0
 * @version 1.0.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$campaign = $view_args['campaign'];
$permalink = urlencode(get_the_permalink($campaign->ID));
$title = urlencode(get_the_title($campaign->ID));
$widget_url = esc_url(charitable_get_permalink('campaign_widget_page'));
?>
<ul class="campaign-sharing share horizontal rrssb-buttons">
	<li><h6><?php 
_e('Share', 'reach');
?>
</h6></li>
	<li class="share-twitter">
		<a href="http://twitter.com/home?status=<?php 
echo $title;
?>
%20<?php 
echo $permalink;
?>
" class="popup icon" data-icon="&#xf099;"></a>
	</li>
 /**
  * Load the donation template if we're looking at the donate page.
  *
  * @param   string $template
  * @return  string
  * @access  protected
  * @since   1.0.0
  */
 protected function get_donate_template($template)
 {
     /* If a donation ID is included, make sure it belongs to the current user. */
     $donation_id = get_query_var('donation_id', false);
     if ($donation_id) {
         $donation = charitable_get_donation($donation_id);
         if (!$donation || !$donation->is_from_current_user()) {
             wp_safe_redirect(charitable_get_permalink('campaign_donation_page'));
             exit;
         }
     }
     /* If the campaign has exired, redirect the user to the campaign page. */
     $campaign = charitable_get_current_campaign();
     if (!$campaign || $campaign->has_ended()) {
         wp_safe_redirect(get_permalink($campaign->ID));
         exit;
     }
     do_action('charitable_is_donate_page');
     $new_template = apply_filters('charitable_donate_page_template', array('campaign-donation-page.php', 'page.php', 'index.php'));
     return charitable_get_template_path($new_template, $template);
 }
<?php

/**
 * Displays the donate button to be displayed on campaign pages. 
 *
 * @author  Studio 164a
 * @since   1.0.0
 * @version 1.3.2
 */
$campaign = $view_args['campaign'];
?>
<div class="campaign-donation">
    <a data-trigger-modal="charitable-donation-form-modal"
        class="donate-button button" 
        href="<?php 
echo charitable_get_permalink('campaign_donation_page', array('campaign_id' => $campaign->ID));
?>
" 
        title="<?php 
printf(esc_attr_x('Make a donation to %s', 'make a donation to campaign', 'charitable'), get_the_title($campaign->ID));
?>
">
    <?php 
_e('Donate', 'charitable');
?>
    </a>
</div>
 /**
  * Redirect the donation to the processing page.
  *
  * @param   mixed $result
  * @param   int $donation_id
  * @return  array
  * @access  public
  * @static
  * @since   1.0.0
  */
 public static function redirect_to_processing($result, $donation_id)
 {
     return array('redirect' => charitable_get_permalink('donation_processing_page', array('donation_id' => $donation_id)), 'safe' => true);
 }
 /**
  * Return the reset link.
  *
  * @return  string|WP_Error|false If the reset key could not be generated, an error is returned.
  * @access  public
  * @since   1.4.0
  */
 public function get_reset_link()
 {
     if (!isset($this->reset_link)) {
         if (!is_a($this->user, 'WP_User')) {
             charitable_get_deprecated()->doing_it_wrong(__METHOD__, __('Password reset link cannot be generated without a WP_User object.', 'charitable'), '1.4.0');
             return '';
         }
         $base_url = charitable_get_permalink('reset_password_page');
         $key = get_password_reset_key($this->user);
         if (is_wp_error($key)) {
             return $key;
         }
         $this->reset_link = esc_url_raw(add_query_arg(array('key' => $key, 'login' => rawurlencode($this->user->user_login)), $base_url));
     }
     return $this->reset_link;
 }
 /**
  * Redirect to payment form after submission. 
  *
  * @param   int     $campaign_id
  * @param   int     $amount
  * @return  void
  * @access  public
  * @since   1.0.0
  */
 public function redirect_after_submission($campaign_id, $amount)
 {
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     $redirect_url = charitable_get_permalink('campaign_donation_page', array('campaign_id' => $campaign_id));
     $redirect_url = apply_filters('charitable_donation_amount_form_redirect', $redirect_url, $campaign_id, $amount);
     wp_redirect(esc_url_raw($redirect_url));
     die;
 }
 /**
  * Save a donation.
  *
  * @return  void
  * @access  public
  * @static
  * @since   1.0.0
  */
 public static function make_donation_streamlined()
 {
     $processor = self::get_instance();
     $campaign = $processor->get_campaign();
     if (!$campaign) {
         return;
     }
     /**
      * @hook charitable_before_process_donation_amount_form
      */
     do_action('charitable_before_process_donation_amount_form', $processor);
     /* Validate the form submission and retrieve the values. */
     $form = new Charitable_Donation_Amount_Form($campaign);
     if (!$form->validate_submission()) {
         return;
     }
     $submitted = $form->get_donation_values();
     charitable_get_session()->add_donation($submitted['campaign_id'], $submitted['amount']);
     /**
      * @hook charitable_after_process_donation_amount_form
      */
     do_action('charitable_after_process_donation_amount_form', $processor, $submitted);
     /**
      * If we get this far, forward the user through to the donation page.
      */
     wp_safe_redirect(charitable_get_permalink('campaign_donation_page', array('campaign_id' => $submitted['campaign_id'])));
     die;
 }
 /**
  * Send the password reset email.
  *
  * @return  bool|WP_Error True: when finish. WP_Error on error
  * @access  public
  * @static
  * @since   1.4.0
  */
 public static function retrieve_password()
 {
     $form = new Charitable_Forgot_Password_Form();
     if (!$form->validate_nonce()) {
         return;
     }
     if (empty($_POST['user_login'])) {
         charitable_get_notices()->add_error(__('<strong>ERROR</strong>: Enter a username or email address.', 'charitable'));
         return;
     } elseif (strpos($_POST['user_login'], '@')) {
         $user = get_user_by('email', trim($_POST['user_login']));
     } else {
         $login = trim($_POST['user_login']);
         $user = get_user_by('login', $login);
     }
     do_action('lostpassword_post');
     /* If we are missing user data, proceed no further. */
     if (!$user) {
         charitable_get_notices()->add_error(__('<strong>ERROR</strong>: Invalid username or email.', 'charitable'));
         return;
     }
     /* Prepare the email. */
     $email = new Charitable_Email_Password_Reset(array('user' => $user));
     $reset_link = $email->get_reset_link();
     /* Make sure that the reset link was generated correctly. */
     if (is_wp_error($reset_link)) {
         charitable_get_notices()->add_errors_from_wp_error($reset_link);
         return;
     }
     $sent = $email->send();
     if (!$sent) {
         charitable_get_notices()->add_error(__('We were unable to send your password reset email.', 'charitable'));
         return;
     }
     charitable_get_notices()->add_success(__('Your password reset request has been received. Please check your email for a link to reset your password.', 'charitable'));
     charitable_get_session()->add_notices();
     $redirect_url = esc_url_raw(charitable_get_permalink('login_page'));
     wp_safe_redirect($redirect_url);
     exit;
 }
Beispiel #24
0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
?>
<div class="charitable-login-form">
	<?php 
/**
 * @hook    charitable_login_form_before
 */
do_action('charitable_login_form_before');
wp_login_form($view_args['login_form_args']);
?>
	<p>
		<a href="<?php 
echo charitable_get_permalink('forgot_password_page');
?>
"><?php 
_e('Forgot Password', 'charitable');
?>
</a>
	</p>
	<?php 
/**
 * @hook    charitable_login_form_after
 */
do_action('charitable_login_form_after');
?>
</div>