nwjames
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Document Revisions] Upload document error after update to 4.0.4As Ben Balter indicated, V5.1.0 has introduced a different method of loading the document (wp.media instead of async-upload and managing the document attachment_id within the post_content field entirely on the server. This means the binding process between the upload and plugin processing on the client side is essentially eliminated. It was this that was causing the problems you were seeing.
It would be useful to know if this is now resolved for you.
I believe that Ben was asking whether you were using the experimental document admin screen using Gutenberg (which uses wp.media) or the Classic screen (with async-upload) for document admin. With V5.1, as indicated both now use wp.media.
Again it would be useful to know your experience with V5.1.0
Regards,
Neil James
Forum: Plugins
In reply to: [WP Document Revisions] Validate Structure validate_guidForum: Plugins
In reply to: [WP Document Revisions] Validate Structure validate_guidThanks for raising this issue. I have also seen this construction.
I have created a Pull Request to the plugin author which includes this fix to the Validation process.
Regards,
Neil James
Thank you for raising this issue. Version 3.8.1 includes PHPStan as part of its process to improve its quality. The function
add_revision_num_to_titleis indeed defined as a filter tothe_titlesince its job is to modify the displayed title. Since the definition ofthe_titleparameter is to be an integer, the code says that we will ensure that it is an integer or null when it is called.You suggest that “Add type and value checks in
add_revision_num_to_title()to ensure$post_idis an integer before processing”. This is, of course, exactly what is happening. It is being done by PHP itself and before our processing starts. Some earlier process is callingthe_titleincorrectly.We can, and will, look to change our plugin to be more tolerant of other plugins passing incorrectly-typed and/or inappropriate parameters.
We do not determine where
the_titleis used within WordPress. I can understand that it could be a menu with a pointer to a page, for example. However, it would always be in the context of a post – and for this it uses an integer post_id. Passing a random string makes no sense.Since it is not the first parameter (which can change value as the various filter functions are called in turn), you could try looking further in the trace stack to find what code is calling
the_titlewith an erroneous value and raise an issue with them, be it WPML or another.Regards,
Neil James
Fixed by 4.0.5
If you read
/docs/block-editor.mdin the plugin, an experimental block-editor version is included in this version. It seems that this has had the effect of hiding the description (and also the revision summary box) in the classic version.If you are able to edit
/css/style.cssand change lines 18-19 to read#postdiv {and delete lines 51-53 starting#revision-summary {then they will reappear.Regards,
Neil
Forum: Plugins
In reply to: [WP Document Revisions] WP Document Revisions Intallation FailureWordPress is a Content Management System. So by storing Documents, it is a Document Management System.
You load the Document using the interface, and also possibly adding a description and/or image.
More importantly, you can use the taxonomy capabilities to group and link the different documents together. Now this is a little more difficult to understand if you are new to WordPress. This is made a little more difficult because the plugin will automatically use these, but the plugin itself contains no specific code itself.
We suggest that you load a custom taxonomy plugin to create these for your requirement – and the Readme file contains one.
Users have, for example, raised issues about “Why don’t you store the documents in named folders”. The WordPress way is to assign different terms within a taxonomy which is the logical equivalent of creating a folder. More than that, you can have the one document appearing several times – if you assign several terms to it.
Regarding the File Hosting part, by loading a document on the WordPress site, you are making it potentially available to everyone. When you load a document, then it is initially loaded as a Private Document, As such it is only available to a limited set of users. Once it is published it becomes available to everyone.
You can see how these concepts work in WordPress using YouTube or Google. This plugin just makes use of the standard WordPress functionality.
I will mark this support request as closed. If you have other specific support questions, please raise them as new queries.
Hope this is useful,
Neil James
Forum: Plugins
In reply to: [WP Document Revisions] WP Document Revisions Intallation FailureThe plugin has been successfully installed.
However there is an issue with your configuration which may lead you to think that it has not been installed properly.
I also had the same issue, and took some time to track it down, so I put this message into the plugin (in Version 3.2.4) which explains the problem.
When the plugin is activated, generally by someone with the Administrator role, the user should see a menu item labelled Documents.
It will put it there if the user has edit_documents capability. The plugin sets the edit_documents capability to True for roles administrator, editor, author and contributor; and to False for every other role.
You get the message at activation because your user is in one of these cases:
a) Does not have the role administrator, editor, author or contributor role assigned to them;
b) Has one of these, but also has ANOTHER role assigned to them.Why? Because a False value will not allow you to access the functionality evnn if there is also a True value.
You need to review the roles assigned and ensure they are as you need.
Neil James
Forum: Plugins
In reply to: [WP Document Revisions] Change URL structure on networkI do apologise for misleading you on the year/month settings. When I implemented that a while ago, it seems that I did not implement it for the multisite case (that I don’t use).
Different code is required for the multisite case. I will propose the necessary change.
Meanwhile, as you have done, this can be addressed in the filter.
Thank you for raising this and giving the feedback.
Neil James
Forum: Plugins
In reply to: [WP Document Revisions] Change URL structure on networkYou have two requirements to change the permalink:
- Remove the year/month element. This is available with the plugin. It’s the last option in the
Settings -> Media -> Uploading Filesand is calledDocument Date in Permalink. Tick it to remove the date element. Note that this is independent of whether the file is stored in a year/month folder. - Remove the extension. You will require some trivial code to do this. Use the filter
document_permalinkto remove it (and the period) from the generated permalink.
Note that the delivered rewrite rules support your required format. That is, take a currently valid permalink and remove the date and extension elements and you can use that link to retrieve your document even now.
Hope this is of use,
Neil James
Forum: Plugins
In reply to: [WP Document Revisions] Post-Migration BreakageSome time has passed and it appears that the site is working now so I will mark this as resolved.
Regards,
Neil James
Forum: Plugins
In reply to: [WP Document Revisions] Post-Migration BreakageI hope that you have been able to resolve this already, but if not, given your statement that you can upload ordinary media, but get the message that you cannot write to the directory when you try to upload a document, then I would guess that you do not have the correct value for the document directory after the migration.
Please go to your Admin Settings -> Media page. There are a number of values contained in the section
Uploading Files.One of these will be labelled
Document Upload Directory. Please check that this is the correct value for your migrated site.Separately, you have questions about the year/month combination for being a) part of file location; and b) on the permalink.
These are completely independent and one has no impact on the other, though obviously they are related.
For the file location, this is determined by the option
Organise my uploads into month- and year-based folders. Your uploads (both Media and Documents will use sub-directories or not. If used, the file will be stored there and the attachment postmeta will contain the sub-directory name. That’s it.For the permalink, the year and month are used as part of the search criteria to find the document post record to be displayed. Arguably since the unique defining criteria is the post name, and the year/month can only serve to NOT find the record when given as all conditions need to be met for the record to be found. In fact there was a bug related to this. This was one of my motivations to propose the option Document Date in Permalink in version 3.5 that removes the year/month from the permalink.
As a final thought, strictly the year/month on the permalink is that of the Document record and the year/month of the uploaded Attachment record. If they are uploaded around midnight on the 1st of the month, they can validly have different values.
Hope this helps and clarifies,
Neil James
Forum: Plugins
In reply to: [WP Document Revisions] Revision log disappeared after WP upgradeI’m sorry to hear this. I too have had this problem when I started with this plugin. Luckily there were not many documents so I lost the revisions and put it down to experience.
It seems that the database optimisers (i.e. revision deleters) are of two basic types:
a) Those that query the SQL database directly and delete the revisions using SQL.
These include yours and the one I use. I need to make manual changes to its source code with every release to avoid deleting document revisions.
b) Those that use the WordPress API. With these, since there are filters provided in WordPress core, it will be possible to review each delete revision request and decide whether to actually delete the revision or not.
This will not have helped you (sorry), but it will help those with plugins using the WordPress API.
I will propose some code to Ben to be included in the plugin shortly.
I’ll mark this as resolved.
Neil James
Forum: Plugins
In reply to: [Simple Taxonomy Refreshed] Custom Taxonomy missing from Media edit interfaceThank you. This is puzzling. I copied/pasted the export file and saved it as a php file into my mu-plugins directory and it worked fine for me, i.e. I could see the taxonomy in the Media menu, also on the individual images the taxonomy box appeared, though I needed to
Edit more detailsto add/modify the terms. I assume that this is standard functionality for the Media items.I was using my administrator id. I did wonder about capabilities, but changing these to non-existent values just stopped me entering or changing values. It still displayed a box for the allocated terms (even if empty).
I did try to load the Responsive theme – but made no difference. Not really a surprise as the Library is an admin screen rather than a front-end one.
Using the rest interface, it certainly thinks that
fe_authoris a valid taxonomy to be present: https://www.fifthestate.org/wp-json/wp/v2/media/35920 shows the taxonomy is linked (with no terms).I tried asking Copilot and it suggested (other than permissions) a plugin conflict. Running
wp-accessibilitygave the Decorative checkbox just after thefe_authorsbox , so no apparent conflict with that plug-in.I am at a bit of a loss to think where the issue is coming from, I’m sorry to say. I’ll revert if I can think of anything else.
Neil James
- Remove the year/month element. This is available with the plugin. It’s the last option in the