Plugin Directory

Changeset 2060649


Ignore:
Timestamp:
04/01/2019 12:58:27 AM (7 years ago)
Author:
forwardcreation
Message:

Made change to Amazon API calls to reflect the new Product API Guidelines. Amazon has removed current access to their Product Advertising API for WPBookList, as sufficient revenue wasn't being generated.

Location:
wpbooklist/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • wpbooklist/trunk/includes/class-wpbooklist-general-functions.php

    r2051000 r2060649  
    15771577
    15781578                    // Removing my Affiliate ID, as it's only needed for initial API calls when Adding/Editing/Searching for books.
    1579                     if ( 'wpbooklistid-20' === $options_row->amazonaff ) {
    1580                         $options_row->amazonaff = '';
     1579                    if ( '' === $options_row->amazonaff || null === $options_row->amazonaff ) {
     1580                        $options_row->amazonaff = 'wpbooklistid-20';
    15811581                    }
    15821582
     
    16071607                // Removing my Affiliate ID, as it's only needed for initial API calls when Adding/Editing/Searching for books.
    16081608                if ( false !== stripos( $book_row->amazon_detail_page, 'tag=wpbooklistid-20' ) ) {
    1609                     $book_row->amazon_detail_page = str_replace( 'tag=wpbooklistid-20', '', $book_row->amazon_detail_page );
     1609                    //$book_row->amazon_detail_page = str_replace( 'tag=wpbooklistid-20', '', $book_row->amazon_detail_page );
    16101610                }
    16111611
     
    17811781                // Replace with user's affiliate id, if available.
    17821782                $amazonaff = $options_results->amazonaff;
    1783                 $link      = str_replace( 'wpbooklistid-20', $amazonaff, $link );
     1783                if ( '' !== $amazonaff && null !== $amazonaff ) {
     1784                    $link = str_replace( 'wpbooklistid-20', $amazonaff, $link );
     1785                }
    17841786
    17851787                $amazoncountryinfo = $options_results->amazoncountryinfo;
  • wpbooklist/trunk/includes/classes/book/class-wpbooklist-book-form.php

    r2046363 r2060649  
    159159         * Outputs the form for adding or editing a book.
    160160         */
    161         public function output_book_form() {
     161        public function output_book_form( $bypass_auth = false ) {
    162162
    163163            global $wpdb;
     
    165165            // Set the current WordPress user.
    166166            $currentwpuser = wp_get_current_user();
     167
    167168
    168169            // Now we'll determine access, and stop all execution if user isn't allowed in.
     
    171172            $this->currentwpbluser = $this->access->wpbooklist_accesscheck( $currentwpuser->ID, 'addbook' );
    172173
    173             // If we received false from accesscheck class, display permissions message and stop all further execution.
    174             if ( false === $this->currentwpbluser ) {
    175 
    176                 // Outputs the 'No Permission!' message.
    177                 $this->initial_output = $this->access->wpbooklist_accesscheck_no_permission_message();
    178                 return $this->initial_output;
     174            // If we want to bypass the authorization check, for example, in the case of outputting the 'Add a Book' form to the frontend in the Submissions Extension.
     175            if ( ! $bypass_auth ) {
     176                // If we received false from accesscheck class, display permissions message and stop all further execution.
     177                if ( false === $this->currentwpbluser ) {
     178
     179                    // Outputs the 'No Permission!' message.
     180                    $this->initial_output = $this->access->wpbooklist_accesscheck_no_permission_message();
     181                    return $this->initial_output;
     182                }
    179183            }
    180184
     
    190194                $query                  = 'SELECT * FROM ' . $settings_table_name . " WHERE wpuserid = " . $currentwpuser->ID;
    191195                $this->wpbl_user = $transients->create_transient( $transient_name, 'wpdb->get_row', $query, MONTH_IN_SECONDS );
     196            }
     197
     198            // If the user isn't logged into WordPress (thus $this->wpbl_user is null) and is trying to use this form from the front-end, create the $this->wpbl_user object, and set the 'Libraries' value to 'alllibraries'. This is mainly required for the Submissions Extension.
     199            if ( null === $this->wpbl_user ) {
     200                $this->wpbl_user            = new \stdClass();
     201                $this->wpbl_user->libraries = 'alllibraries';
    192202            }
    193203
  • wpbooklist/trunk/includes/classes/class-wpbooklist-show-book-in-colorbox.php

    r2012881 r2060649  
    550550
    551551            // Removing my Affiliate ID with the user's, if set.
    552             $this->amazon_detail_page = str_replace( 'wpbooklistid-20', $this->amazonaff, $this->amazon_detail_page );
    553 
     552            if ( '' !== $this->amazonaff && null !== $this->amazonaff ) {
     553                $this->amazon_detail_page = str_replace( 'wpbooklistid-20', $this->amazonaff, $this->amazon_detail_page );
     554            }
     555
     556            /*
    554557            // Removing my Affiliate ID, as it's only needed for initial API calls when Adding/Editing/Searching for books.
    555558            if ( 'wpbooklistid-20' === $this->amazonaff ) {
     
    561564                $this->amazon_detail_page = str_replace( 'tag=wpbooklistid-20', '', $this->amazon_detail_page );
    562565            }
     566            */
    563567        }
    564568
  • wpbooklist/trunk/includes/ui/class-wpbooklist-frontend-library-list-ui.php

    r2046363 r2060649  
    14381438                // Replace default tag if the user has provided their own - 5.5.3.
    14391439                if ( strpos( $book->amazon_detail_page, 'wpbooklistid-20' ) ) {
    1440                     if ( '' !== $this->display_options_actual->amazonaff && null !== $this->display_options_actual->amazonaff ) {
     1440                    if ( '' !== $this->display_options_actual->amazonaff && null !== $this->display_options_actual->amazonaff && 'wpbooklistid-20' !== $this->display_options_actual->amazonaff ) {
    14411441                        $book->amazon_detail_page = str_replace( 'wpbooklistid-20', $this->display_options_actual->amazonaff, $book->amazon_detail_page );
    14421442                    }
  • wpbooklist/trunk/includes/ui/class-wpbooklist-frontend-library-ui.php

    r2046363 r2060649  
    14341434                // Replace default tag if the user has provided their own - 5.5.3.
    14351435                if ( strpos( $book->amazon_detail_page, 'wpbooklistid-20' ) ) {
    1436                     if ( '' !== $this->display_options_actual->amazonaff && null !== $this->display_options_actual->amazonaff ) {
     1436                    if ( '' !== $this->display_options_actual->amazonaff && null !== $this->display_options_actual->amazonaff && 'wpbooklistid-20' !== $this->display_options_actual->amazonaff ) {
    14371437                        $book->amazon_detail_page = str_replace( 'wpbooklistid-20', $this->display_options_actual->amazonaff, $book->amazon_detail_page );
    14381438                    }
  • wpbooklist/trunk/readme.txt

    r2051000 r2060649  
    55Requires at least: 3.0.1
    66Tested up to: 5.0
    7 Stable tag: 6.1.7
     7Stable tag: 6.1.8
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    290290**6.1.7** - Prevented the Pagination tools from appearing on the front-end if multiple pages of books do not exist (Github Issue #75). Introduced check in class-wpbooklist-frontend-library-ui.php file, lines 1387-1392, that prevents attempting to grab a quote using an undefined array index key. Also modified the quotation display to not have the closing quotation mark bolded. (Github Issue #98). Added in translations for the new Submissions Extension (Github Issue #100). Modify the IDs of the field values in the 'Book Form' HTML (Github Issue #101). Modified the 'Class-book.php' file to suite the Submissions Extension (Github Issue #102). Modified the "wpbooklist_dashboard_add_book_action_callback" function to return found book info for the Submissions Extension (Github Issue #103). Added in Advertisment for the new E-Books Extension on the Extensions Menu Page (Github Issue #104). Added in some translations for the WPBookList Search Extension (Github Issue #105).
    291291
     292**6.1.8** - Made change to Amazon API calls to reflect the new Product API Guidelines. Amazon has removed current access to their Product Advertising API for WPBookList, as sufficient revenue wasn't being generated.
     293
    292294
    293295== Upgrade Notice ==
     
    405407=6.1.7= - Prevented the Pagination tools from appearing on the front-end if multiple pages of books do not exist (Github Issue #75). Introduced check in class-wpbooklist-frontend-library-ui.php file, lines 1387-1392, that prevents attempting to grab a quote using an undefined array index key. Also modified the quotation display to not have the closing quotation mark bolded. (Github Issue #98). Added in translations for the new Submissions Extension (Github Issue #100). Modify the IDs of the field values in the 'Book Form' HTML (Github Issue #101). Modified the 'Class-book.php' file to suite the Submissions Extension (Github Issue #102). Modified the "wpbooklist_dashboard_add_book_action_callback" function to return found book info for the Submissions Extension (Github Issue #103). Added in Advertisment for the new E-Books Extension on the Extensions Menu Page (Github Issue #104). Added in some translations for the WPBookList Search Extension (Github Issue #105).
    406408
     409=6.1.8=
     410Made change to Amazon API calls to reflect the new Product API Guidelines. Amazon has removed current access to their Product Advertising API for WPBookList, as sufficient revenue wasn't being generated.
     411
  • wpbooklist/trunk/wpbooklist.php

    r2046363 r2060649  
    1212 * Plugin URI: https://www.jakerevans.com
    1313 * Description: For authors, publishers, librarians, and book-lovers alike - use it to sell your books, record and catalog your library, and more!
    14  * Version: 6.1.7
     14 * Version: 6.1.8
    1515 * Author: Jake Evans
    1616 * Text Domain: wpbooklist
     
    3636// Root plugin folder directory.
    3737if ( ! defined( 'WPBOOKLIST_VERSION_NUM' ) ) {
    38     define( 'WPBOOKLIST_VERSION_NUM', '6.1.7' );
     38    define( 'WPBOOKLIST_VERSION_NUM', '6.1.8' );
    3939}
    4040
     
    378378    add_action( 'wp_ajax_wpbooklist_dashboard_add_book_action', array( $wp_book_list_ajax_functions, 'wpbooklist_dashboard_add_book_action_callback' ) );
    379379
     380    // For adding a book from the frontend, or anywhere else a user could access the 'Add a Book' form while not being logged in.
     381    add_action( 'wp_ajax_nopriv_wpbooklist_dashboard_add_book_action', array( $wp_book_list_ajax_functions, 'wpbooklist_dashboard_add_book_action_callback' ) );
     382
    380383    // For creating a WordPress User.
    381384    add_action( 'wp_ajax_wpbooklist_dashboard_create_wp_user_action', array( $wp_book_list_ajax_functions, 'wpbooklist_dashboard_create_wp_user_action_callback' ) );
Note: See TracChangeset for help on using the changeset viewer.