Removing "Create" button for Author

5 posts by 3 authors in: Forums > CMS Builder
Last Post: November 28, 2014   (RSS)

By northernpenguin - November 14, 2014

I would like to be able to remove the "create" button for the Author type user account.  In other words, remove the capability for Author accounts to create new records.

Any ideas?

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

By northernpenguin - November 22, 2014

Damon:  Actually, my requirements are twofold:

1.  Allow only Authors to edit specific fields in a record; and

2.  No one can create a new record except for Editors.

I can do 1. easily enough by restricting access to the specific field(s) only to Authors, but my issue is 2.  Not sure how to go about it.

Ragi

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

By Dave - November 27, 2014

Hi Ragi, 

Here's a simple plugin that disables "Create" for authors:

<?php
/*
Plugin Name: Disable Create for Authors
Description:
Version: 1.00
Requires at least: 2.60
*/

// register callbacks
addAction('section_init', 'disableCreateForAuthors', null, 2);

// disable Add/Create if user is an author
function disableCreateForAuthors($tableName, $action) {

  if ($GLOBALS['hasAuthorAccess'] && !$GLOBALS['hasEditorAccess']) { 
    $GLOBALS['schema']['_disableAdd'] = 1; 
  }

}

//eof

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com

By northernpenguin - November 28, 2014

Thanks Dave!

Works great.

ragi

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke