Ejemplo n.º 1
0
/**
 * Achievements' version updater looks at what the current database version is and
 * runs whatever other code is needed.
 *
 * This is most-often used when the data schema changes, but should also be used
 * to correct issues with Achievements meta-data silently on software update.
 *
 * @since Achievements (3.0)
 */
function dpa_version_updater()
{
    // Get the raw database version
    $raw_db_version = (int) dpa_get_db_version_raw();
    // Chill; there's nothing to do for now!
    // Bump the version
    dpa_version_bump();
    // Delete rewrite rules to force a flush
    dpa_delete_rewrite_rules();
}
Ejemplo n.º 2
0
/**
 * Hooked to both activated_plugin and deactivated_plugin, this function detects when BuddyPress has
 * been (de-)activated, and flushes the rewrite rules.
 *
 * This is done because we move the "my achievements" pages away from the author permalinks into the
 * BP user profiles (or vice-versa) depending on the new state of the plugin.
 *
 * @param string $plugin_basename PHP's basename() of the plugin file which is being (de-)activated.
 * @since Achievements (3.2)
 */
function dpa_check_buddypress_is_active($plugin_basename)
{
    if (strpos('buddypress/bp-loader.php', $plugin_basename) === false) {
        return;
    }
    // Ah hah! Caught you red-handed.
    dpa_delete_rewrite_rules();
}