pfeifferNet

Activator
in package

FinalYes

Fired by the plugin activation process.

  • This class contains the functionality to run during the plugin's activation.
Tags
since
1.0.0
since
5.11.0

Refactor to simplify and remove multisite network activation.

since
6.1.0

Simplify and use smaller, modular functions.

Table of Contents

Constants

ACTIVATION_KEY  = 'pfic_activated'
The plugin activation key in wp_options.
DB_VERSION_KEY  = 'pnet_db_version'
The database version key in wp_options.

Methods

run()  : void
Run the plugin activation process.
add_capabilities()  : void
Add role capabilities to allow subscribers and above to view private pages.
add_pages()  : void
Add required pages if needed.
reset_permalinks()  : void
Reset permalinks.
set_cron_jobs()  : void
Set cron tasks.
set_db_version()  : void
Set database version.
set_last_subscriber_update()  : void
Set last subscriber update date. Will default to now.

Constants

ACTIVATION_KEY

The plugin activation key in wp_options.

private string ACTIVATION_KEY = 'pfic_activated'
Tags
since
6.1.0

DB_VERSION_KEY

The database version key in wp_options.

private string DB_VERSION_KEY = 'pnet_db_version'
Tags
since
6.1.0

Methods

add_capabilities()

Add role capabilities to allow subscribers and above to view private pages.

private static add_capabilities() : void
Tags
since
6.1.0

add_pages()

Add required pages if needed.

private static add_pages() : void
  • Don't overwrite existing pages.
Tags
since
6.1.0

Reset permalinks.

private static reset_permalinks() : void
  • Must be last action in activation.
  • Initialise any CPT or custom taxonomies that will affect permalinks.
    • Chapters taxonomy.
    • Ingredients CPT.
  • Flush permalink rewrite rules.
Tags
since
6.1.0
uses
Chapters::register()
uses
Ingredients::register()

set_cron_jobs()

Set cron tasks.

private static set_cron_jobs() : void
  • Note that the start time and date is in UTC.
  • This will override any existing cron settings for that job.
Tags
since
6.1.0
since
6.7.0

Refactor to use UTC and an array of jobs.

set_db_version()

Set database version.

private static set_db_version() : void
Tags
since
6.1.0
uses
get_plugin_metadata()

set_last_subscriber_update()

Set last subscriber update date. Will default to now.

private static set_last_subscriber_update() : void
  • Do not overwrite existing setting if it exists.
Tags
since
6.1.0

        
On this page

Search results