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

Return help needed, php help

Hi,
This more has to do with a php question.
I edited a function, the profile_view function to be exact, but I want to let two variables get output.
They are:

return array(t('Images') => $images);

return $fields;

Ofcourse this doesn't work, since only the first return gets printed and then the fuction would stop. Combining the two has failed for me so far. Any suggestions?

Using POSTDATA with pager query (how do I do this?)

I'm currently working on a custom search function for a module I'm building. The problem I'm having is that I need to pass the $_POST[edit] information to the command line and I can't figure out how. The reason I need to do this is as follows:

Here is my logic.

Search form takes text field and checkmarks (author, title, contents). When submit is called it goes to the URL "/mymodule/search." When that URL is accessed it grabs the $_POST[edit] array and passes it to a search function which then queries the database and spits out results.... until I want to go to page 2.

Since my search functions are entirely internal when I click on page 2 of the pager I am told that there are no results. This is happening because the search function is being run, but no POSTDATA exists anymore.

So what I need is to figure out a way to get the post data into the URL right away.

here is the search form I have right now:

function mymodule_search_form {
  $form = form_textfield(t('Search String'), 'search_string', NULL, 70, 255);
  $form .= form_checkboxes(t('Search Options'), 'search_options', NULL, array(t('Author'), t('Title'), t('Contents'))). form_submit(t('Submit'));;  
  $output = form($form, 'post', url('mymodule/search/'));

return $output;

Is there a way for me to get the results from the text field and checkboxes into the $output? I'd prefer for the url in the output to be like this: url('mymodule/search/012/search_string'). (FYI, "012" is just a representation of the checkbox array. I can take care of converting it to a text string myself, so don't worry about explaining that one).

Gallery

Hi,
I'm trying to use drupal on my site www.web4cu.com/dblog with the 4.5.x version of drupal.
I installed gallery but after the installation process I had an error:
Fatal error: Call to undefined function: variable_get() in /home/web4cu/public_html/dblog/includes/common.inc on line 1906
I read something about similar error on the forum.
If the problem is that gallery is supported only on 4.1.x version, does anyone has ported the gallery module to work with the 4.5.x version?
Anyone can help me?

Faltering towards a taxonomy browser

So, this is my second week of PHP coding, and I'm getting alright. But I would appreciate a couple of starting tips for my first custom module hack...

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

Pages

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