fabacab / wp-pgp-encrypted-emails

:closed_lock_with_key: :e-mail: Encrypts WordPress emails using OpenPGP or S/MIME with a familiar API.
https://wordpress.org/plugins/wp-pgp-encrypted-emails/
GNU General Public License v3.0
39 stars 10 forks source link

Admin access to other users' keys #37

Closed sebastiencyr closed 5 years ago

sebastiencyr commented 5 years ago

Hi,

I needed access to other users' pgp keys in their user profiles.

I modified lines 151 and 152 to enable that as follows:

add_action( 'plugins_loaded', function(){
    if( current_user_can('manage_options') ){
        add_action( 'edit_user_profile', array( __CLASS__, 'renderProfile' ) );
        add_action( 'edit_user_profile_update', array( __CLASS__, 'saveProfile' ) );
    }else{
        add_action( 'show_user_profile', array( __CLASS__, 'renderProfile' ) );
        add_action( 'personal_options_update', array( __CLASS__, 'saveProfile' ) );
    }
});

This would be useful in a future update I'm sure.

fabacab commented 5 years ago

Can you describe a use case in which a user should be allowed to modify the keys of another user? An admin already has access to the entire WordPress system, and changing other users PGP keys isn't something I'd like to make too easy, if you know what I mean. :)