Plugin Directory

Changeset 3459675


Ignore:
Timestamp:
02/12/2026 08:51:12 AM (7 weeks ago)
Author:
soroseo
Message:

1.3.4: Add post author and category selection in plugin settings

Location:
soro-seo
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • soro-seo/tags/1.3.4/readme.txt

    r3459644 r3459675  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.3.3
     7Stable tag: 1.3.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    9191== Changelog ==
    9292
     93= 1.3.4 =
     94* Added post author selection in plugin settings
     95* Added post category selection in plugin settings
     96* Choose which WordPress user and category are used for Soro-published articles
     97
    9398= 1.3.3 =
    9499* Added focus keyword support for Rank Math, Yoast SEO, and All in One SEO
     
    126131== Upgrade Notice ==
    127132
     133= 1.3.4 =
     134Post author and category selection. Configure directly in WordPress plugin settings.
     135
    128136= 1.3.3 =
    129137Adds focus keyword support for Rank Math, Yoast SEO, and AIOSEO. Recommended for all users.
  • soro-seo/tags/1.3.4/soro-seo.php

    r3459644 r3459675  
    44 * Plugin URI: https://trysoro.com/wordpress
    55 * Description: Connect your WordPress site to Soro for automatic AI-powered article publishing.
    6  * Version: 1.3.3
     6 * Version: 1.3.4
    77 * Author: Soro
    88 * Author URI: https://trysoro.com
     
    1919}
    2020
    21 define('SORO_CONNECTOR_VERSION', '1.3.3');
     21define('SORO_CONNECTOR_VERSION', '1.3.4');
    2222define('SORO_CONNECTOR_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2323define('SORO_CONNECTOR_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    3232        add_action('admin_init', array($this, 'register_settings'));
    3333        add_action('admin_init', array($this, 'handle_regenerate_key'));
     34        add_action('admin_init', array($this, 'handle_save_author'));
     35        add_action('admin_init', array($this, 'handle_save_category'));
    3436        add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
    3537        add_action('rest_api_init', array($this, 'register_rest_routes'));
     
    325327       
    326328        add_settings_error('soro_messages', 'soro_success', __('API key regenerated successfully.', 'soro-seo'), 'success');
     329    }
     330   
     331    /**
     332     * Handle post author save
     333     */
     334    public function handle_save_author() {
     335        if (!isset($_POST['soro_save_author'])) {
     336            return;
     337        }
     338       
     339        if (!isset($_POST['soro_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['soro_nonce'])), $this->nonce_action)) {
     340            add_settings_error('soro_messages', 'soro_error', __('Security check failed.', 'soro-seo'), 'error');
     341            return;
     342        }
     343       
     344        if (!current_user_can('manage_options')) {
     345            add_settings_error('soro_messages', 'soro_error', __('You do not have permission to do this.', 'soro-seo'), 'error');
     346            return;
     347        }
     348       
     349        $author_id = isset($_POST['soro_post_author']) ? absint($_POST['soro_post_author']) : 0;
     350        update_option('soro_post_author', $author_id);
     351       
     352        add_settings_error('soro_messages', 'soro_success', __('Post author updated.', 'soro-seo'), 'success');
     353    }
     354   
     355    /**
     356     * Handle post category save
     357     */
     358    public function handle_save_category() {
     359        if (!isset($_POST['soro_save_category'])) {
     360            return;
     361        }
     362       
     363        if (!isset($_POST['soro_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['soro_nonce'])), $this->nonce_action)) {
     364            add_settings_error('soro_messages', 'soro_error', __('Security check failed.', 'soro-seo'), 'error');
     365            return;
     366        }
     367       
     368        if (!current_user_can('manage_options')) {
     369            add_settings_error('soro_messages', 'soro_error', __('You do not have permission to do this.', 'soro-seo'), 'error');
     370            return;
     371        }
     372       
     373        $category_id = isset($_POST['soro_post_category']) ? absint($_POST['soro_post_category']) : 0;
     374        update_option('soro_post_category', $category_id);
     375       
     376        add_settings_error('soro_messages', 'soro_success', __('Post category updated.', 'soro-seo'), 'success');
    327377    }
    328378   
     
    393443                    <div class="soro-card-header">
    394444                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
     445                            <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" />
     446                        </svg>
     447                        <?php esc_html_e('Post Author', 'soro-seo'); ?>
     448                    </div>
     449                    <p style="color:#666;font-size:13px;margin:0 0 12px;"><?php esc_html_e('Choose which WordPress user will be set as the author for articles published by Soro.', 'soro-seo'); ?></p>
     450                    <form method="post" action="">
     451                        <?php wp_nonce_field($this->nonce_action, 'soro_nonce'); ?>
     452                        <?php
     453                        $saved_author = get_option('soro_post_author', 0);
     454                        $users = get_users(array(
     455                            'capability' => array('edit_posts'),
     456                            'orderby' => 'display_name',
     457                            'order' => 'ASC',
     458                        ));
     459                        ?>
     460                        <div style="display:flex;gap:8px;align-items:center;">
     461                            <select name="soro_post_author" style="flex:1;padding:10px 12px;border:1px solid #e5e5e5;border-radius:8px;font-size:14px;background:#fafafa;">
     462                                <option value="0"><?php esc_html_e('— Default (site admin) —', 'soro-seo'); ?></option>
     463                                <?php foreach ($users as $user) : ?>
     464                                    <option value="<?php echo esc_attr($user->ID); ?>" <?php selected($saved_author, $user->ID); ?>>
     465                                        <?php echo esc_html($user->display_name); ?>
     466                                    </option>
     467                                <?php endforeach; ?>
     468                            </select>
     469                            <button type="submit" name="soro_save_author" style="background:#7C3AED;color:#fff;border:none;border-radius:8px;padding:10px 16px;font-size:13px;font-weight:500;cursor:pointer;white-space:nowrap;">
     470                                <?php esc_html_e('Save', 'soro-seo'); ?>
     471                            </button>
     472                        </div>
     473                    </form>
     474                </div>
     475               
     476                <div class="soro-card">
     477                    <div class="soro-card-header">
     478                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
     479                            <path stroke-linecap="round" stroke-linejoin="round" d="M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z" />
     480                            <path stroke-linecap="round" stroke-linejoin="round" d="M6 6h.008v.008H6V6z" />
     481                        </svg>
     482                        <?php esc_html_e('Post Category', 'soro-seo'); ?>
     483                    </div>
     484                    <p style="color:#666;font-size:13px;margin:0 0 12px;"><?php esc_html_e('Choose the default category for articles published by Soro.', 'soro-seo'); ?></p>
     485                    <form method="post" action="">
     486                        <?php wp_nonce_field($this->nonce_action, 'soro_nonce'); ?>
     487                        <?php
     488                        $saved_category = get_option('soro_post_category', 0);
     489                        $categories = get_categories(array(
     490                            'hide_empty' => false,
     491                            'orderby' => 'name',
     492                            'order' => 'ASC',
     493                        ));
     494                        ?>
     495                        <div style="display:flex;gap:8px;align-items:center;">
     496                            <select name="soro_post_category" style="flex:1;padding:10px 12px;border:1px solid #e5e5e5;border-radius:8px;font-size:14px;background:#fafafa;">
     497                                <option value="0"><?php esc_html_e('— Default (Uncategorized) —', 'soro-seo'); ?></option>
     498                                <?php foreach ($categories as $cat) : ?>
     499                                    <option value="<?php echo esc_attr($cat->term_id); ?>" <?php selected($saved_category, $cat->term_id); ?>>
     500                                        <?php echo esc_html($cat->name); ?>
     501                                    </option>
     502                                <?php endforeach; ?>
     503                            </select>
     504                            <button type="submit" name="soro_save_category" style="background:#7C3AED;color:#fff;border:none;border-radius:8px;padding:10px 16px;font-size:13px;font-weight:500;cursor:pointer;white-space:nowrap;">
     505                                <?php esc_html_e('Save', 'soro-seo'); ?>
     506                            </button>
     507                        </div>
     508                    </form>
     509                </div>
     510               
     511                <div class="soro-card">
     512                    <div class="soro-card-header">
     513                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
    395514                            <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" />
    396515                        </svg>
     
    531650        );
    532651       
     652        $post_author = get_option('soro_post_author');
     653        if ($post_author) {
     654            $post_data['post_author'] = absint($post_author);
     655        }
     656       
    533657        if (!empty($params['slug'])) {
    534658            $post_data['post_name'] = sanitize_title($params['slug']);
     
    543667            if ($category) {
    544668                $post_data['post_category'] = array($category);
     669            }
     670        }
     671       
     672        // Fallback to plugin-saved category if none was set by the API request
     673        if (empty($post_data['post_category'])) {
     674            $saved_category = get_option('soro_post_category');
     675            if ($saved_category) {
     676                $post_data['post_category'] = array(absint($saved_category));
    545677            }
    546678        }
  • soro-seo/trunk/readme.txt

    r3459644 r3459675  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.3.3
     7Stable tag: 1.3.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    9191== Changelog ==
    9292
     93= 1.3.4 =
     94* Added post author selection in plugin settings
     95* Added post category selection in plugin settings
     96* Choose which WordPress user and category are used for Soro-published articles
     97
    9398= 1.3.3 =
    9499* Added focus keyword support for Rank Math, Yoast SEO, and All in One SEO
     
    126131== Upgrade Notice ==
    127132
     133= 1.3.4 =
     134Post author and category selection. Configure directly in WordPress plugin settings.
     135
    128136= 1.3.3 =
    129137Adds focus keyword support for Rank Math, Yoast SEO, and AIOSEO. Recommended for all users.
  • soro-seo/trunk/soro-seo.php

    r3459644 r3459675  
    44 * Plugin URI: https://trysoro.com/wordpress
    55 * Description: Connect your WordPress site to Soro for automatic AI-powered article publishing.
    6  * Version: 1.3.3
     6 * Version: 1.3.4
    77 * Author: Soro
    88 * Author URI: https://trysoro.com
     
    1919}
    2020
    21 define('SORO_CONNECTOR_VERSION', '1.3.3');
     21define('SORO_CONNECTOR_VERSION', '1.3.4');
    2222define('SORO_CONNECTOR_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2323define('SORO_CONNECTOR_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    3232        add_action('admin_init', array($this, 'register_settings'));
    3333        add_action('admin_init', array($this, 'handle_regenerate_key'));
     34        add_action('admin_init', array($this, 'handle_save_author'));
     35        add_action('admin_init', array($this, 'handle_save_category'));
    3436        add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
    3537        add_action('rest_api_init', array($this, 'register_rest_routes'));
     
    325327       
    326328        add_settings_error('soro_messages', 'soro_success', __('API key regenerated successfully.', 'soro-seo'), 'success');
     329    }
     330   
     331    /**
     332     * Handle post author save
     333     */
     334    public function handle_save_author() {
     335        if (!isset($_POST['soro_save_author'])) {
     336            return;
     337        }
     338       
     339        if (!isset($_POST['soro_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['soro_nonce'])), $this->nonce_action)) {
     340            add_settings_error('soro_messages', 'soro_error', __('Security check failed.', 'soro-seo'), 'error');
     341            return;
     342        }
     343       
     344        if (!current_user_can('manage_options')) {
     345            add_settings_error('soro_messages', 'soro_error', __('You do not have permission to do this.', 'soro-seo'), 'error');
     346            return;
     347        }
     348       
     349        $author_id = isset($_POST['soro_post_author']) ? absint($_POST['soro_post_author']) : 0;
     350        update_option('soro_post_author', $author_id);
     351       
     352        add_settings_error('soro_messages', 'soro_success', __('Post author updated.', 'soro-seo'), 'success');
     353    }
     354   
     355    /**
     356     * Handle post category save
     357     */
     358    public function handle_save_category() {
     359        if (!isset($_POST['soro_save_category'])) {
     360            return;
     361        }
     362       
     363        if (!isset($_POST['soro_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['soro_nonce'])), $this->nonce_action)) {
     364            add_settings_error('soro_messages', 'soro_error', __('Security check failed.', 'soro-seo'), 'error');
     365            return;
     366        }
     367       
     368        if (!current_user_can('manage_options')) {
     369            add_settings_error('soro_messages', 'soro_error', __('You do not have permission to do this.', 'soro-seo'), 'error');
     370            return;
     371        }
     372       
     373        $category_id = isset($_POST['soro_post_category']) ? absint($_POST['soro_post_category']) : 0;
     374        update_option('soro_post_category', $category_id);
     375       
     376        add_settings_error('soro_messages', 'soro_success', __('Post category updated.', 'soro-seo'), 'success');
    327377    }
    328378   
     
    393443                    <div class="soro-card-header">
    394444                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
     445                            <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" />
     446                        </svg>
     447                        <?php esc_html_e('Post Author', 'soro-seo'); ?>
     448                    </div>
     449                    <p style="color:#666;font-size:13px;margin:0 0 12px;"><?php esc_html_e('Choose which WordPress user will be set as the author for articles published by Soro.', 'soro-seo'); ?></p>
     450                    <form method="post" action="">
     451                        <?php wp_nonce_field($this->nonce_action, 'soro_nonce'); ?>
     452                        <?php
     453                        $saved_author = get_option('soro_post_author', 0);
     454                        $users = get_users(array(
     455                            'capability' => array('edit_posts'),
     456                            'orderby' => 'display_name',
     457                            'order' => 'ASC',
     458                        ));
     459                        ?>
     460                        <div style="display:flex;gap:8px;align-items:center;">
     461                            <select name="soro_post_author" style="flex:1;padding:10px 12px;border:1px solid #e5e5e5;border-radius:8px;font-size:14px;background:#fafafa;">
     462                                <option value="0"><?php esc_html_e('— Default (site admin) —', 'soro-seo'); ?></option>
     463                                <?php foreach ($users as $user) : ?>
     464                                    <option value="<?php echo esc_attr($user->ID); ?>" <?php selected($saved_author, $user->ID); ?>>
     465                                        <?php echo esc_html($user->display_name); ?>
     466                                    </option>
     467                                <?php endforeach; ?>
     468                            </select>
     469                            <button type="submit" name="soro_save_author" style="background:#7C3AED;color:#fff;border:none;border-radius:8px;padding:10px 16px;font-size:13px;font-weight:500;cursor:pointer;white-space:nowrap;">
     470                                <?php esc_html_e('Save', 'soro-seo'); ?>
     471                            </button>
     472                        </div>
     473                    </form>
     474                </div>
     475               
     476                <div class="soro-card">
     477                    <div class="soro-card-header">
     478                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
     479                            <path stroke-linecap="round" stroke-linejoin="round" d="M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z" />
     480                            <path stroke-linecap="round" stroke-linejoin="round" d="M6 6h.008v.008H6V6z" />
     481                        </svg>
     482                        <?php esc_html_e('Post Category', 'soro-seo'); ?>
     483                    </div>
     484                    <p style="color:#666;font-size:13px;margin:0 0 12px;"><?php esc_html_e('Choose the default category for articles published by Soro.', 'soro-seo'); ?></p>
     485                    <form method="post" action="">
     486                        <?php wp_nonce_field($this->nonce_action, 'soro_nonce'); ?>
     487                        <?php
     488                        $saved_category = get_option('soro_post_category', 0);
     489                        $categories = get_categories(array(
     490                            'hide_empty' => false,
     491                            'orderby' => 'name',
     492                            'order' => 'ASC',
     493                        ));
     494                        ?>
     495                        <div style="display:flex;gap:8px;align-items:center;">
     496                            <select name="soro_post_category" style="flex:1;padding:10px 12px;border:1px solid #e5e5e5;border-radius:8px;font-size:14px;background:#fafafa;">
     497                                <option value="0"><?php esc_html_e('— Default (Uncategorized) —', 'soro-seo'); ?></option>
     498                                <?php foreach ($categories as $cat) : ?>
     499                                    <option value="<?php echo esc_attr($cat->term_id); ?>" <?php selected($saved_category, $cat->term_id); ?>>
     500                                        <?php echo esc_html($cat->name); ?>
     501                                    </option>
     502                                <?php endforeach; ?>
     503                            </select>
     504                            <button type="submit" name="soro_save_category" style="background:#7C3AED;color:#fff;border:none;border-radius:8px;padding:10px 16px;font-size:13px;font-weight:500;cursor:pointer;white-space:nowrap;">
     505                                <?php esc_html_e('Save', 'soro-seo'); ?>
     506                            </button>
     507                        </div>
     508                    </form>
     509                </div>
     510               
     511                <div class="soro-card">
     512                    <div class="soro-card-header">
     513                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
    395514                            <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" />
    396515                        </svg>
     
    531650        );
    532651       
     652        $post_author = get_option('soro_post_author');
     653        if ($post_author) {
     654            $post_data['post_author'] = absint($post_author);
     655        }
     656       
    533657        if (!empty($params['slug'])) {
    534658            $post_data['post_name'] = sanitize_title($params['slug']);
     
    543667            if ($category) {
    544668                $post_data['post_category'] = array($category);
     669            }
     670        }
     671       
     672        // Fallback to plugin-saved category if none was set by the API request
     673        if (empty($post_data['post_category'])) {
     674            $saved_category = get_option('soro_post_category');
     675            if ($saved_category) {
     676                $post_data['post_category'] = array(absint($saved_category));
    545677            }
    546678        }
Note: See TracChangeset for help on using the changeset viewer.