Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.8.10 #1845

Merged
merged 14 commits into from
Jul 11, 2017
15 changes: 10 additions & 5 deletions assets/js/frontend/give-ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,25 @@ jQuery(document).ready(function ($) {
give_user_pass: this_form.find('[name=give_user_pass]').val()
};

$.post(give_global_vars.ajaxurl, data, function (data) {

$.post(give_global_vars.ajaxurl, data, function (response) {
//user is logged in
if ($.trim(data) == 'success') {
if ( $.trim( typeof ( response.success ) ) != undefined && response.success == true && typeof ( response.data ) != undefined ) {

//remove errors
this_form.find('.give_errors').remove();
//reload the selected gateway so it contains their logged in information

// Login successfully message.
this_form.find( '#give-payment-mode-select' ).after( response.data );
this_form.find( '.give_notices.give_errors' ).delay(5000).slideUp();

//reload the selected gateway so it contains their logged in information
give_load_gateway(this_form, this_form.find('.give-gateway-option-selected input').val());
} else {
//Login failed, show errors
this_form.find('[id^=give-login-fields] input[type=submit]').val(complete_purchase_val);
this_form.find('.give-loading-animation').fadeOut();
this_form.find('.give_errors').remove();
this_form.find('[id^=give-user-login-submit]').before(data);
this_form.find('[id^=give-user-login-submit]').before( response.data );
}
});

Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/give-ajax.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/frontend/give.all.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions give.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: WordImpress
* Author URI: https://wordimpress.com
* Version: 1.8.9
* Version: 1.8.10
* Text Domain: give
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/WordImpress/Give
Expand Down Expand Up @@ -311,7 +311,7 @@ private function setup_constants() {

// Plugin version
if ( ! defined( 'GIVE_VERSION' ) ) {
define( 'GIVE_VERSION', '1.8.9' );
define( 'GIVE_VERSION', '1.8.10' );
}

// Plugin Folder Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,10 @@ public function get_logs() {
$logs_data = array();
$paged = $this->get_paged();
$log_query = array(
'log_type' => 'api_request',
'paged' => $paged,
'meta_query' => $this->get_meta_query(),
'log_type' => 'api_request',
'paged' => $paged,
'meta_query' => $this->get_meta_query(),
'posts_per_page' => $this->per_page,
);

$logs = $give_logs->get_connected_logs( $log_query );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ public function get_logs() {
$logs_data = array();
$paged = $this->get_paged();
$log_query = array(
'log_type' => 'gateway_error',
'paged' => $paged
'log_type' => 'gateway_error',
'paged' => $paged,
'posts_per_page' => $this->per_page,
);

$logs = $give_logs->get_connected_logs( $log_query );
Expand Down Expand Up @@ -258,7 +259,7 @@ public function prepare_items() {
$this->set_pagination_args( array(
'total_items' => $total_items,
'per_page' => $this->per_page,
'total_pages' => ceil( $total_items / $this->per_page )
'total_pages' => ceil( $total_items / $this->per_page ),
)
);
}
Expand Down
26 changes: 14 additions & 12 deletions includes/admin/tools/logs/class-sales-logs-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
exit;
}

// Load WP_List_Table if not loaded
// Load WP_List_Table if not loaded.
if ( ! class_exists( 'WP_List_Table' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
}
Expand Down Expand Up @@ -205,8 +205,9 @@ protected function display_tablenav( $which ) {
*
* This is used to return log entries that match our search query, user query, or form query
*
* @access public
* @since 1.0
* @access public
*
* @return array $meta_query
*/
public function get_meta_query() {
Expand All @@ -215,7 +216,7 @@ public function get_meta_query() {
$meta_query = array();

if ( $user ) {
// Show only logs from a specific user
// Show only logs from a specific user.
$meta_query[] = array(
'key' => '_give_log_user_id',
'value' => $user,
Expand All @@ -225,7 +226,7 @@ public function get_meta_query() {
$search = $this->get_search();
if ( $search ) {
if ( is_email( $search ) ) {
// This is an email search. We use this to ensure it works for guest users and logged-in users
// This is an email search. We use this to ensure it works for guest users and logged-in users.
$key = '_give_log_user_info';
$compare = 'LIKE';
} else {
Expand All @@ -238,10 +239,10 @@ public function get_meta_query() {
$user = get_user_by( 'login', $search );

if ( $user ) {
// Found one, set meta value to user's ID
// Found one, set meta value to user's ID.
$search = $user->ID;
} else {
// No user found so let's do a real search query
// No user found so let's do a real search query.
$users = new WP_User_Query( array(
'search' => $search,
'search_columns' => array( 'user_url', 'user_nicename' ),
Expand All @@ -259,7 +260,7 @@ public function get_meta_query() {
}

if ( ! $this->file_search ) {
// Meta query only works for non file name searche
// Meta query only works for non file name search.
$meta_query[] = array(
'key' => $key,
'value' => $search,
Expand Down Expand Up @@ -332,10 +333,11 @@ public function get_logs() {
$user = $this->get_filtered_user();

$log_query = array(
'post_parent' => $give_form,
'log_type' => 'sale',
'paged' => $paged,
'meta_query' => $this->get_meta_query(),
'post_parent' => $give_form,
'log_type' => 'sale',
'paged' => $paged,
'meta_query' => $this->get_meta_query(),
'posts_per_page' => $this->per_page,
);

$cache_key = Give_Cache::get_key( 'get_logs', $log_query );
Expand All @@ -348,7 +350,7 @@ public function get_logs() {
foreach ( $logs as $log ) {
$payment_id = give_get_meta( $log->ID, '_give_log_payment_id', true );

// Make sure this payment hasn't been deleted
// Make sure this payment hasn't been deleted.
if ( get_post( $payment_id ) ) :
$user_info = give_get_payment_meta_user_info( $payment_id );
$payment_meta = give_get_payment_meta( $payment_id );
Expand Down
32 changes: 16 additions & 16 deletions includes/emails/class-give-email-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,82 +275,82 @@ function give_setup_email_tags() {
$email_tags = array(
array(
'tag' => 'donation',
'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
'description' => __( 'The donation form name, and the donation level (if applicable).', 'give' ),
'function' => 'give_email_tag_donation'
),
array(
'tag' => 'form_title',
'description' => esc_html__( 'The donation form name.', 'give' ),
'description' => __( 'The donation form name.', 'give' ),
'function' => 'give_email_tag_form_title'
),
array(
'tag' => 'amount',
'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
'description' => __( 'The total donation amount with currency sign.', 'give' ),
'function' => 'give_email_tag_amount'
),
array(
'tag' => 'price',
'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
'description' => __( 'The total donation amount with currency sign.', 'give' ),
'function' => 'give_email_tag_price'
),
array(
'tag' => 'name',
'description' => esc_html__( 'The donor\'s first name.', 'give' ),
'description' => __( 'The donor\'s first name.', 'give' ),
'function' => 'give_email_tag_first_name'
),
array(
'tag' => 'fullname',
'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
'description' => __( 'The donor\'s full name, first and last.', 'give' ),
'function' => 'give_email_tag_fullname'
),
array(
'tag' => 'username',
'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
'description' => __( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
'function' => 'give_email_tag_username'
),
array(
'tag' => 'user_email',
'description' => esc_html__( 'The donor\'s email address.', 'give' ),
'description' => __( 'The donor\'s email address.', 'give' ),
'function' => 'give_email_tag_user_email'
),
array(
'tag' => 'billing_address',
'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
'description' => __( 'The donor\'s billing address.', 'give' ),
'function' => 'give_email_tag_billing_address'
),
array(
'tag' => 'date',
'description' => esc_html__( 'The date of the donation.', 'give' ),
'description' => __( 'The date of the donation.', 'give' ),
'function' => 'give_email_tag_date'
),
array(
'tag' => 'payment_id',
'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
'description' => __( 'The unique ID number for this donation.', 'give' ),
'function' => 'give_email_tag_payment_id'
),
array(
'tag' => 'receipt_id',
'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
'description' => __( 'The unique ID number for this donation receipt.', 'give' ),
'function' => 'give_email_tag_receipt_id'
),
array(
'tag' => 'payment_method',
'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
'description' => __( 'The method of payment used for this donation.', 'give' ),
'function' => 'give_email_tag_payment_method'
),
array(
'tag' => 'sitename',
'description' => esc_html__( 'The name of your site.', 'give' ),
'description' => __( 'The name of your site.', 'give' ),
'function' => 'give_email_tag_sitename'
),
array(
'tag' => 'receipt_link',
'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
'description' => __( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
'function' => 'give_email_tag_receipt_link'
),
array(
'tag' => 'receipt_link_url',
'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
'description' => __( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
'function' => 'give_email_tag_receipt_link_url'
),
);
Expand Down
21 changes: 16 additions & 5 deletions includes/process-donation.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
* @return void
*/
function give_process_form_login() {

$is_ajax = isset( $_POST['give_ajax'] );

$user_data = give_donation_form_validate_user_login();
Expand All @@ -219,8 +218,11 @@ function give_process_form_login() {
*
* @since 1.0
*/
do_action( 'give_ajax_donation_errors' );
give_die();
ob_start();
do_action( 'give_ajax_donation_errors' );
$message = ob_get_contents();
ob_end_clean();
wp_send_json_error( $message );
} else {
wp_redirect( $_SERVER['HTTP_REFERER'] );
exit;
Expand All @@ -230,8 +232,17 @@ function give_process_form_login() {
give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );

if ( $is_ajax ) {
echo 'success';
give_die();
$message = Give()->notices->print_frontend_notice(
sprintf(
/* translators: %s: user first name */
esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
),
false,
'success'
);

wp_send_json_success( $message );
} else {
wp_redirect( $_SERVER['HTTP_REFERER'] );
}
Expand Down
Loading