Tag: permission

  • Upload & Insert images as a WordPress contributor

    For my Marbella news site I recently hired an excellent free-lance writer on Elance to assist me in composing quality articles. As the site is also powered by WordPress I added him as a contributor to start of with. He explained he had some trouble adding images per the guide I sent him. The “Upload/Insert” image button was simply not there.

    So to summarise, the WordPress contributor role apparently lacks this permission. There are a few plugins around that can let you tweak those permissions with more granularity, but I just needed that single change.

    A bit of searching revealed exactly what I needed. One minor change in the theme’s functions file was sufficient to upload & insert images as a WordPress contributor:

    if ( current_user_can('contributor') && !current_user_can('upload_files') )
    	add_action('admin_init', 'allow_contributor_uploads');
     
    function allow_contributor_uploads() {
    	$contributor = get_role('contributor');
    	$contributor->add_cap('upload_files');
    }
    

    This also keeps the core clean for changes which makes upgrading WordPress later on less time consuming.

  • Empty Trash from the terminal

    For some reason I can not recall I went into my Trash bin on Fedora. There was unsurprisingly a lot of trash!

    I decided to empty the Trash bin but it only succeeded partially. I had a DVD directory that did not want to be deleted. Looking closer at the message it was a permissions error. Not sure how though, since if I did not have permissions to delete the directory from the Trash bin, how on Earth could I have moved it into the Trash bin to start with…!

    Looking around my home directory in the terminal I could not locate the exact spot to manually remove the directory. As always Google came to assistance and brought up a nice forum topic about how to empty the Trash bin in Fedora from the terminal.

    The simplest way would be to run the following command as root:

    rm -rf  ~/.local/share/Trash/files/*