Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
I want to get $user->uid (if authenticated user popped it up) from the
window, popped up by drupal site (not drupal window) *without*
transferring uid as parameter. Is it possible, and if it is, so how?
Dear friends, I need to provide "remember me" checkbox for anonymous users so that they don't need to fill in their contact information again and again. I quickly developed the following module:
/**
* Implementation of hook_comment().
*/
function remember_me_comment($comment, $op) {
if (($op == 'update') || ($op == 'insert')) {
if ($comment['remember_me']) {
// store user information into SESSION array
}
else {
unset($_SESSION['comment_anon']);
}
}
}
/**
* Implementation of hook_form_alter().
*/
function remember_me_form_alter($form_id, &$form) {
if ($form_id == 'comment_form') {
if (!$GLOBALS['user']->uid) {
$form['remember_me'] = array(
'#type' => 'checkbox',
'#title' => t('Remember me'),
'#default_value' => 1,
'#weight' => -20
);
}
if (isset($_SESSION['comment_anon'])) {
$form['name']['#default_value'] = $_SESSION['comment_anon']['name'];
//etc.
}
}
}
Should work but when the cache is enabled, even completely another anonymous user can see these saved settings because they will be brought from cache rather from SESSION array. This is very unpleasant and even dangerous because e-mail can be considered confidential information.
Don't you know how to solve this issue? "Remember me" is very important usability feature...
I'm trying to get it so that when a user registers, they get taken to someplace other than the home page. This is a temporary thing, so I'm just hacking /includes/form.inc on line 196, just before the return to the drupal_submit_form() function. for now I've jsut hardcoded a
$goto = (empty($goto)) ? "forum" : $goto;
That works fine, but I would prefer to do it without a hack, but I'm just not seeing how to do it. Any suggestions?
I've been working with Drupal for about a month or so now and have finished up my first module. It's a file browser module I developed for an industry trade site to manage a massive amount of downloadable assets. I have it up an running at http://jamieruderman.com if you'd like to try it or download the code. I just wanted to share and see if anyone thought that it would be suitable for mass consumption? I just applied for a CVS account...
I've built a custom node-type module that works fine. Now I want to have a page that offers a custom search of those nodes with nicely paged results. The API docs are wonderfully written, and have gotten me this far: I know how to create the custom search form page (with a function), make it visible ('hook_menu'), validate the results ('hook_validate'), and even make last-minute adjustments ('hook_submit'). But what happens from there? I know how to write the SQL query based on the form values and handle the query results, but where do I put that code?