This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Difficulties with hook_node_grants()

Hi all,
I'm trying to write a module to grant access to public or private nodes to users, based on their roles.
I'm starting with node_access_example.module in drupal-contributions, but it is not working as expected.
I'm trying to undestand the logic, but I did not undestand what the hook_node_grants() should return.
these are the infor I found on drupaldocs.org:

All node access modules are queried using hook_node_grants() to assemble a list of "grant IDs" for the user. This list is compared against the table. If any row contains the node ID in question (or 0, which stands for "all nodes"), one of the grant IDs returned, and a value of TRUE for the operation in question, then access is granted. Note that this table is a list of grants; any matching row is sufficient to grant access to the node.

So, what should I return as grant IDs ?? Could you help me in understanding what to specify in hook_node_grants ?
Actually, in the module, the code is, but I can't undestand the logic of $grants array():

[?php

function node_access_security_node_grants($account, $op) {
$grants = array();
//print user_access('access private content', $account); exit;
if (user_access('access private content', $account)) {
$grants[] = 1;
}
else if (user_access('access content', $account)) {
$grants[] = 0;
}
//print_r($account->roles); exit;
return array('security' => $grants);

Error report Concerning FrontPage

I keep receiving this error from one of the modules. I've tried changing the settings ona couple of areas to try to determine which one but I guess I am too new to Drupal to figure it out.

I only get this one on the front page. Is it something that I have set wrong or a bug in an add-on module. I've installed most if not all modules testing and evaluating them. Maybe I got too carried away?? LOL

Account Expiration Module?

Is there a module that will allow the expiration of accounts? I'm looking at a paid subscitipn type of website and this would be helpful.

Thanks.

Mike

Created an access control module based on roles

I have written a module simply called access.module that meets the requirements written in this post.

I would like to upload it somewhere for others to try it out. I don't have any special access. What is the recommended approach?

I could obviously host it on my web site, but I would prefer to put it here somewhere.

Where is the front page created

I am developing a module that is controlling access to content. However, at the moment, despite having given what I think is access to a given node to the anonymous user the front page is empty (or at least it asks him to create the first admin account). I want to track down what is happening. Can anyone tell me in which module the contents of the front page are constructed

Thanks

Problem with displaying the user picture

Currently I'm trying to update the guestbook module for drupal 4.4 (http://drupal.org/node/7673) to 4.5.
Within the entries I want to display the user picture of registred users with an uploaded picture in their profile using the theme_user_picture($account) function.
Unfortunately this function returns nothing, although user pictures are enabled an the user has an uploaded picture.
What I'm doing wrong, or is there an other (better) way to display the picture?

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions