WordPress.org

Plugin Directory

Changeset 695789


Ignore:
Timestamp:
04/11/13 08:07:10 (5 years ago)
Author:
cnorris23
Message:

First pass at reworking the flushing of rewrite rules

Location:
edit-author-slug/tags/0.9.5
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • edit-author-slug/tags/0.9.5/edit-author-slug.php

    r661634 r695789  
    1616 * Plugin URI: http://brandonallen.org/wordpress/plugins/edit-author-slug/ 
    1717 * Description: Allows an Admin (or capable user) to edit the author slug of a user, and change the Author Base. <em>i.e. - (WordPress default structure) http://example.com/author/username/ (Plugin allows) http://example.com/ninja/master-ninja/</em> 
    18  * Version: 0.9.4 
    19  * Tested With: 3.2.1, 3.3.2, 3.4, 3.5.1 
     18 * Version: 0.9.5 
     19 * Tested With: 3.2.1, 3.3.2, 3.4, 3.5.1, 3.6 
    2020 * Author: Brandon Allen 
    2121 * Author URI: http://brandonallen.org/ 
     
    2424 
    2525/* 
    26             Copyright 2011  Brandon Allen  (email : wp_plugins ([at]) brandonallen ([dot]) org) 
     26            Copyright 2013  Brandon Allen  (email : wp_plugins ([at]) brandonallen ([dot]) org) 
    2727 
    2828            This program is free software; you can redistribute it and/or modify 
     
    5858     * @var string Edit Author Slug Version 
    5959     */ 
    60     public $version = '0.9.4'; 
     60    public $version = '0.9.5-beta'; 
    6161 
    6262    /** 
     
    216216        global $wp_rewrite; 
    217217 
    218         if ( !empty( $this->author_base ) || 'author' != $this->author_base ) 
     218        if ( !empty( $this->author_base ) && 'author' != $this->author_base ) 
    219219            $wp_rewrite->author_base = $this->author_base; 
    220220    } 
     
    235235function ba_eas_activation() { 
    236236    do_action( 'ba_eas_activation' ); 
     237 
     238    // Pre-emptive courtesy flush in case of existing author base 
     239    add_action( 'init', 'ba_eas_delete_rewrite_rules', 999 ); 
    237240} 
    238241 
  • edit-author-slug/tags/0.9.5/includes/admin-functions.php

    r661634 r695789  
    310310        $author_base = 'author'; 
    311311 
    312  
    313312    // Do we need to update the author_base 
    314313    if ( $author_base != $ba_eas->author_base ) { 
     
    324323 
    325324        // Courtesy flush 
    326         flush_rewrite_rules( false ); 
    327     } 
     325        //flush_rewrite_rules( false ); 
     326    } 
     327 
     328    // Courtesy flush 
     329    delete_option( 'rewrite_rules' ); 
    328330 
    329331    return $author_base; 
  • edit-author-slug/tags/0.9.5/includes/general-functions.php

    r661634 r695789  
    194194} 
    195195 
     196/** 
     197 * Delete WP generated rewrite rules from database. 
     198 * 
     199 * Rules will be recreated on next page load. 
     200 * 
     201 * @since 0.9.5 
     202 * 
     203 * @uses delete_option() To auto-update the nicename 
     204 */ 
     205function ba_eas_delete_rewrite_rules() { 
     206    delete_option( 'rewrite_rules' ); 
     207} 
     208 
    196209?> 
  • edit-author-slug/tags/0.9.5/readme.txt

    r661634 r695789  
    33Tags: author, author base, author slug, user nicename, nicename, permalink, permalinks, slug, users, user 
    44Requires at least: 3.2.1 
    5 Tested up to: 3.5.1 
    6 Stable tag: 0.9.4 
     5Tested up to: 3.6 
     6Stable tag: 0.9.5 
    77 
    88Allows an admin (or capable user) to edit the author slug of a user, and change the author base. 
Note: See TracChangeset for help on using the changeset viewer.