Changeset 3078733
- Timestamp:
- 04/29/2024 01:16:52 PM (2 years ago)
- Location:
- skyword-plugin/trunk
- Files:
-
- 1 deleted
- 4 edited
-
php/class-skyword-publish.php (modified) (3 diffs)
-
php/options.php (modified) (3 diffs)
-
readme.txt (modified) (4 diffs)
-
skyword-plugin (deleted)
-
skyword.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
skyword-plugin/trunk/php/class-skyword-publish.php
r2544176 r3078733 790 790 } 791 791 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 792 799 /** 793 800 * Checks whether username exists. … … 809 816 $guest_author['first_name'] = $data['first-name']; 810 817 $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 } 812 823 $guest_author['user_email'] = $data['email']; 813 824 $guest_author['description'] = $data['bio']; … … 825 836 $retval = $coauthors_plus->guest_authors->create( $guest_author ); 826 837 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 } 828 843 if ( null !== $author ) { 829 844 $user_id = 'guest-' . $author->ID; -
skyword-plugin/trunk/php/options.php
r1868234 r3078733 66 66 add_settings_section( 'skyword_generate_new_users_section', 'Create WordPress User accounts for new authors', 'skyword_plugin_section_text', __FILE__ ); 67 67 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' ); 68 69 69 70 } … … 140 141 } 141 142 143 function 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 142 153 function skyword_plugin_options_validate( $input ) { 143 154 $options = get_option( 'skyword_plugin_options' ); … … 154 165 $options['skyword_generate_tags_sitemaps'] = empty( $input['skyword_generate_tags_sitemaps'] ) ? false : true; 155 166 $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; 156 168 157 169 return $options; -
skyword-plugin/trunk/readme.txt
r3073330 r3078733 3 3 Tags: skyword, api 4 4 Requires at least: 3.3 5 Tested up to: 6. 2.26 Stable tag: 2. 4.95 Tested up to: 6.5.2 6 Stable tag: 2.5.2 7 7 8 8 Allows integration with the skyword publishing platform. … … 15 15 == Installation == 16 16 17 18 17 == Frequently Asked Questions == 19 18 … … 21 20 22 21 == Changelog == 22 23 = 2.5.2 = 24 * Friendly slug for Coauthors Plus plugin 23 25 24 26 = 2.5.1 = … … 27 29 = 2.5 = 28 30 * 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.32 31 33 32 = 2.4.7 = -
skyword-plugin/trunk/skyword.php
r2521326 r3078733 4 4 Plugin URI: http://www.skyword.com 5 5 Description: Integration with the Skyword content publication platform. 6 Version: 2. 4.96 Version: 2.5.2 7 7 Author: Skyword, Inc. 8 8 Author URI: http://www.skyword.com … … 15 15 define( 'SKYWORD_PATH', plugin_dir_path( __FILE__ ) ); 16 16 if ( !defined('SKYWORD_VERSION') ) 17 define( 'SKYWORD_VERSION', "2. 4.9" );17 define( 'SKYWORD_VERSION', "2.5.2" ); 18 18 if ( !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. 20 20 //.1.4 is NOT valid. 21 21 22 libxml_disable_entity_loader(true); 23 22 // Only call deprecated function on older PHP versions 23 if (\PHP_VERSION_ID < 80000) { 24 libxml_disable_entity_loader(true); 25 } 24 26 register_activation_hook(__FILE__, 'get_skyword_defaults'); 25 27 … … 40 42 "skyword_generate_categories_sitemaps" => true, 41 43 "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 43 46 ); 44 47 update_option('skyword_plugin_options', $arr);
Note: See TracChangeset
for help on using the changeset viewer.