=== DOI Creator ===
Contributors: ghego1
Donate link: https://paypal.me/Gherardo
Tags: DOI, Digital Object Identifier, DataCite, ORCID, journal
Requires at least: 5.5
Tested up to: 7.1
Stable tag: 1.1.0
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Register DOIs on DataCite for posts, pages and custom content, with rich metadata: ORCID, journal, volume, issue, abstract, license.

== Description ==

DOI Creator registers a Digital Object Identifier (DOI) on DataCite for each content you publish, and stores it in the `doi` custom field of the content, so that your theme can show it.

= Features =

*   **Automatic registration** when a content is published, scheduled contents included. It can be turned off, to register DOIs only on request.
*   **Any content type**: posts, pages and custom post types.
*   **Your DOI format**: prefix plus a suffix pattern with placeholders ({year}, {month}, {issue}, {volume}, {counter}, {post_id}, {random}), with a live preview.
*   **Rich metadata**: resource type (journal article, preprint, report...), authors from [Co-Authors Plus](https://wordpress.org/plugins/co-authors-plus/) (guest authors included) with ORCID iD and affiliation (with ROR ID), journal title, ISSN, volume and issue, publication date, abstract from the excerpt, language (Polylang supported), subjects from tags or categories, Creative Commons license.
*   **Preview**: see the exact request DataCite would receive for any content, before registering anything.
*   **Test mode** with the DataCite test environment, and a **connection test** that checks credentials and prefix.
*   **Content list**: DOI column, filter by DOI status (with DOI, without DOI, failed) and a "Register DOI" bulk action, also for contents published before.
*   **DOI box in the editor**: see the DOI, register it now or update its metadata on DataCite.
*   **Reliable**: temporary errors (network, DataCite unavailable) are retried automatically; every registration, update and error is listed in the activity log.

= The DOI =

Each DOI is made of the DOI prefix set in the settings (optionally followed by a fixed part of the suffix) and of a suffix built from a pattern. The default pattern, `{year}-{issue}-{counter}`, gives DOIs such as 10.5438/0012/2021-1-2: the year, the issue number (from the periodicity of the journal) and a progressive number.

= The metadata =

With the "Enhanced" metadata profile DataCite receives: title, authors (with ORCID iD and affiliation when set in their profile), publisher, publication year and date, resource type, a description with journal, issue and year, and, when enabled, abstract, language, subjects, license and journal (title, ISSN, volume, issue).

The "Classic" profile sends exactly the metadata of version 1.0: generic "Text" type (`{ "ris": "RPRT", "bibtex": "article", "citeproc": "article-journal", "schemaOrg": "ScholarlyArticle", "resourceTypeGeneral": "Text" }`) and a description with journal, issue and year (e.g. "CoolJournal, 3 (2021)"). Sites configured with a version before 1.1 keep this profile until they change it.

Every DOI is registered with DataCite's technical "source" field set to `doi-creator-wp`. It is not part of the DOI metadata (it does not appear in citations or in the metadata XML), but it is public: it lets the author of this plugin count, from DataCite's public API, how many DOIs are registered with it.

= Coming soon =

Crossref, for journals and publishers that are Crossref members.

== Configuration ==

Open Settings > DOI creator. The Overview shows what is missing. You need:

*    DOI prefix: your DataCite prefix, optionally followed by a fixed part of the suffix (e.g. 10.5438 or 10.5438/0012).
*    DataCite credentials: the repository ID and password of DataCite Fabrica. They are stored in your database and are never shared with anyone other than DataCite.
*    Periodicity: how often an issue is published, used for the {issue} number.

Then use "Test connection" to check that the credentials can register DOIs with your prefix.

== Testing ==

Before registering real DOIs, we strongly recommend to check that everything works in test mode: turn on "Use the DataCite test environment" in the Connection section.

DOIs registered in test mode are visible only on [DataCite Fabrica Test](https://doi.test.datacite.org) and never resolve on doi.org. If your test credentials are different from your production credentials, enter them in the test credentials.

== Frequently Asked Questions ==

= Will updating from 1.0 change my DOIs? =

No. Sites configured with a previous version keep the same DOI format, the same metadata (Classic profile), the same date used for year and issue, and posts as the only content type, until you change these settings.

= Where do I enter the ORCID iD of an author? =

In the user profile (Users > Profile > DOI metadata), or in the page of a Co-Authors Plus guest author. If your site already stores ORCID iDs in another user field, set its meta key in Settings > DOI creator > Metadata.

= Can I register DOIs for contents published before installing the plugin? =

Yes: in the content list, filter by "Published without DOI", select the contents and use the "Register DOI" bulk action. Set "Date used for year and issue" to the publication date, so that older contents keep the year and issue in which they were published.

= A registration failed: what now? =

The DOI column and the DOI box show the error returned by DataCite, which is also listed in Settings > DOI creator > Activity and in the PHP error log. Temporary errors are retried automatically; after fixing the cause of other errors, use "Register DOI now" in the DOI box.

= For developers =

Filters: `doi_creator_work` (the metadata of a content), `doi_creator_datacite_attributes` (the DataCite attributes), `doi_creator_url` (the URL registered for a content), `doi_creator_agency` (the registration agency). Action: `doi_creator_registered` (after a DOI is registered).

== Privacy ==

This plugin only communicates with DataCite (api.datacite.org, or api.test.datacite.org in test mode), using your DataCite credentials, to check and register DOIs. It does not send any data to the plugin author or to any other service. See the [DataCite privacy policy](https://datacite.org/privacy-policy/).

== Supporting the project ==

If you find this plugin useful and you would like to contribute to its development, please consider [donating](https://paypal.me/Gherardo "Donate!").

== Feature requests and support ==

If you would like to see new features added to the plugin, send us your requests through the support forum of the plugin on WordPress.org, and please consider [donating](https://paypal.me/Gherardo "Donate!") to increase the time we can spend coding the plugin.

The plugin is provided as-is without any support. If you really need help, please consider [donating](https://paypal.me/Gherardo "Donate!") and making a support request. We'll do our best to help those who help us.

== Changelog ==

= 1.1.0 =
* New settings page, organized in sections: overview with statistics and setup checklist, connection, DOI format, content, metadata, activity.
* DOI suffix pattern with placeholders and live preview.
* DOIs for pages and custom post types.
* Enhanced metadata profile: resource type, publication date, typed descriptions. Optional abstract, language, subjects, license and journal (title, ISSN, volume, issue).
* ORCID iD, affiliation and ROR ID of the authors, for users and Co-Authors Plus guest authors. Guest authors are now read correctly.
* Content list: DOI column, filter by DOI status and "Register DOI" bulk action.
* DOI box in the editor: register now, update metadata on DataCite.
* Optional metadata update on DataCite when a content with a DOI is updated.
* Connection test, metadata preview and activity log.
* Temporary errors are retried automatically.
* The date used for year and issue can be the publication date of the content.
* Sites configured with a previous version keep exactly the same behaviour until they change the new settings.

= 1.0.4 =
* DOIs are registered with DataCite's technical "source" field set to `doi-creator-wp`, so that the number of DOIs registered with this plugin can be counted from DataCite's public API. No DOI metadata is changed and no data is sent anywhere else.

= 1.0.3 =
* Fix: DataCite rejected every new DOI (HTTP 422, "titles: Value at root is not an array"). Titles are now sent as a list, as required by the DataCite REST API.
* Fix: authors were read from global variables instead of the post being published, so DOIs could be skipped when posts were published by WP-Cron or other background processes.
* Fix: DOIs for posts published from the block editor are created after Co-Authors Plus has saved the authors.
* DataCite errors are now written to the PHP error log instead of being silently ignored.

== Upgrade Notice ==

= 1.1.0 =
New settings page and many new features. Your DOIs and metadata stay exactly as they are until you change the new settings.
