Home
Softono
h

humanmade

Professional software vendor delivering innovative solutions on the Softono platform. Specialized in both open-source and proprietary software development.

Total Products
6

Software by humanmade

S3-Uploads
Open Source

S3-Uploads

<table width="100%"> <tr> <td align="left" width="70"> <strong>S3 Uploads</strong><br /> Lightweight "drop-in" for storing WordPress uploads on Amazon S3 instead of the local filesystem. </td> <td align="right" width="20%"> <a href="https://shepherd.dev/github/humanmade/S3-Uploads"> <img src="https://shepherd.dev/github/humanmade/S3-Uploads/coverage.svg" alt="Psalm coverage"> </a> <a href="https://github.com/humanmade/S3-Uploads/actions/workflows/ci.yml"> <img src="https://github.com/humanmade/S3-Uploads/actions/workflows/ci.yml/badge.svg" alt="CI"> </a> <a href="https://codecov.io/github/humanmade/S3-Uploads" > <img src="https://codecov.io/github/humanmade/S3-Uploads/graph/badge.svg?token=JmeqBWddkV"/> </a> </td> </tr> <tr> <td> A <strong><a href="https://hmn.md/">Human Made</a></strong> project. Maintained by @joehoyle. </td> <td align="center"> <img src="https://humanmade.com/content/themes/hmnmd/assets/images/hm-logo.svg" width="100" /> </td> </tr> </table> S3 Uploads is a WordPress plugin to store uploads on S3. S3 Uploads aims to be a lightweight "drop-in" for storing uploads on Amazon S3 instead of the local filesystem. It's focused on providing a highly robust S3 interface with no "bells and whistles", WP-Admin UI or much otherwise. It comes with some helpful WP-CLI commands for generating IAM users, listing files on S3 and Migrating your existing library to S3. ## Requirements - PHP >= 7.4 - WordPress >= 5.3 ## Getting Set Up S3 Uploads requires installation via Composer: ``` composer require humanmade/s3-uploads ``` **Note:** [Composer's autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading) must be loaded before S3 Uploads is loaded. We recommend loading it in your `wp-config.php` before `wp-settings.php` is loaded as shown below. ```php require_once __DIR__ . '/vendor/autoload.php'; ``` ## Configuration Once you've installed the plugin, add the following constants to your `wp-config.php`: ```PHP define( 'S3_UPLOADS_BUCKET', 'my-bucket' ); define( 'S3_UPLOADS_REGION', '' ); // the s3 bucket region (excluding the rest of the URL) // You can set access key and secret directly: define( 'S3_UPLOADS_KEY', '' ); define( 'S3_UPLOADS_SECRET', '' ); // Or if using IAM instance profiles, you can use the instance's credentials: define( 'S3_UPLOADS_USE_INSTANCE_PROFILE', true ); ``` Please refer to this [Region list](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) for the S3_UPLOADS_REGION values. Use of path prefix after the bucket name is allowed and is optional. For example, if you want to upload all files to 'my-folder' inside a bucket called 'my-bucket', you can use: ```PHP define( 'S3_UPLOADS_BUCKET', 'my-bucket/my-folder' ); ``` Please refer to this document outlining [Best Practices for managing AWS access keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#securing_access-keys) You must then enable the plugin. To do this via WP-CLI use command: ``` wp plugin activate S3-Uploads ``` The plugin name must match the directory you have cloned S3 Uploads into; If you're using Composer, use ``` wp plugin activate s3-uploads ``` The next thing that you should do is to verify your setup. You can do this using the `verify` command like so: ``` wp s3-uploads verify ``` You will need to create your IAM user yourself, or attach the necessary permissions to an existing user, you can output the policy via `wp s3-uploads generate-iam-policy` ## Listing files on S3 S3-Uploads comes with a WP-CLI command for listing files in the S3 bucket for debugging etc. ``` wp s3-uploads ls [<path>] ``` ## Uploading files to S3 If you have an existing media library with attachment files, use the below command to copy them all to S3 from local disk. ``` wp s3-uploads upload-directory <from> <to> [--verbose] ``` For example, to migrate your whole uploads directory to S3, you'd run: ``` wp s3-uploads upload-directory /path/to/uploads/ uploads ``` There is also an all purpose `cp` command for arbitrary copying to and from S3. ``` wp s3-uploads cp <from> <to> ``` Note: as either `<from>` or `<to>` can be S3 or local locations, you must specify the full S3 location via `s3://mybucket/mydirectory` for example `cp ./test.txt s3://mybucket/test.txt`. ## Private Uploads WordPress (and therefore S3 Uploads) default behaviour is that all uploaded media files are publicly accessible. In certain cases which may not be desireable. S3 Uploads supports setting S3 Objects to a `private` ACL and providing temporarily signed URLs for all files that are marked as private. S3 Uploads does not make assumptions or provide UI for marking attachments as private, instead you should integrate the `s3_uploads_is_attachment_private` WordPress filter to control the behaviour. For example, to mark _all_ attachments as private: ```php add_filter( 's3_uploads_is_attachment_private', '__return_true' ); ``` Private uploads can be transitioned to public by calling `S3_Uploads::set_attachment_files_acl( $id, 'public-read' )` or vica-versa. For example: ```php S3_Uploads::get_instance()->set_attachment_files_acl( 15, 'public-read' ); ``` The default expiry for all private file URLs is 6 hours. You can modify this by using the `s3_uploads_private_attachment_url_expiry` WordPress filter. The value can be any string interpreted by `strtotime`. For example: ```php add_filter( 's3_uploads_private_attachment_url_expiry', function ( $expiry ) { return '+1 hour'; } ); ``` If you're using [Stream](https://wordpress.org/plugins/stream/) for audit logs, [S3 Uploads Audit](https://github.com/humanmade/s3-uploads-audit) is an add-on plugin which supports logging some S3 Uploads actions e.g any setting of ACL for files of an attachment. So you can install it for such audit functionality. ## Cache Control You can define the default HTTP `Cache-Control` header for uploaded media using the following constant: ```PHP define( 'S3_UPLOADS_HTTP_CACHE_CONTROL', 30 * 24 * 60 * 60 ); // will expire in 30 days time ``` You can also configure the `Expires` header using the `S3_UPLOADS_HTTP_EXPIRES` constant For instance if you wanted to set an asset to effectively not expire, you could set the Expires header way off in the future. For example: ```PHP define( 'S3_UPLOADS_HTTP_EXPIRES', gmdate( 'D, d M Y H:i:s', time() + (10 * 365 * 24 * 60 * 60) ) .' GMT' ); // will expire in 10 years time ``` ## Default Behaviour As S3 Uploads is a plug and play plugin, activating it will start rewriting image URLs to S3, and also put new uploads on S3. Sometimes this isn't required behaviour as a site owner may want to upload a large amount of media to S3 using the `wp-cli` commands before enabling S3 Uploads to direct all uploads requests to S3. In this case one can define the `S3_UPLOADS_AUTOENABLE` to `false`. For example, place the following in your `wp-config.php`: ```PHP define( 'S3_UPLOADS_AUTOENABLE', false ); ``` To then enable S3 Uploads rewriting, use the wp-cli command: `wp s3-uploads enable` / `wp s3-uploads disable` to toggle the behaviour. ## URL Rewrites By default, S3 Uploads will use the canonical S3 URIs for referencing the uploads, i.e. `[bucket name].s3.amazonaws.com/uploads/[file path]`. If you want to use another URL to serve the images from (for instance, if you [wish to use S3 as an origin for CloudFlare](https://support.cloudflare.com/hc/en-us/articles/200168926-How-do-I-use-CloudFlare-with-Amazon-s-S3-Service-)), you should define `S3_UPLOADS_BUCKET_URL` in your `wp-config.php`: ```PHP // Define the base bucket URL (without trailing slash) define( 'S3_UPLOADS_BUCKET_URL', 'https://your.origin.url.example/path' ); ``` S3 Uploads' URL rewriting feature can be disabled if the current website does not require it, nginx proxy to s3 etc. In this case the plugin will only upload files to the S3 bucket. ```PHP // disable URL rewriting alltogether define( 'S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL', true ); ``` ## S3 Object Permissions The object permission of files uploaded to S3 by this plugin can be controlled by setting the `S3_UPLOADS_OBJECT_ACL` constant. The default setting if not specified is `public-read` to allow objects to be read by anyone. If you don't want the uploads to be publicly readable then you can define `S3_UPLOADS_OBJECT_ACL` as one of `private` or `authenticated-read` in you wp-config file: ```PHP // Set the S3 object permission to private define('S3_UPLOADS_OBJECT_ACL', 'private'); ``` For more information on S3 permissions please see the Amazon S3 permissions documentation. ## Custom Endpoints Depending on your requirements you may wish to use an alternative S3 compatible object storage system such as Minio, Ceph, Digital Ocean Spaces, Scaleway and others. You can configure the endpoint by adding the following code to a file in the `wp-content/mu-plugins/` directory, for example `wp-content/mu-plugins/s3-endpoint.php`: ```php <?php // Filter S3 Uploads params. add_filter( 's3_uploads_s3_client_params', function ( $params ) { $params['endpoint'] = 'https://your.endpoint.com'; $params['use_path_style_endpoint'] = true; $params['debug'] = false; // Set to true if uploads are failing. return $params; } ); ``` **Note:** As of AWS SDK 3.337, S3 uses a [new type of integrity protection](https://github.com/aws/aws-sdk-php/issues/3062) which is not supported by all third-party S3-compatible APIs. If you experience errors, you may need to disable the new checksum functionality: ```php add_filter( 's3_uploads_s3_client_params', function ( $params ) { // ... $params['request_checksum_calculation'] = 'when_required'; $params['response_checksum_validation'] = 'when_required'; return $params; } ); ``` ## Temporary Session Tokens If your S3 access is configured to require a temporary session token in addition to the access key and secret, you should configure the credentials using the following code: ```php // Filter S3 Uploads params. add_filter( 's3_uploads_s3_client_params', function ( $params ) { $params['credentials']['token'] = 'your session token here'; return $params; } ); ``` ## Offline Development While it's possible to use S3 Uploads for local development (this is actually a nice way to not have to sync all uploads from production to development), if you want to develop offline you have a couple of options. 1. Just disable the S3 Uploads plugin in your development environment. 2. Define the `S3_UPLOADS_USE_LOCAL` constant with the plugin active. Option 2 will allow you to run the S3 Uploads plugin for production parity purposes, it will essentially mock Amazon S3 with a local stream wrapper and actually store the uploads in your WP Upload Dir `/s3/`. ## Credits Created by Human Made for high volume and large-scale sites. We run S3 Uploads on sites with millions of monthly page views, and thousands of sites. Written and maintained by [Joe Hoyle](https://github.com/joehoyle). Thanks to all our [contributors](https://github.com/humanmade/S3-Uploads/graphs/contributors). Interested in joining in on the fun? [Join us, and become human!](https://hmn.md/is/hiring/)

CMS Plugins & Extensions Object Storage
2.1K Github Stars
Cavalcade
Open Source

Cavalcade

<table width="100%"> <tr> <td align="left" width="70"> <strong>Cavalcade</strong><br /> A better wp-cron. Horizontally scalable, works perfectly with multisite. </td> <td align="right" width="20%"> <a href="https://travis-ci.org/humanmade/Cavalcade"> <img src="https://travis-ci.org/humanmade/Cavalcade.svg?branch=master" alt="Build status"> </a> <a href="http://codecov.io/github/humanmade/Cavalcade?branch=master"> <img src="http://codecov.io/github/humanmade/Cavalcade/coverage.svg?branch=master" alt="Coverage via codecov.io" /> </a> </td> </tr> <tr> <td> A <strong><a href="https://hmn.md/">Human Made</a></strong> project. Maintained by @rmccue. </td> <td align="center"> <img src="https://hmn.md/content/themes/hmnmd/assets/images/hm-logo.svg" width="100" /> </td> </tr> </table> Cavalcade is a scalable job system, designed as a drop-in replacement for WordPress's built-in pseudo-cron system. ![Flowchart of how Cavalcade works](http://i.imgur.com/nyTFDfR.png) From the WordPress side, none of your code needs to change. Cavalcade transparently integrates with the existing wp-cron functions to act as a full replacement. Cavalcade pushes these jobs off into their own database table for efficient storage. At the core of Cavalcade is the job runner. The runner is a daemon that supervises the entire system. The runner constantly checks the database for new jobs, and is responsible for spawning and managing workers to handle the jobs when they're ready. The runner spawns workers, which perform the actual tasks themselves. This is done by running a special WP-CLI command. ## Documentation **[View documentation →](https://github.com/humanmade/Cavalcade/tree/master/docs)** * [Motivation](docs/motivation.md) - Why Cavalcade? * [Installation](docs/install.md) * [Example Use Cases](docs/examples.md) * [Plugins](docs/plugins.md) - Extending the functionality of Cavalcade ## License Cavalcade is [licensed under the GPLv2 or later](LICENSE.txt). ## Who? Created by Human Made for high volume and large-scale sites, such as [Happytables](http://happytables.com/). We run Cavalcade on sites with millions of monthly page views, and thousands of sites, including [The Tab](http://thetab.com/), and the [United Influencers](http://unitedinfluencers.se/) network. Maintained by [Ryan McCue](https://github.com/rmccue). Interested in joining in on the fun? [Join us, and become human!](https://hmn.md/is/hiring/)

WordPress Themes & Plugins Cron & Job Scheduling
538 Github Stars
Restsplain
Open Source

Restsplain

<table width="100%" style="width:100%"> <tr> <td align="left" width="70%"> <h1 style="border:0;margin-bottom:0;">Restsplain</h1> Super fast WordPress REST API docs that update with your site. </td> <td align="center" width="30%"> <img src="https://hmn.md/content/themes/hmnmd/assets/images/hm-logo.svg" width="100" /> </td> </tr> <tr> <td> A <strong><a href="https://hmn.md/">Human Made</a></strong> project. Maintained by @roborourke. </td> <td></td> </tr> </table> The WordPress REST API provides much of it's own documentation via it's schema. This plugin contains a React app that consumes the schema data to generate a blazing fast documentation site. 1. Add and edit high level documentation pages 2. Automatic discovery and display of all custom endpoints 3. Make API requests direct from the documentation! ![Restsplain running on TwentySeventeen](https://hmn.md/uploads/sites/2/2017/02/Screenshot-2017-02-20-01.23.08.png) ## Installation Upload the plugin to your plugins directory and activate it. You'll need to refresh your permalinks to use the built in URL by visiting the permalinks settings page in the admin. Once you've done that browse to `http://your-site.com/api-docs/` and you're done! ## Configuration Hopefully you won't need to do much configuration with Restsplain however there are a number of filters you can use to change it's behaviour. ### Default URL The docs will by default show at `/api-docs/` however you can modify this using the filter: ```php <?php add_filter( 'restsplain_docs_base', function() { return '/api/docs'; } ); ``` ### Default content In the admin you'll see a new post type called "API Docs". Default pages will be created for you if you don't add any before visiting the docs however you can edit these and add to them or remove them afterwards. The top level pages are: 1. Global Parameters 2. Linking and Embedding 3. Errors In addition a page for each default authentication type and each route will be added. When you create a page for a route you should make the title exactly the same as the route key in the schema eg. `/wp/v2/posts/(?P<id>[\d]+)`. If the title does not match then the page is treated as top level documentation and will appear at the top of the menu. #### Adding default pages Developers can add support for Restsplain in one of 2 ways: 1. Filter the schema output with the `rest_index` hook and add a `description` and optional `excerpt` key/value to each route object. 2. Add a file with the namespace `Restsplain` and call `add_default_page( $slug, $page )` ```php <?php namespace Restsplain; // Accepts just a string add_default_page( '/wp/v2/users', __( 'Fetch or create Users.' ) ); // Or an array with keys title, excerpt and content add_default_page( 'oauth1', array( 'title' => __( 'Oauth 1.0a' ), 'excerpt' => __( 'Endpoints for authenticating requests with Oauth 1.0a' ), 'content' => '<p>...</p>', ) ); ``` Pages will be created in the admin that can then be edited. ### Theming By default Restsplain is written to use as much of your site's existing styles as possible so your fonts and typography should all be respected. In addition if your theme supports a custom logo it will be displayed in the header. The standard calls to `wp_head()` and `wp_footer()` are present in the template so adding your own CSS is simple. Everything is styled under the `.restsplain` namespace. > **NOTE:** You will more than likely have to add some styles if your theme does not have rules for tables are global element rules for example. #### highlight.js You may wish to change the code highlighter to a different theme to suit your design. Code highlighting is done using [highlight.js](https://highlightjs.org/) so you can provide the name of any one of its 77 styles. You can find them at https://highlightjs.org/static/demo/ ```php <?php add_filter( 'restsplain_config', function( $config ) { $config['codeTheme'] = 'docco'; return $config; } ); ``` #### Logo Your custom logo will be used by default if your theme supports it and you have one uploaded. Otherwise you can use a filter to change it to some other image URL. ```php <?php add_filter( 'restsplain_config', function( $config ) { $config['logo'] = 'http://www.fillmurray.com/g/200/200'; return $config; } ); ``` ## Localisation The plugin is translation ready including the React component. If you'd like to provide a translation let us know! ## Note to developers The docs generated by an automated tool such as this will only be as good as the docs you build into your API endpoint definitions. Learn about and add proper schemas to your plugin or theme endpoints: https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/ ## There will be bugs, there will If you're interested in contributing to and improving Restsplain (and it will need it!) there are a few things you need to know besides React: ### Running the app locally Restsplain is built using [`create-react-app`](https://github.com/facebookincubator/create-react-app) which is a great way to get up and running quickly with React. The app itself is in the `app` folder of the plugin. Clone the repo and grab everything you need to work on the React app. ```bash git clone [email protected]:humanmade/Restsplain.git cd Restsplain/app npm install # or yarn npm start # or yarn start ``` ### Styling tips The built in CSS is intentionally low level and layout focused. Ideally the plugin should look as native to the site it is running on as possible with minimal input required from the site owner. Styling is done using Sass (compiled separately to the final bundle, see the `package.json` npm scripts for details) which is compiled and the resulting CSS then imported via the JavaScript. Webpack takes care of processing this and generating the final file. ### Debug mode Add `define( 'RESTSPLAIN_DEBUG', true );` to your config file to make the plugin use the development files served from `http://localhost:3000` **NOTE:** Currently the hotloading doesn't work in the WordPress context so if you know how to fix it create a pull request! ## License Restsplain is licensed under the GPLv3 or later. ## Credits Created by Human Made for easing the pain of keeping up to date documentation for our new API driven WordPress world. Written and maintained by [Robert O'Rourke](https://github.com/roborourke) Interested in joining in on the fun? [Join us, and become human!](https://hmn.md/is/hiring/)

WordPress Themes & Plugins Documentation
156 Github Stars
tachyon-plugin
Open Source

tachyon-plugin

<table width="100%"> <tr> <td align="left" width="70"> <strong>Tachyon</strong><br /> Faster than light image processing. Inspired / forked from Photon. </td> <td align="right" width="20%"> <a href="https://travis-ci.org/humanmade/tachyon-plugin"> <img src="https://travis-ci.org/humanmade/tachyon.svg?branch=master" alt="Build status"> </a> <a href="http://codecov.io/github/humanmade/tachyon-plugin?branch=master"> <img src="http://codecov.io/github/humanmade/tachyon-plugin/coverage.svg?branch=master" alt="Coverage via codecov.io" /> </a> </td> </tr> <tr> <td> A <strong><a href="https://hmn.md/">Human Made</a></strong> project. Maintained by @joehoyle. </td> <td align="center"> <img src="https://hmn.md/content/themes/hmnmd/assets/images/hm-logo.svg" width="100" /> </td> </tr> </table> [Tachyon](https://github.com/humanmade/tachyon) is an image resizing service built to be used with Amazon S3 as the image backend, AWS Lambda (or any node.js server) to process images using [sharp](http://sharp.pixelplumbing.com/en/stable/), and sits behind a CDN such as CloudFront or CloudFlare. This plugin handles modifying WordPress image URLs to use a Tachyon service instance. ## Installation 1. Upload and enable this plugin. 2. Add `define( 'TACHYON_URL', 'https://your.tachyon.url/path/to/uploads' )` to your `wp-config.php` file. ## Usage Typically the above steps are all you need to do however you can use the following public facing functions and filters. ### Functions #### `tachyon_url( string $image_url, array $args = [] )` This function returns the Tachyon URL for a given image hosted on Amazon S3. ```php $image_url = 'https://my-bucket.s3.us-east-1.amazonaws.com/path/to/image.jpg'; $args = [ 'resize' => '300,300', 'quality' => 90 ]; $url = tachyon_url( $image_url, $args ); ``` ### Filters The following filters allow you to modify the output and behaviour of the plugin. #### `tachyon_disable_in_admin` Defaults to `true`. You can override this by adding the following code to a plugin or your theme's `functions.php`: ```php add_filter( 'tachyon_disable_in_admin', '__return_false' ); ``` #### `tachyon_override_image_downsize` Defaults to `false`. Provides a way of preventing Tachyon from being applied to images retrieved from WordPress Core at the lowest level, you might use this if you wanted to use `tachyon_url()` manually in specific cases. ```php add_filter( 'tachyon_override_image_downsize', '__return_true' ); ``` #### `tachyon_skip_for_url` Allows skipping the Tachyon URL for a given image URL. Defaults to `false`. ```php add_filter( 'tachyon_skip_for_url', function ( $skip, $image_url, $args ) { if ( strpos( $image_url, 'original' ) !== false ) { return true; } return $skip; }, 10, 3 ); ``` #### `tachyon_pre_image_url` Filters the Tachyon image URL excluding the query string arguments. You might use this to shard Tachyon requests across multiple instances of the service for example. ```php add_filter( 'tachyon_pre_image_url', function ( $image_url, $args ) { if ( rand( 1, 2 ) === 2 ) { $image_url = str_replace( TACHYON_URL, TACHYON_URL_2, $image_url ); } return $image_url; }, 10, 2 ); ``` #### `tachyon_pre_args` Filters the query string parameters appended to the tachyon image URL. ```php add_filter( 'tachyon_pre_args', function ( $args ) { if ( isset( $args['resize'] ) ) { $args['crop_strategy'] = 'smart'; } return $args; } ); ``` #### `tachyon_remove_size_attributes` Defaults to `true`. `width` & `height` attributes on image tags are removed by default to prevent aspect ratio distortion that can happen in some unusual cases where `srcset` sizes have different aspect ratios. ```php add_filter( 'tachyon_remove_size_attributes', '__return_true' ); ``` ## Credits Created by Human Made for high volume and large-scale sites, such as [Happytables](http://happytables.com/). We run Tachyon on sites with millions of monthly page views, and thousands of sites. Written and maintained by [Joe Hoyle](https://github.com/joehoyle). Tachyon is forked from Photon by Automattic Inc. As Tachyon is not an all-purpose image resizer, rather it uses a media library in Amazon S3, it has a different use case to Photon. Interested in joining in on the fun? [Join us, and become human!](https://hmn.md/is/hiring/)

WordPress Themes & Plugins Photo Management
87 Github Stars
authorship
Open Source

authorship

# Authorship Stable tag: 0.3.1 Requires at least: 5.4 Tested up to: 6.9 Requires PHP: 8.2 License: GPL v3 or later Contributors: johnbillion, humanmade A modern approach to author attribution in WordPress. ## Description Authorship is a modern approach to author attribution in WordPress. It supports attributing posts to multiple authors and to guest authors, provides a great UI, and treats API access to author data as a first-class citizen. Authorship is currently geared toward developers who are implementing custom solutions on WordPress. For example, it doesn't provide an option to automatically display author profiles at the bottom of a post. In the future it will include wider support for existing themes and useful features for implementors and site builders. --- - [Current Status](#current-status) - [Features](#features) - [Installation](#installation) - [Design Decisions](#design-decisions) - [Template Functions](#template-functions) - [REST API](#rest-api) - [WP-CLI](#wp-cli) - [Email Notifications](#email-notifications) - [Accessibility](#accessibility) - [Security, Privileges, and Privacy](#security-privileges-and-privacy) - [Contributing](#contributing) - [Team](#team) - [License](#license) - [Alternatives](#alternatives) --- ## Current Status **Alpha**. Generally very functional but several features are still in development. ## Features * [X] Multiple authors per post * [X] Guest authors (that can be created in place on the post editing screen) * [X] A convenient and user-friendly UI that feels like a part of WordPress * [X] Works with the block editor * [ ] Works with the classic editor * [X] Full CRUD support in the REST API and WP-CLI * [X] Full support in RSS feeds * [ ] Full support in Atom feeds * [X] Fine-grained user permission controls _Features without a checkmark are still work in progress._ ## Installation ### For normal use composer require humanmade/authorship ### For development use * Clone this repo into your plugins directory * Ensure you have Composer v2 and Node v24 installed * Install the dependencies: `composer install && npm install` * Start the dev server: `npm run start` ## Design Decisions Why another multi-author plugin? What about Co-Authors Plus or Bylines or PublishPress Authors? Firstly, those plugins are great and have served us well over the years, however they all suffer from similar problems: * API: Lack of support for writing and reading author data via the REST API and WP-CLI * UI: Limited or custom UI that doesn't feel like a part of WordPress * Users: An unnecessary distinction between guest authors and actual WordPress users Let's look at these points in detail and explain how Authorship addresses them: ### API design decisions There's a lot more to a modern WordPress site than just its theme. Data gets written to and read from its APIs, so these need to be treated as first-class citizens when working with the attributed authors of posts. Authorship provides: * Ability to read and write attributed authors via an `authorship` field on the `wp/v2/posts` REST API endpoints * Ability to create guest authors via the `authorship/v1/users` REST API endpoint * Read-only access to users who can be attributed to a post via the `authorship/v1/users` REST API endpoint * Ability to specify attributed authors when creating or updating posts via WP-CLI with the `--authorship` flag ### UI design decisions We'd love it if you activated Authorship and then forgot that its features are provided by a plugin. The UI provides convenient functionality without looking out of place, both in the block editor and the classic editor. ### User design decisions Existing plugins that provide guest author functionality make a distinction between a guest author and a real WordPress user. A guest author exists only as a taxonomy term, which complicates the UX and creates inconsistencies and duplication in the data. Authorship creates a real WordPress user account for each guest author, which provides several advantages: * No custom administration screens for managing guest authors separately from regular users * Plugins that customise user profiles work for guest authors too * Consistent data structure - you only ever deal with `WP_User` objects * No need to keep data in sync between a user and their "author" profile * Promoting a guest author to a functional user is done just by changing their user role ## Template Functions The following template functions are available for use in your theme to fetch the attributed author(s) of a post: * `\Authorship\get_author_names( $post )` - Returns a comma-separated list of the names of the attributed author(s) * `\Authorship\get_author_names_sentence( $post )` - Returns a sentence stating the names of the attributed author(s), localised to the current language * `\Authorship\get_author_names_list( $post )` - Returns an unordered HTML list of the names of the attributed author(s) * `\Authorship\get_authors( $post )` - Returns a list of user objects of the attributed authors * `\Authorship\get_author_ids( $post )` - Returns a list of user ids of the attributed authors ## REST API The following REST API endpoints and fields are available: ### `authorship/v1/users` endpoint This endpoint allows: * Searching all users who can be attributed to content * Creating guest authors ### `authorship` field This field is added to the endpoint for all supported post types (by default, ones which that have post type support for `author`), for example `wp/v2/posts`. This field is readable and writable and accepts and provides an array of IDs of users attributed to the post. In addition, user objects are embedded in the `_embedded['wp:authorship']` field in the response if `_embed` is set and the authenticated user can list users. ## WP-CLI Authorship implements a custom flag for use with posts, and migration commands. The following WP-CLI flags are available: - `--authorship` ### `--authorship` flag When creating or updating posts the `--authorship` flag can be used to specify the IDs of users attributed to the post. The flag accepts a comma-separated list of user IDs. Examples: * `wp post create --post_title="My New Post" --authorship=4,11` * `wp post update 220 --authorship=13` If this flag is *not* set: * When creating a new post, if the `--post_author` flag is set then it will be used for attributed authors * When updating an existing post, no change will be made to attributed authors ### Migration of WordPress authors on existing posts. If you activate Authorship on an existing site, all content already created will not have authorship data set for old content. This breaks things such as author archive pages. This command will set the WordPress author as the authorship user for any posts with no authorship user. (Optionally you can override any existing authorship data, updating it with the WordPress post author). ```sh wp authorship migrate wp-authors --dry-run=true ``` The command will perform a dry run by default, setting `--dry-run=false` will make changes to the database. This command will not overwrite or update Authorship data unless the `--overwrite-authors=true` flag is set. ### PublishPress Authors Migration Authorship provides a command for creating Authorship data using data from PublishPress Authors. This allows a non-destructive migration path from PublishPress Authors. With both plugins active, this command will copy PPA data into Authorship: ```sh wp authorship migrate ppa --dry-run=true ``` The command will perform a dry run by default, setting `--dry-run=false` will make changes to the database. Guest authors that do not exist as users will be created with blank emails and random passwords. This command will not overwrite or update Authorship data unless the `--overwrite-authors=true` flag is set. ## Email Notifications Authorship does not send any email notifications itself, but it does instruct WordPress core to additionally send its emails to attributed authors when appropriate. * When a comment on a post is held for moderation, the comment moderation email also gets sent to all attributed authors who have the ability to moderate the comment and have a valid email address * When a comment on a post is published, the comment notification email also gets sent to all attributed authors who have a valid email address This plugin only adjusts the list of email addresses to which these emails get sent. If you want to disable these emails entirely, see the "Email me whenever" section of the Settings -> Discussion screen in WordPress. ## Accessibility Authorship aims to conform to Web Content Accessibility Guidelines (WCAG) 2.1 at level AA but it does not yet fully achieve this. If full support for assistive technology is a requirement of your organisation then Authorship may not be a good fit in its current state. With regard to the author selection control on the post editing screen: * ✅ The visual styles are inherited from WordPress core and are WCAG 2.1 AA compliant * ✅ The control is fully accessible using only the keyboard * 🚫 The keyboard controls are not very intuitive * 🚫 The control is not fully accessible when using a screen reader The team are actively investigating either replacing the component used to render the control with a fully accessible one, or fixing the accessibility issues of the current one. ## Security, Privileges, and Privacy Great care has been taken to ensure Authorship makes no changes to the user capabilities required to edit content or view sensitive user data on your site. What it *does* do is: * Grant users who are attributed to a post the ability to edit that post if their capabilities allow it * Grant users the ability to create and assign guest authors to a post * Allow this behaviour to be changed at a granular level with custom capabilities ### Assigning Attribution The capability required to change the attribution of a post matches that which is required by WordPress core to change the post author. This means a user needs the `edit_others_post` capability for the post type. The result is no change in behaviour from WordPress core with regard to being able to attribute a post to another user. * Administrators and Editors can change the attributed authors of a post * Authors and Contributors cannot change the attributed authors and see a read-only list when editing a post Authorship allows the attribution to be changed for any post type that has post type support for `author`, which by default is Posts and Pages. ### Editing Posts When a user is attributed to a post, that user becomes able to manage that post according to their capabilities as if they were the post author. This means: * A post that is attributed to a user with a role of Author can be edited, published, and deleted by that user * A post that is attributed to a user with a role of Contributor can be edited by that user while in draft, but cannot be not published, and cannot be edited once published From a practical point of view this feature only affects users with a role of Author or Contributor. Administrators and Editors can edit other users' posts by default and therefore edit, publish, and delete posts regardless of whether they are attributed to it. ### Searching Users The `authorship/v1/users` REST API endpoint provides a means of searching users on the site in order to attribute them to a post. Access to this endpoint is granted to all users who have the capability to change the attributed authors of the given post type, which means Editors and Administrators by default. The result is no change in behaviour from WordPress core with regard to being able to search users. In addition, this endpoint has been designed to expose minimal information about users, for example it does not expose email addresses or capabilities. This allows lower level users such as users with a role of Author to be granted the ability to attribute users to a post without unnecessarily exposing sensitive information about other users. ### Creating Guest Authors The `authorship/v1/users` REST API endpoint provides a means of creating guest authors that can subsequently be attributed to a post. Access to this endpoint is granted to all users who have the ability to edit others' posts, which means Editors and Administrators by default. More work is still to be done around the ability to subsequently edit guest authors, but it's worth noting that this is the one area where Authorship diverges from the default capabilities of WordPress core. It allows an Editor role user to create a new user account, which they usually cannot do. However it is tightly controlled: * An email address cannot be provided unless the user has the `create_users` capability, which only Administrators do * A user role cannot be provided, it is always set to Guest Author ### Capability Customisation The following custom user capabilities are used by Authorship. These can be granted to or denied from users or roles in order to adjust user access: * `attribute_post_type` - Used when attributing users to a given post type - Maps to the `edit_others_posts` capability of the post type by default * `create_guest_authors` - Used when creating a guest author - Maps to `edit_others_posts` by default ## Contributing Code contributions, feedback, and feature suggestions are very welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for more details. ## Team Authorship is developed and maintained by [Human Made](https://humanmade.com) and [Altis](https://www.altis-dxp.com). Its initial development was funded by [Siemens](https://www.siemens.com). <p align="center"> <a href="https://humanmade.com"><img src="assets/images/hm-logo.png" width="207" height="86" alt="Human Made"></a> <a href="https://www.altis-dxp.com"><img src="assets/images/altis-logo.png" width="207" height="86" alt="Altis DXP"></a> <a href="https://www.siemens.com"><img src="assets/images/siemens-logo.png" width="215" height="86" alt="Siemens"></a> </p> ## License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ## Alternatives If the Authorship plugin doesn't suit your needs, try these alternatives: * [PublishPress Authors](https://wordpress.org/plugins/publishpress-authors/) * [Co-Authors Plus](https://wordpress.org/plugins/co-authors-plus/) * [Guest Author](https://wordpress.org/plugins/guest-author/)

CMS & Blogging WordPress Themes & Plugins
68 Github Stars