Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Reports 404 on unpublished pages.
403 to 404 is a simple module that emits a 404 error when a user tries to access a unpublished pages.
Sandbox:
https://www.drupal.org/sandbox/jagadeeshkony/2644342
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/jagadeeshkony/2644342.git unpublished_404
cd unpublished_404
Comments
Comment #2
atul4drupal CreditAttribution: atul4drupal commentedHello jagadeeshramuj,
A few suggestion to make your project page more standard:
Correct your Git Clone URL to :- git clone --branch 7.x-1.x http://git.drupal.org/sandbox/jagadeeshkony/2644342.git Unpublished_404
Comment #3
PA robot CreditAttribution: PA robot commentedProject 1: https://www.drupal.org/node/2645832
Project 2: https://www.drupal.org/node/2607944
As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).
If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
PA robot CreditAttribution: PA robot commentedFixed the git clone URL in the issue summary for non-maintainer users.
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #5
shabirahmad CreditAttribution: shabirahmad as a volunteer commentedAutomated Review
No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
http://pareview.sh/pareview/httpgitdrupalorgsandboxjagadeeshkony2644342git
Manual Review
Your hooks doxygen are missing the param directives. Its not important but it is encouraged to use. It will make your hook easily comprehend.
Comment #6
tobias.streefkerk CreditAttribution: tobias.streefkerk commentedHello jagadeeshramuj,
I took a look at your code and found the following issues:
- In the comment for your first hook you list hook_view_node_alter(), this should be hook_node_view_alter()
- Your code checks for an anonymous user (uid = 0). When the user is not anonymous, for say, an authenticated user, this would not work.
If you might ever want to port this module for Drupal 8, take a closer look at drupal_not_found().
Cheers!
Comment #7
tobias.streefkerk CreditAttribution: tobias.streefkerk commentedComment #8
klausiThat sounds like useful improvements, but surely not application blockers. Anything else that you found or should this be RTBC instead?
Comment #9
tobias.streefkerk CreditAttribution: tobias.streefkerk commentedNothing that are application blockers. I did find some other things when I looked at the code again:
- Hook node view access only works when viewing the full node. It does not prevent the rendering of menu items or anything of the like.
This is not a major issue because it should return 403 anyways, but I personally don't think that it can be left merely to the luck of the toss.
- I also don't really understand the flow of your module.. In your node hook_node_access you give a user permission to view a node and then call node_view_alter to give a 404.. So does that mean an anonymous user always gets the rights to view nodes?
I'll leave it up to klausi to change the status if desired, as he was right the first time and none of the above are application blockers.
Comment #10
namit.garg CreditAttribution: namit.garg as a volunteer and commentedHi I have 2 issues
1>In the info file Please add Description which is more appropriate to working of module
2>.module file line 40 if ($node->status == NODE_NOT_PUBLISHED && $user->uid == 0)
This will work only for anonymous user.My site also has authenticated users which should see 404 errors instead of this you can use hook_permission() so that admin can select which user roles will get 403 error and which will get 404 errors.
Comment #11
pankajsachdeva CreditAttribution: pankajsachdeva at QED42 commentedManual Review
I think that code is not long enough to review. It just contains 34 lines of code.
Comment #12
pankajsachdeva CreditAttribution: pankajsachdeva at QED42 commentedComment #13
klausiShort modules are perfectly fine, we just can't give the git vetted user role away for them. Anything else that you found or should this be RTBC instead?
Comment #14
pankajsachdeva CreditAttribution: pankajsachdeva at QED42 commentedI think, there is no other problem with it. I am marking it as RTBC.
Comment #15
pankajsachdeva CreditAttribution: pankajsachdeva at QED42 commentedComment #16
mlncn CreditAttribution: mlncn at Agaric commentedThanks for your contribution! Giving you vetted Git user status based on this and the other three projects you've contributed to. You can promote this to a full project.
When you create new projects (typically as a sandbox to start) you can then promote them to a full project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.