Hello Folks,
Great module thanks. I have an additional requirement that has come up after the fact which I've detailed on stackexchange here:
https://drupal.stackexchange.com/questions/146520/restrict-node-view-to-users-by-registration-date
In short I'm trying to:
- Restrict view access to certain custom node types by the date the user registered
- The user would be able to see restricted content created in the month they registered and any future month while their user account is active, but nothing before the date the account was created
- There is existing content restrictions and functionality for the same users on the same content. Only certain roles can see selected node types and this is selected when the user is created (manually). This is managed by nodeaccess
I used the suggested code from a kind helper there but it's not working for me. I created an enabeld a custom moduel with the following:
<?php
function node_access_byregdate($node, $op, $account) {
$type = is_string($node) ? $node : $node->type;
if ($op == 'view') {
global $user; // get current user
// check user register date
if ($user->created < $node->created) {
return NODE_ACCESS_DENY;
}
}
// Returning nothing from this function would have the same effect.
return NODE_ACCESS_IGNORE;
}
Any assitance would be greatly appreicated. Thanks in advance.
Comments
Comment #1
d.fisher commentedDrupal 7 security support has ended as of 5 January 2025.
We are doing some housekeeping on the nodeaccess issue queue and moving all Drupal 7 issues to "postponed (maintainer needs more info)". See https://www.drupal.org/project/nodeaccess/issues/3516593.
If this issue persists on the latest dev branch of nodeaccess (2.0.x-dev) then please feel free to comment and we will change the version against this issue. If we do not hear any feedback within 2 weeks (9th October 2025) we will go ahead and close this issue as outdated.
Thank you.
Comment #2
d.fisher commentedAs per the above, as there has been no response we will now close this issue as outdated.
If this issue persists on the latest dev branch of nodeaccess (2.0.x-dev) then please feel free to update the version on this issue and reopen it.
Thank you.