Plugin Directory

Changeset 3079629


Ignore:
Timestamp:
04/30/2024 07:36:55 PM (2 years ago)
Author:
skyword
Message:

Beta feature for friendly coauthors slugs

Location:
skyword-publishing-api/tags
Files:
2 edited
16 copied

Legend:

Unmodified
Added
Removed
  • skyword-publishing-api/tags/1.0.9/php/routes/class-skyword-authors.php

    r3000257 r3079629  
    147147                $guest_author['first_name']     = $data['firstName'];
    148148                $guest_author['last_name']      = $data['lastName'];
    149                 $guest_author['user_login']     = $newUsername;
     149                    if ($options['skyword_coauthors_friendly_slugs']) {
     150                        $guest_author['user_login']     = $this->generate_author_slug($data);
     151                    } else {
     152                        $guest_author['user_login']     = $newUsername;
     153                    }
    150154                $guest_author['user_email']     = $newUsername . "@skyword.com";
    151155                $guest_author['description']    = array_key_exists('bio', $data) ? $data['bio'] : 'None';
     
    264268        return new WP_REST_Response($responseData, 200);
    265269    }
     270    /**
     271     * Generate a slug based on the author byline
     272     */
     273    private function generate_author_slug( $data ) {
     274        return sanitize_text_field(mb_strtolower(str_replace(' ', '-', $data['byline'])));
     275    }
     276
    266277}
     278
    267279
    268280global $skyword_authors;
  • skyword-publishing-api/tags/1.1.1/php/options.php

    r2937111 r3079629  
    6767    add_settings_section( 'skyword_generate_new_users_section', 'Create WordPress User accounts for new authors', 'skyword_api_plugin_section_text', __FILE__ );
    6868    add_settings_field( 'skyword_api_generate_new_users_automatically', ' ', 'skyword_api_generate_new_users_automatically_input', __FILE__, 'skyword_generate_new_users_section' );
     69    add_settings_field( 'skyword_coauthors_friendly_slugs', ' ', 'skyword_coauthors_friendly_slugs_input', __FILE__, 'skyword_generate_new_users_section' );
    6970}
    7071
     
    134135}
    135136
     137function skyword_coauthors_friendly_slugs_input() {
     138    global $coauthors_plus;
     139    $options = get_option( 'skyword_api_plugin_options' );
     140
     141    if(null !== $coauthors_plus)
     142        echo '<input type="checkbox" id="friendly_slugs" name="skyword_api_plugin_options[skyword_coauthors_friendly_slugs]" value="1" ' . checked( 1, $options['skyword_coauthors_friendly_slugs'], 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>';
     143    else
     144        echo '<input type="checkbox" id="friendly_slugs" name="skyword_api_plugin_options[skyword_coauthors_friendly_slugs]" value="1" ' . checked( 1, $options['skyword_coauthors_friendly_slugs'], 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>';
     145}
     146
    136147function skyword_api_plugin_options_validate( $input ) {
    137148    $options                                         = get_option( 'skyword_api_plugin_options' );
     
    148159    $options['skyword_api_generate_tags_sitemaps']       = empty( $input['skyword_api_generate_tags_sitemaps'] ) ? false : true;
    149160    $options['skyword_api_generate_new_users_automatically'] = empty( $input['skyword_api_generate_new_users_automatically'] ) ? false : true;
     161    $options['skyword_coauthors_friendly_slugs'] = empty( $input['skyword_coauthors_friendly_slugs'] ) ? false : true;
    150162
    151163    return $options;
  • skyword-publishing-api/tags/1.1.1/readme.txt

    r3078729 r3079629  
    2222== Changelog ==
    2323
     24= 1.1.1 =
     25* Friendly slug for Coauthors Plus plugin
     26
    2427= 1.1.0 =
    2528* Updates to fix warnings
  • skyword-publishing-api/tags/1.1.1/skyword.php

    r3078729 r3079629  
    33Plugin Name: Skyword Publishing API
    44Description: Integration with the Skyword360 content publication platform.
    5 Version: 1.1.0
     5Version: 1.1.1
    66Author: Skyword, Inc.
    77Author URI: http://www.skyword.com
     
    1717define( 'SKYWORD_REST_API_VERSION', "Skyword REST API plugin " . $plugin_version );
    1818if ( !defined('SKYWORD_VN') )
    19     define( 'SKYWORD_VN', "1.1" ); //This CANNOT have two decimal places.
     19    define( 'SKYWORD_VN', "1.11" ); //This CANNOT have two decimal places.
    2020//.1.4 is NOT valid.
    2121
Note: See TracChangeset for help on using the changeset viewer.