Plugin Directory

Changeset 2830837


Ignore:
Timestamp:
12/08/2022 10:53:30 PM (3 years ago)
Author:
grandslambert
Message:

Fixing an issue with the activation hook.

Location:
promote-my-extensions/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • promote-my-extensions/trunk/README.txt

    r2830830 r2830837  
    55Requires at least: 4.7
    66Tested up to: 6.1.1
    7 Stable tag: 0.2.0
     7Stable tag: 0.2.1
    88Requires PHP: 7.0
    99License: GPLv2 or later
  • promote-my-extensions/trunk/admin/init.php

    r2830830 r2830837  
    2222    register_activation_hook( __FILE__, 'wpe_plugin_rewrite_flush' );
    2323
    24     function wpe_plugin_rewrite_flush() {
    25         // Check if any default options are missing
    26         $options = array(
    27             'wpe_pmp_plural_label' => __('My Extensions', 'promote-my-extensions'),
    28             'wpe_pmp_singular_label' => __('My Extension', 'promote-my-extensions'),
    29             'wpe_pmp_index_slug' => 'extensions',
    30             'wpe_pmp_use_excerpt' => 'yes',
    31             'wpe_pmp_use_thumbnails' => 'yes',
    32             'wpe_pmp_use_custom_fields' => 'yes',
    33             'wpe_pmp_use_comments' => 'yes',
    34             'wpe_pmp_use_trackbacks' => 'yes',
    35             'wpe_pmp_use_revisions' => 'yes',
    36             'wpe_pmp_use_taxonomies' => 'yes',
    37             'wpe_pmp_use_documentation' => 'yes',
    38         );
    39        
    40         foreach ($options as $key => $value) {
    41             if (!get_option($key)) {
    42                 add_option($key, esc_attr($value));
    43             }
    44         }
    45        
     24    function wpe_plugin_rewrite_flush() {       
    4625        wpe_plugin_admin_init();
    4726        flush_rewrite_rules();
  • promote-my-extensions/trunk/promote-my-plugins.php

    r2830830 r2830837  
    55      * @package           Promote_My_Extensions
    66      * @author            Shane Lambert
    7       * @copyright         2022 GrandSlambert
     7      * @copyright         2022 WP Empowered
    88      * @license           GPL-2.0-or-later
    99      *
     
    1212      * Plugin URI:        https://grandslambert.com/plugins/promote-my-extensions
    1313      * Description:       This plugin creates a custom post type to allow you to provide information about the plugins you have developed.
    14       * Version:           0.2.0
     14      * Version:           0.2.1
    1515      * Requires at least: 5.2
    1616      * Requires PHP:      7.2
    17       * Author:            GrandSlambert
     17      * Author:            WP Empowered
    1818      * Author URI:        https://grandslambert.com
    1919      * Text Domain:       wpe-promote-my-plugins
     
    4444    add_action('admin_enqueue_scripts', 'wpeplugin_admin_styles');
    4545   
     46    function Promote_My_Extensions_activation() {
     47        // Check if any default options are missing
     48        $options = array(
     49            'wpe_pmp_plural_label' => __('My Extensions', 'promote-my-extensions'),
     50            'wpe_pmp_singular_label' => __('My Extension', 'promote-my-extensions'),
     51            'wpe_pmp_index_slug' => 'extensions',
     52            'wpe_pmp_use_excerpt' => 'yes',
     53            'wpe_pmp_use_thumbnails' => 'yes',
     54            'wpe_pmp_use_custom_fields' => 'yes',
     55            'wpe_pmp_use_comments' => 'yes',
     56            'wpe_pmp_use_trackbacks' => 'yes',
     57            'wpe_pmp_use_revisions' => 'yes',
     58            'wpe_pmp_use_taxonomies' => 'yes',
     59            'wpe_pmp_use_documentation' => 'yes',
     60        );
     61       
     62        foreach ($options as $key => $value) {
     63            if (!get_option($key)) {
     64                add_option($key, esc_attr($value));
     65            }
     66        }
     67       
     68        flush_rewrite_rules();
     69    }
     70    register_activation_hook(__FILE__, 'Promote_My_Extensions_activation');
     71   
Note: See TracChangeset for help on using the changeset viewer.