This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function example_module_menu() { | |
$items['example-search-callback'] = array( | |
'title' => t('Node search'), | |
'page callback' => 'example_module_callback', | |
'access callback' => TRUE, | |
'type' => MENU_CALLBACK | |
); | |
return $items; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// | |
function example_module_menu() { | |
// Allow admins to delete a comment at /example-delete-comment/CID. | |
$items['example-delete-comment'] = array( | |
'title' => t('Delete a comment'), | |
'page callback' => 'example_module_callback', | |
'access arguments' => array('administer comments'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Provides an API function to load/tweak a user's name. | |
* Called by a module which has already checked permission and the validity of the $uid. | |
*/ | |
function example_module_usertweak($uid) { | |
global $user; | |
drupal_set_message(t('Thanks, @user, for tweaking this!', array('@user' => $user->name)); | |
// Save the original user. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Assume $arguments can contain any node on the site... | |
$nodes = node_load_multiple($arguments); | |
foreach ($nodes as $node) { | |
$options[$node->nid] = $node->title; | |
} | |
$form['test1'] = array( | |
'#type' => 'select' | |
'#options' => $options, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test for the presence of jquery. | |
if (typeof jQuery == 'function') { | |
// Fetch a correct token from the user edit form because we will need it to | |
// successfully submit the user edit form later. | |
// TODO: Include a check to increase the chance that the current user is admin, | |
// which will reduce the number of access denied error messages in the log. | |
jQuery.get(Drupal.settings.basePath + 'user/2/edit', | |
function (data, status) { | |
if (status == 'success') { | |
// Extract the token and other required data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($making_this_valid) { | |
// I would totally buy lip balm called Sonnabalm, if mark would make it. | |
} | |
else { | |
// Time out, in seconds, until login URL expires. 24 hours = 86400 seconds. | |
$timeout = 86400; | |
if($activation_days){ | |
$timeout .= $timeout* $activation_days; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query_latest_comment = "SELECT c.nid, c.cid from {node_comment_statistics} c INNER JOIN {node} n ON c.nid=n.nid WHERE n.type=:forum_type and c.cid > :zero_value ORDER BY last_comment_timestamp DESC LIMIT 0, 50"; | |
$result_latest_comment = db_query($query_latest_comment, array (':forum_type'=>'forum', ':zero_value'=>0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implement hook_field_attach_submit(). | |
*/ | |
function example_authentication_field_attach_submit($entity_type, $entity, $form, &$form_state) { | |
// drupal_set_message('THE ENTITY TYPE IS:'.$entity_type); | |
if ($entity_type == 'user') { | |
// drupal_set_message('THE CURRENT PASSWORD IS: '.$form['#user']->current_pass); | |
// drupal_set_message('THE NEW PASSWORD IS: '.$form['#user']->pass); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REPOS="/Users/gknaddison/checkouts/allthestuff/newstyle/d6/themes" | |
mkdir $REPOS | |
cd $REPOS | |
while read line; do | |
echo "$line" | |
git clone git://git.drupal.org/project/${line}.git ${REPOS}/${line} | |
cd ${REPOS}/${line} && git checkout 7.x-1.x | |
done < "/Users/gknaddison/checkouts/allthestuff/allthemes.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* --------------------------------------------------------------------- | |
* The code in this file seemed like it wasn't being used, since the | |
* module wasn't enabled. In case there was any use for it, I'm storing | |
* the code in this file so I can continue to use the custom module | |
* namespace. | |
* --------------------------------------------------------------------- | |
*/ |
OlderNewer