WordPress.org

Ready to get started?Download WordPress

Forums

Search and Replace
[resolved] DISALLOW_FILE_EDIT breaks the plugin (4 posts)

  1. brasofilo
    Member
    Posted 2 years ago #

    Frank, using current_user_can('edit_plugins') is not a good idea, if the constant is set the plugin will throw the permissions error in its option page.

    Would be glad to hear your opinion in this Q&A.

    cheers!

    http://wordpress.org/extend/plugins/search-and-replace/

  2. Frank
    Member
    Plugin Author

    Posted 2 years ago #

  3. brasofilo
    Member
    Posted 2 years ago #

    ok, the solution I mention there would be something like:

    if ( current_user_can('edit_pluginss') ) {
    	searchandreplace_action();
    } else {
    	if( !defined('DISALLOW_FILE_EDIT') )
    		wp_die('<div class="error"><p>' . __('You do not have sufficient permissions to edit plugins for this blog.', FB_SAR_TEXTDOMAIN) . '</p></div>');
    	else
    		wp_die('<div class="error"><p>' . __('This plugin cannot work when DISALLOW_FILE_EDIT is set as true in wp-config.php .', FB_SAR_TEXTDOMAIN) . '</p></div>');
    }

    Also, updated the codex with your input, considering the situation where a plugin author that needs to check for this capability. So you can still request the edit_plugins capability but display an appropriate error message.

  4. Frank
    Member
    Plugin Author

    Posted 2 years ago #

    solved in 2.6.4

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic