Skip to content

Commit

Permalink
Fixing activation hook
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooney committed Jan 6, 2023
1 parent 978e263 commit f0b17d9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
24 changes: 24 additions & 0 deletions ajax-load-more.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,30 @@
// Plugin installation helpers.
require_once plugin_dir_path( __FILE__ ) . 'core/install.php';

/**
* Activation hook - Create table & repeater.
*
* @param Boolean $network_wide Enable the plugin for all sites in the network or just the current site. Multisite only.
* @since 2.0.0
*/
function alm_install( $network_wide ) {
global $wpdb;
add_option( 'alm_version', ALM_VERSION ); // Add setting to options table.
if ( is_multisite() && $network_wide ) {
// Get all blogs in the network and activate plugin on each one.
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
alm_create_table();
restore_current_blog();
}
} else {
alm_create_table();
}
}
register_activation_hook( __FILE__, 'alm_install' );
add_action( 'wpmu_new_blog', 'alm_install' );

if ( ! class_exists( 'AjaxLoadMore' ) ) :

/**
Expand Down
25 changes: 0 additions & 25 deletions core/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,6 @@
* @since 2.0.0
*/

/**
* Activation hook - Create table & repeater.
*
* @param Boolean $network_wide Enable the plugin for all sites in the network or just the current site. Multisite only.
* @since 2.0.0
*/
function alm_install( $network_wide ) {
global $wpdb;
add_option( 'alm_version', ALM_VERSION ); // Add setting to options table.
if ( is_multisite() && $network_wide ) {
// Get all blogs in the network and activate plugin on each one.
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
alm_create_table();
restore_current_blog();
}
} else {
alm_create_table();
}
}
register_activation_hook( __FILE__, 'alm_install' );
add_action( 'wpmu_new_blog', 'alm_install' );


/**
* Create new table and repeater template.
*
Expand Down
4 changes: 2 additions & 2 deletions lang/ajax-load-more.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GPL.
msgid ""
msgstr ""
"Project-Id-Version: Ajax Load More 5.5.4.1\n"
"Project-Id-Version: Ajax Load More 5.5.5\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ajax-load-more\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-01-06T14:11:42+00:00\n"
"POT-Creation-Date: 2023-01-06T14:17:33+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.5.0\n"
"X-Domain: ajax-load-more\n"
Expand Down

0 comments on commit f0b17d9

Please sign in to comment.