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

hook_db_rewrite_sql - I don't know what I'm doing.

Hi, my site runs a Drupal 4.6 and I would like to make Notify work. It hasn't yet been ported to 4.6, so the original plan was to do it myself.

Of course, that ended dead in its tracks when I realised that I could not find anywhere the code idiom to port node_access_join_sql and node_access_where_sql to db_rewrite_sql if the former have parameters.

One example is in the function _notify_send() in the notify.inc file.

   // Fetch new comments
    $cresult = db_query('SELECT DISTINCT(c.cid), c.nid, c.subject, c.pid, u.name FROM {comments} c '. node_access_join_sql('c') .' INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = 0 AND c.timestamp > %d AND '. node_access_where_sql('view', 'na', $user->uid) .' ORDER BY c.nid, c.timestamp', $period);

I've managed to understand as far as:

#$cresult = db_query_range(db_rewrite_sql('SELECT c.cid, c.nid, c.subject, c.pid, u.name FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = 0 AND c.timestamp > %d /* AND '. node_access_where_sql('view', 'na', $user->uid) .'*/ ORDER BY c.nid, c.timestamp', 'c', 'cid'));

before realising that I don't know how to incorporate parameters in node_access_where_sql into the new scheme. The node_access_where_sql normally accepts $user->uid as NULL by default and according to the API, it seems that it checks that the user has permission to access the node (the doc doesn't actually say). How can you get the user parameter passed through? The API docs for db_rewrite_sql are pretty unhelpfun in this respect, and the Module Porting Guide does not provide any advice on how to handle the arguments. This is made more confusing by the fact that nowhere in the API documentation does the "private version" of node_access_where_sql is called with parameters. Do I have to write a comment_db_rewrite_sql hook implemenation or something?

attachement maximum filesize ?

Hi,

a little upload-module question:

I'm using drupal cvs to run a little website, mainly used as document storage.
Attaching .doc files and so on works really great, but now i'm trying to attach a rather large pdf file and it fails (with no error message).

I have checked administer->uploads and all is ok there
also /etc/php.ini is ok
and no php.ini in the drupal dir.

Anyone know of another place i should be looking ?
Please note that attaching works great, but the max filesize seems to be somewhere around 2MB

Contextlinks

Hello!

I set the directory of the Contextlinks module into the modules directory as it is advised by it's author but I've get this error:
"Call to undefined function: drupal_get_path() in modules/contextlinks/contextlinks.module on line 262"
What it is and how to solve this problem?

debugging with IDEs revisited

Does anyone use NuSphere's PHPEd to comfortably dubug modules in drupal? or any other IDEs? And if so how did you set it up?

Default taxonomy selection by user: workspace module?

I have messed with taxonomy_access and the workspace module and I've realized that I need a way to simplify the way my users interact with my rather complex taxonomy. Some users can only create content in certain categories, so I want to be able to have their "create node" page show only a list of terms they can apply to their content. Right now, everything is listed, making it a much longer list than the user needs to see. Any ideas? This seems to tie into the functionality or scope of the workspace module, even though it applies to node creation interfaces.

Collapsible side blocks

Hi,

I'm planning to use Drupal as a framework for an intranet, in this kind of setup I guess it'll end up with a lot of side blocks. So I started to code some javascript functions to make then collapsible.

The current approach runs a Javascript function on page load which parses the document and modifies all the blocks to attach a header to them, which when is clicked collaps/expands the block.
The state of the blocks is stored in a cookie, so if some block is collapsed it'll continue to be even on page change or reload.

Pages

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