/**
  * Steps through the process of setting up basic integration data
  *
  * Be sure to call this method early in your module class's constructor
  *
  * @since 1.0
  */
 public function init()
 {
     $this->set_module_path();
     $this->set_module_url();
     if (!participad_is_installed_correctly()) {
         return new WP_Error('not_installed_correctly', 'Participad is not installed correctly.');
     }
     // Set up the admin panels and save methods
     add_action('participad_admin_page', array($this, 'admin_page'));
     add_action('participad_admin_page_save', array($this, 'admin_page_save'));
 }
Exemplo n.º 2
0
function participad_flush_rewrite_rules()
{
    if (!is_admin()) {
        return;
    }
    if (!is_super_admin()) {
        return;
    }
    if (!participad_is_installed_correctly()) {
        return;
    }
    global $wp_rewrite;
    // Check to see whether our rules have been registered yet, by
    // finding a Notepad rule and then comparing it to the registered rules
    foreach ($wp_rewrite->extra_rules_top as $rewrite => $rule) {
        if (0 === strpos($rewrite, 'notepads')) {
            $test_rule = $rule;
        }
    }
    $registered_rules = get_option('rewrite_rules');
    if (!empty($test_rule) && !in_array($test_rule, (array) $registered_rules)) {
        flush_rewrite_rules();
    }
}