GithubHelp home page GithubHelp logo

gyrus / lock-pages Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 4.0 178 KB

A WordPress plugin that prevents specified pages (or all pages) and posts from having their slug, parent, status or password edited, or from being deleted, by non-administrators.

Home Page: http://wordpress.org/extend/plugins/lock-pages/

JavaScript 2.98% PHP 97.02%

lock-pages's People

Contributors

gyrus avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lock-pages's Issues

PHP notice if upgrading from earlier version of plugin

If upgrading the plugin (not installing it fresh), the array key for post types doesn't get added to the settings, which throws a notice on each admin page load.

It's fixable by going back to the options page and re-saving, but could be fixed in code as well. I added this to the load_options function to fix it automatically:

/**
 * Add empty array for post types if not present.
 * @since   0.3.1
 */
if ( ! array_key_exists( $this->prefix . 'post_types', $the_options ) ) {
    $the_options[ $this->prefix . 'post_types' ] = array();
    update_option( $this->options_name, $the_options );
}

Change options page 'update_core' cap?

It looks like I can filter this (by overriding the entire menu item), but would it not be more suitable to use manage_options here?

I'm running Bedrock, so even admins on my live environment don't have the update_core capability, which means i'm currently unable to access the options page.

Also, any progress on preventing the editing of post/page content (e.g. #1). Looks like you're hesitant to add this in? I can build on @jezhumble's fork and add in a 'lock content' option in the options page as you suggested, so long as you'll consider merging with the main git + wp repos (it would be nice if I could keep using wpackagist, rather than pulling from another repo).

Cheers

Locking post/page content on an individual basis

Fork: github.com/thomasfw/Lock-Pages
Commit: a2e2dd2b5c1e293205e046c48bd3f012e0b29a8

This fork includes the ability to disable the editing of post/page content on a per-post basis, blocks the revisions screen for posts with locked content, and includes the admin cap filter as discussed here.

Annoyingly I started out on the 3.0 release found in the wp plugin repo/wpackagist, so the changes you've added in 3.0.1 aren't included.

If I get more time I will merge the changes in your 3.0.1 and fix the conflicts with my fork so I can submit a pull request.

screen shot 2016-07-05 at 21 33 38

content-locked

is_page_locked_for_current_user()

This function uses $_GET['action'] when $screen = get_current_screen() returns an object $screen->action that seemingly could be used instead. Is there a reason for preferring $_GET['action'] over $screen->action?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.