Skip to content

Instantly share code, notes, and snippets.

View carwin's full-sized avatar
🍔
cheeseburger

Carwin Young carwin

🍔
cheeseburger
  • Missouri
View GitHub Profile
@carwin
carwin / weathergist.php
Created September 6, 2012 01:46
PHP: Use Yahoo's Weather API, cURL, and SimpleXML to get current weather conditions given a WOEID.
<?php
/*
* This gist utilizes Yahoo's Weather API to snag the current
* weather conditions for any country given it's WOEID.
*
* - by Carwin Young
*/
/* Set up some location WOEIDs */
$Cambodia = 1020985; /* Phnom Pneh */
@carwin
carwin / d7_webform_simplenews_conditional_subscription.php
Created September 6, 2012 01:39
Drupal 7: hook_webform_submission_presave() to subscribe a user to a Simplenews newsletter with a conditional component.
<?php
/*
* Implementation of hook_webform_submission_presave()
*
* For a particular Webform node, use the submitted
* value of a component to determine whether or not
* the submitter will be subscribed to a Simplenews
* newsletter.
*
* Subscribe the user to the Simplenews newsletter
@carwin
carwin / d6_uc_cart_form_alter.php
Created September 6, 2012 01:09
Drupal 6: Use hook_form_alter() to remove the "Remove" button on Ubercart's cart form
<?php
function modulename_form_alter(&$form, $form_state, $form_id) {
switch ( $form_id ) {
case 'uc_cart_view_form':
/*
* This is how you can remove the "remove"
* button for each item.
*/
foreach($form['items'] as $k => $v ) {
if(is_integer($k) && isset($v['remove'])) {