Wednesday, November 26, 2008

Hiding a form fieldset in Drupal

I am working on a dating site. Because it's a dating site, I need sign-ups for it to work. Without members, I won't get sign-ups. My idea: give the first 50 people token gift cards in exchange for signing up and taking part. But, how do I prevent hundreds of people from cashing in on this deal? Here's one way:
  • I have node_profile in place (AWESOME module)
  • In the "profile" content-type, I put in a field group for the Incentives
  • In the Incentives, I have two fields. One is a select dropdown
  • In the dropdown, I added the code below to the "php code" in the field administration
  • When the code fires, it looks at the user id numbers in the sequences table. If the number is below a threshold, it will return the array of values. If the number is above, it will return an effectively empty array; it will also do a drupal_add_css() to load to add css to mask (display: none) the fieldset from public view. It doesn't entirely hide it, but it does keep it out of sight from casual users.

$max = db_fetch_object(db_query("SELECT id FROM {sequences} WHERE name = 'users_uid'"));

if ($max->id < 1111111163) {
return array(
'Starbucks' => 'Starbucks',
'Serious Coffee' => 'Serious Coffee',
'iTunes' => 'iTunes',
'EB Games' => 'EB Games'
);
}
else {
return array('n/a' => 'n/a');
drupal_add_css('themes/callme/no_incentive.css');
}

Monday, November 24, 2008

Chrome cannot run GMail

This is terrific. A few years ago, Google launched GMail to knock Hotmail and similar services off of the top of the freebie email heap. A couple months ago, they launched Chrome-- the Google spawned web browser. GMail has chat functions. After some recent tinkering, the chat functions do not work in Firefox. They also do not work with Google Chrome. How could the GMail people not do compatibility testing on their company's web browser? They don't even recognize or support Chrome.