GithubHelp home page GithubHelp logo

joshuadavidnelson / disable-blog Goto Github PK

View Code? Open in Web Editor NEW
53.0 53.0 7.0 1.15 MB

All the power of WordPress, without a blog. This plugin removes blog related functionality.

Home Page: https://wordpress.org/plugins/disable-blog/

License: GNU General Public License v2.0

PHP 96.80% CSS 0.80% JavaScript 2.39%

disable-blog's People

Contributors

chesio avatar joshuadavidnelson avatar ramiy avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

disable-blog's Issues

v0.5 Todo List

Items to be in future versions, these updates are being developed in the 0.5.0 branch.

  • Disable REST API for posts.
  • Disable XML-RPC for posts.
  • Hide blog-related settings in customizer view.
  • Hide post column in User table view.
  • Hide Posts, Categories, and Tags in Appearance > Menus (Support Forum Issue)
  • Hide Posts, Categories, and Tags in Customizer > Menus.
  • Remove 'posts' from front-end query.
  • Filter or remove post-related topics in help tabs.
  • Remove posts from comment feeds, if comments are enabled.
  • Remove posts from Media Library "uploaded to" column.
  • Change count in category and tag screen, if taxonomies are supported by another post type.

v0.6 Todo List

Items to be in future versions, these updates are being developed in the 0.5.0 branch.

  • Settings Page (for admin and super admins only)

Removing maximum number of posts to show removes ability to change it for all archives

The "Blog posts to show at most" option from 'Settings > Reading' does not only apply to the default posts archive, but also to CPT archives, taxonomy archives and search results pages. Removing access to this setting also removes the ability to change it for all of those archives. Please add this ability back; other than this, the plugin takes care of everything else without affecting other CPTs.

Perhaps the verbiage could be changed to remove reference to 'Blog posts' and just say 'Posts' or 'Items' instead?

(I suspect removing the 'Syndication feeds show the most recent' option would also have a similar effect on number of posts shown in RSS feeds for other CPTs, so you might consider adding that back as well.)

Crashes php5-fpm

Hi Joshua,

Installed the disable-wordpress-blog plugin on a site I'm building, and came across a very strange bug. The server is running NGINX + MariaDB + PHP5-FPM + Varnish cache.

I can install your plugin and activate it, and move around wp-admin. As soon as I visit the front-end of the site, it crashes. To get the site back up, I need to restart PHP5-FPM and disable your plugin. I can reproduce this over and over.

I'm curious if you've ever heard of this happening, as I haven't run into this problem with any other plugin.

Thanks in advance.

Feeds: Possible non-object while running the redirects

Feeds can lead to a non-existing post object. This may result in a Trying to get property 'post_type' of non-object here in line 74, since is_singular is not reliable at this moment (see more in the trac ticket #29660).

The full error message:

ErrorException: Notice: Trying to get property 'post_type' of non-object
#8 /wp-includes/class-wp-query.php(4103): WP_Query::is_singular
#7 /wp-includes/query.php(731): is_singular
#6 /wp-content/plugins/disable-blog/public/class-disable-blog-public.php(74): Disable_Blog_Public::redirect_posts
#5 /wp-includes/class-wp-hook.php(288): WP_Hook::apply_filters
#4 /wp-includes/class-wp-hook.php(312): WP_Hook::do_action
#3 /wp-includes/plugin.php(478): do_action
#2 /wp-includes/template-loader.php(13): require_once
#1 /wp-blog-header.php(19): require
#0 /index.php(17): null

My proposed solution:

Add a check if the post object exists before running is_singular.

if( is_singular( 'post' ) ) {
		
	global $post;

would become:

global $post;

if( $post instanceof WP_Post && is_singular( 'post' ) ) {

Deprecated Function for "comment_whitelist

This error only shows up if this plugin is enabled. This is also on a brand new WP install.

Function update_option was called with an argument that is deprecated since version 5.5.0! The "comment_whitelist" option key has been renamed to "comment_previously_approved". in /home/758708.cloudwaysapps.com/ymtwarqkbm/public_html/wp-includes/functions.php on line 5697

Possible consequences of renaming Posts column in user table?

Regarding "Replaces the "Posts" column in the user table with "Pages," linked to pages by that author.":

  1. Is this reversed when uninstalling the plugin?
  2. Does it impact other CPTs by that author, or would they continue to be linked to the author in the DB, but in the "Pages" column (or do they get columns of their own based on the CPT name)?

UPDATE: Sorry, I misunderstood it to be the wp_users DB table. Now I understand that it was about the Users list in WP Admin.

redirect_admin_pages() may redirect even if it shouldn’t (multisite)

I have a multisite with a custom plugin, that adds an own network option page. By updating these settings, the form action is set to /wp-admin/network/edit.php?action=my_action to store the settings via network_admin_edit_my_action.

Unfortunately, this will trigger the redirect_admin_pages() function in the Disable_Blog_Admin class and redirect to admin_url( '/edit.php?post_type=page' ) before my hook network_admin_edit_my_action fires.

This will always be the case for network option updates as long as the Disable Blog plugin is active network-wide or for the first blog in a multisite.

A check for multisite should be added here and then disable the redirection of the redirect_admin_pages() on network option updates.

Problems with the WordPress-app

Hello,

I like your plugin and used it on a wp-install without the need for a blog, than I wanted to edit some pages with the WordPress-app and the login failed.
Is there a possibility to get the wp-app back working again and using the plugin.
I really only want to edit some pages on the go with the app ;)

Thank you and best regards,
Falk

Todo List

Long-term to-do list

  • Settings Page:
    • Toggle all features.
    • Add options to disable emoji, oembed, etc.
    • Add option to disable author archives.
  • Dealing with existing post content:
    • Remove posts from Media Library "uploaded to" column: Filter the "uploaded to" or the attachment's parent, if it's a post then don't show it on the media library or elsewhere (probably filtering the parent to check if it's a post and returning 0 if so would be the best approach)
    • Remove posts from comment feeds, if comments are enabled
    • Add an option in the Tools section to delete all blog content (post, categories, tags, linked attachments, and comments).
  • Enhanced custom post type / taxonomy support:
    • Change post count in category and tag screen, if taxonomies are supported by another post type (update the post count callback and flush the cache/rebuild the counts).
  • Remove Feeds from Meta Widget.
  • Filter or remove post-related topics in help tabs.
  • Update "homepage settings" in Customizer to match admin page experience for setting front page & blog page.
  • Hide or remove post category and post format options on writing settings page.
  • Remove the widget submenu from the Appearance menu, if there are no widget areas.
  • Unit & CI tests.
  • In permalinks page:
    • Change the "post name" and sample-post on the permalink settings page to be "Page Name" and sample-page - for English as well as other translations.
    • Change the %postname% to %pagename (but setup permalinks to work with either via filter).
    • Remove options for %category% and %post_id% (change to %page_id% ?).
    • Remove category base and tag base permalink options, if not supported by a custom post type.
    • Remove "custom structures" section in help tab & update Overview & Permalink Settings tabs to remove "post" references.
  • Authors/user related:
    • Author archives: redirect to homepage if only post type support on is 'post'
    • Author sitemaps: remove sitemaps for author archives if only post type support is 'post'
    • Remove biographical information from user/profile page (and yoast & genesis versions) if author archives are a) disabled or b) only support "post" post type.

Filter dwpb_xmlrpc_methods_to_remove not working

Hey,

I've added the filter from #50 to my custom-plugin, but I still can't manage my pages with the wordpress mobile app and the disable-blog plugin active.
On refreshing the pages list I get the same error message and setup of the wp site is also only possible if the plugin is disabled.

Acceptance Tests with Cypress

hey @joshuadavidnelson ! Hope all is well with you. These updates came up on my timeline and I thought I'd share what I've done with my plugin to include acceptance tests using Cypress and some packages built by 10up. The tests are run with GitHub Actions and uses wp-env.json to spin up a new install.. The test directory holds all of the tests and config. I've copied all of this from open-source 10up plugins so I suggest looking at Elasticpress, Distributor, and Classifi for advanced usage.

One thing I learned is that you can create plugins in your test directory and then activate and deactivate them during certain tests runs. This is good to test certain filters and actions.

Hope this sparks some interest!

CSS in reading sections is not accurate enough

As reported on the WP.org forum:

The selector .disabled-blog.options-reading-php .form-table tr:nth-child(2) to disable the blog settings on the reading settings page is not accurate enough. If one adds another section via plugin to this page with two options, the second option is always hidden.

Since another section has another .form-table, I suggest changing the selector to .disabled-blog.options-reading-php .form-table:first-of-type tr:nth-child(2)

Settings Page

Create a Settings page, and the ability to toggle it's own visibility in the admin. Use existing filters (and possibly add new ones) to facilitate the control of specific features from the settings page.

Pass url params in redirect

A request in this WP Support Forum post to allow for front-end redirects to include "utm variables". Likely this would be implemented as a optionally feature (perhaps via a filter and eventually a settings page interface) to pass all url params in front-end redirects.

Remove the comments in the backend

For people who don't need the comments in the backend just add this in the functions.php

function remove_menu_comments($pages) {
	$pages[] = 'edit-comments.php';
	return $pages;
}
add_filter('dwpb_menu_pages_to_remove', 'remove_menu_comments');

Comments invisble

Hides comments on the back end, but they are not disabled in general (people can still comment but the admin cannot access said comments).

Full Site Editing Compatibility

Per this support forum post, removing post related blocks breaks Full Site Editing where those blocks are used for other post types (including pages!). Future release should include some method to "disable posts" while supporting these blocks.

Conflict with custom taxonomy save

Custom taxonomies can save via quick edit, but not via the edit tags screen. The post_types_with_tax function in the admin redirect function is redirecting to the main dashboard on the edit-tags save.

Capitalizing P-s

changelog, release description, readme.txt includes Wordpress, please fix all 3

Fatal error when WooCommerce is activated (Comments)

Hello,

First, my website is on last version of WordPress, your plugin and WooCommerce.

I tried the plugin on my private website and show me a PHP fatal error on activation about woocommerce comments.

I spoted where the bug come from admin/class-disable-blog-admin.php :

public function filter_wp_count_comments( $comments, $post_id ) {

        // if this is grabbing all the comments, filter out the 'post' comments.
        if( 0 == $post_id )
            $comments = $this->get_comment_counts();

        // If we filtered it above, it needs to be an object, not an array.
        if( ! empty( $comments ) ) {
            $comments = (object) $comments;
        }

        return $comments;
    }

It bugs in the casting operation (array to object).

Here is the fatal error :
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in \wp-content\plugins\woocommerce\includes\class-wc-comments.php:272 Stack trace: #0 \wp-includes\plugin.php(235): WC_Comments::wp_count_comments(Object(stdClass), 0) #1 wp-includes\comment.php(1113): apply_filters('wp_count_commen...', Object(stdClass), 0) #2 wp-admin\menu.php(72): wp_count_comments() #3 wp-admin\admin.php(138): require('C:\\xampp\\htdocs...') #4 wp-admin\plugins.php(10): require_once('C:\\xampp\\htdocs...') #5 {main} thrown in \wp-content\plugins\woocommerce\includes\class-wc-comments.php on line 272

Deprecated Function "comment_whitelist"

I have "WP_DEBUG" enabled. This error only shows up if this Disable Blog is enabled. This error showed up on a brand new WP install.

Function update_option was called with an argument that is deprecated since version 5.5.0! The "comment_whitelist" option key has been renamed to "comment_previously_approved". in /home/758708.cloudwaysapps.com/ymtwarqkbm/public_html/wp-includes/functions.php on line 5697

WP 6.2.2

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.