Plugin Directory

Changeset 3078733


Ignore:
Timestamp:
04/29/2024 01:16:52 PM (2 years ago)
Author:
skyword
Message:

Update to version 2.5.2: Friendly coauthor slug beta feature

Location:
skyword-plugin/trunk
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • skyword-plugin/trunk/php/class-skyword-publish.php

    r2544176 r3078733  
    790790    }
    791791
     792    /**
     793     * Generate a slug based on the author byline
     794     */
     795    private function generate_author_slug( $data ) {
     796        return sanitize_text_field(mb_strtolower(str_replace(' ', '-', $data['display-name'])));
     797    }
     798
    792799    /**
    793800     * Checks whether username exists.
     
    809816                    $guest_author['first_name']     = $data['first-name'];
    810817                    $guest_author['last_name']      = $data['last-name'];
    811                     $guest_author['user_login']     = $data['user-name'];
     818                    if ($options['skyword_coauthors_friendly_pages']) {
     819                        $guest_author['user_login']     = $this->generate_author_slug($data);
     820                    } else {
     821                        $guest_author['user_login']     = $data['user-name'];
     822                    }
    812823                    $guest_author['user_email']     = $data['email'];
    813824                    $guest_author['description']    = $data['bio'];
     
    825836                    $retval = $coauthors_plus->guest_authors->create( $guest_author );
    826837                    if ( is_wp_error( $retval ) ) {
    827                         $author = $coauthors_plus->guest_authors->get_guest_author_by( 'user_login', $data['user-name'] );
     838                        if ($options['skyword_coauthors_friendly_pages']) {
     839                            $author = $coauthors_plus->guest_authors->get_guest_author_by( 'user_login', $this->generate_author_slug($data));
     840                        } else {
     841                            $author = $coauthors_plus->guest_authors->get_guest_author_by( 'user_login', $data['user-name'] );
     842                        }
    828843                        if ( null !== $author ) {
    829844                            $user_id = 'guest-' . $author->ID;
  • skyword-plugin/trunk/php/options.php

    r1868234 r3078733  
    6666    add_settings_section( 'skyword_generate_new_users_section', 'Create WordPress User accounts for new authors', 'skyword_plugin_section_text', __FILE__ );
    6767    add_settings_field( 'skyword_generate_new_users_automatically', ' ', 'skyword_generate_new_users_automatically_input', __FILE__, 'skyword_generate_new_users_section' );
     68    add_settings_field( 'skyword_coauthors_friendly_pages', ' ', 'skyword_coauthors_friendly_pages_input', __FILE__, 'skyword_generate_new_users_section' );
    6869
    6970}
     
    140141}
    141142
     143function skyword_coauthors_friendly_pages_input() {
     144    global $coauthors_plus;
     145    $options = get_option( 'skyword_plugin_options' );
     146
     147    if(null !== $coauthors_plus)
     148        echo '<input type="checkbox" id="friendly_pages" name="skyword_plugin_options[skyword_coauthors_friendly_pages]" value="1" ' . checked( 1, $options['skyword_coauthors_friendly_pages'], false ) . '/> (BETA) Assign meaningful slugs to Coauthors Plus author pages.<p>New Coauthors Plus pages will receive a slug for their page based on their byline.</p>';
     149    else
     150        echo '<input type="checkbox" id="friendly_pages" name="skyword_plugin_options[skyword_coauthors_friendly_pages]" value="1" ' . checked( 1, $options['skyword_coauthors_friendly_pages'], false ) . ' disabled/><span style="color:lightgrey"> (BETA) Assign meaningful slugs to Coauthors Plus author pages. (Co-Authors Plus plugin disabled, so this option has been disabled)</span><p style="color:lightgrey">New Coauthors Plus pages will receive a slug for their page based on their byline.</p>';
     151}
     152
    142153function skyword_plugin_options_validate( $input ) {
    143154    $options                                         = get_option( 'skyword_plugin_options' );
     
    154165    $options['skyword_generate_tags_sitemaps']       = empty( $input['skyword_generate_tags_sitemaps'] ) ? false : true;
    155166    $options['skyword_generate_new_users_automatically'] = empty( $input['skyword_generate_new_users_automatically'] ) ? false : true;
     167    $options['skyword_coauthors_friendly_pages'] = empty( $input['skyword_coauthors_friendly_pages'] ) ? false : true;
    156168
    157169    return $options;
  • skyword-plugin/trunk/readme.txt

    r3073330 r3078733  
    33Tags: skyword, api
    44Requires at least: 3.3
    5 Tested up to: 6.2.2
    6 Stable tag: 2.4.9
     5Tested up to: 6.5.2
     6Stable tag: 2.5.2
    77
    88Allows integration with the skyword publishing platform.
     
    1515== Installation ==
    1616
    17 
    1817== Frequently Asked Questions ==
    1918
     
    2120
    2221== Changelog ==
     22
     23= 2.5.2 =
     24* Friendly slug for Coauthors Plus plugin
    2325
    2426= 2.5.1 =
     
    2729= 2.5 =
    2830* Updated plugin to work with unreleased version of Co-Authors Plus
    29 
    30 = 2.4.8 =
    31 * fix issue with 2.4.7 fix. cost_meta was being saved before the added code. Moved logic to deal with it correctly.
    3231
    3332= 2.4.7 =
  • skyword-plugin/trunk/skyword.php

    r2521326 r3078733  
    44Plugin URI: http://www.skyword.com
    55Description: Integration with the Skyword content publication platform.
    6 Version: 2.4.9
     6Version: 2.5.2
    77Author: Skyword, Inc.
    88Author URI: http://www.skyword.com
     
    1515    define( 'SKYWORD_PATH', plugin_dir_path( __FILE__ ) );
    1616if ( !defined('SKYWORD_VERSION') )
    17     define( 'SKYWORD_VERSION', "2.4.9" );
     17    define( 'SKYWORD_VERSION', "2.5.2" );
    1818if ( !defined('SKYWORD_VN') )
    19     define( 'SKYWORD_VN', "2.48" ); //This CANNOT have two decimal places.
     19    define( 'SKYWORD_VN', "2.52" ); //This CANNOT have two decimal places.
    2020//.1.4 is NOT valid.
    2121
    22 libxml_disable_entity_loader(true);
    23 
     22// Only call deprecated function on older PHP versions
     23if (\PHP_VERSION_ID < 80000) {
     24     libxml_disable_entity_loader(true);
     25}
    2426register_activation_hook(__FILE__, 'get_skyword_defaults');
    2527
     
    4042        "skyword_generate_categories_sitemaps" => true,
    4143        "skyword_generate_tags_sitemaps" => true,
    42         "skyword_generate_new_users_automatically" => true
     44        "skyword_generate_new_users_automatically" => true,
     45        "skyword_api_coauthors_friendly_pages" => true
    4346        );
    4447        update_option('skyword_plugin_options', $arr);
Note: See TracChangeset for help on using the changeset viewer.