Plugin Directory

Changeset 3392362


Ignore:
Timestamp:
11/09/2025 09:15:26 AM (5 months ago)
Author:
u3kkasha
Message:

feat(settings): add option to hide Blogify Admin Menu Pages

Location:
blogify-ai/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • blogify-ai/trunk/README.txt

    r3306414 r3392362  
    44Requires at least: 6.0
    55Tested up to: 6.8
    6 Stable tag: 1.2.1
     6Stable tag: 1.3.0
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    9494== Changelog ==
    9595
     96= 1.3.0 =
     97
     98* Added option to hide Blogify Menu Admin Pages via Settings Page
     99
    96100= 1.2.1 =
    97101
  • blogify-ai/trunk/blogify-ai.php

    r3306370 r3392362  
    1616 * Plugin URI:        https://blogify.ai/
    1717 * Description:       Seamlessly publish AI-generated blog posts from Blogify.ai to your WordPress site with ease, enhancing content management and SEO optimization in a few clicks.
    18  * Version:           1.2.1
     18 * Version:           1.3.0
    1919 * Requires at least: 6.0
    2020 * Requires PHP:      7.4
     
    5151DEFINE('BLOGIFY_ACCESS_TOKEN_OPTION_HANDLE','blogify_access_token');
    5252DEFINE('BLOGIFY_CLIENT_SECRET_OPTION_HANDLE', 'blogify_client_secret');
     53DEFINE('BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE', 'blogify_display_admin_menu_pages');
    5354
    5455// Load core functionality
  • blogify-ai/trunk/changelog.md

    r3306414 r3392362  
    66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
    77
     8## [1.3.0] - 2025-Nov-9
     9
     10## Fixed
     11
     12- When deleting the plugin the client secret option's handle was wrong
     13
    814## [1.2.1] - 2025-June-4
     15
     16## Added
     17
     18- Added option to hide Blogify Menu Admin Pages via Settings Page
    919
    1020## Fixed
  • blogify-ai/trunk/core/hooks.php

    r3306368 r3392362  
    3838        register_meta_tags_hook();
    3939        register_style_hooks();
    40         register_admin_menu_hooks();
    41     }
    42    
     40        if(get_option(BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE, true)) {
     41            register_admin_menu_hooks();
     42        }
     43    }
     44
    4345    register_deactivation_hooks();
    4446}
     
    180182            'type' => 'string',
    181183            'sanitize_callback' => function ($value) {
    182                 $message = "Connected to Blogify.ai successfully ✅" . "<br />" . "<a href='"
     184                if($value === get_option(BLOGIFY_ACCESS_TOKEN_OPTION_HANDLE, null)) {
     185                    return sanitize_text_field($value);
     186                }
     187                $message = "Connected to Blogify.ai successfully ✅" ;
     188                $dashboard_link =  "<br />" . "<a href='"
    183189                    . esc_url(get_admin_url(null, 'admin.php?page=blogify-ai'))
    184190                    . "'>Head over to Blogify-AI Dashboard</a>";
     
    190196                        BLOGIFY_ACCESS_TOKEN_OPTION_HANDLE,
    191197                        'token-success',
    192                         $message,
     198                        get_option(BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE) ? $message . $dashboard_link : $message,
    193199                        'success',
    194200                    );
     
    255261            ]
    256262        );
     263       
     264        // Register the display option and create its own settings section
     265        register_setting('blogify', BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE, [
     266            'type' => 'boolean',
     267            'sanitize_callback' => function ($value) {
     268                return (bool) $value;
     269            },
     270            'default' => true,
     271            'show_in_rest' => false,
     272        ]);
     273
     274        add_settings_section(
     275            'blogify_display_section',
     276            'Display Settings',
     277            function () {
     278                echo '<p>Configure if Blogify admin pages are displayed in the WordPress admin menu.</p>';
     279            },
     280            'blogify'
     281        );
     282
     283        add_settings_field(
     284            BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE,
     285            'Display Admin Menu Pages',
     286            function () {
     287                $option = get_option(BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE, true);
     288                ?>
     289                <input type='checkbox' id='<?php echo esc_attr(BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE); ?>' name='<?php echo esc_attr(BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE); ?>' <?php checked($option, true); ?> />
     290                <p class="description">Uncheck to hide Blogify-AI admin menu pages.</p>
     291                <?php
     292            },
     293            'blogify',
     294            'blogify_display_section',
     295            [
     296                'label_for' => BLOGIFY_DISPLAY_ADMIN_MENU_PAGES_HANDLE,
     297            ]
     298        );
     299
    257300    });
    258301}
  • blogify-ai/trunk/uninstall.php

    r3306414 r3392362  
    44    die;
    55}
    6 delete_option('blogify-client-secret');
     6delete_option('blogify_client_secret');
     7delete_option('blogify_display_admin_menu_pages');
Note: See TracChangeset for help on using the changeset viewer.