Error message
Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home1/tylerfra/public_html/includes/common.inc).
Code
If you want to change the label for the body field on a node form in Drupal 6, you can do it through the Drupal UI or with a little custom code in your module.
Go to admin/content/types then click the 'edit' link next to your content type. Fill out the 'Body field label' text box and then hit 'Save'.
If you'd rather have the body field's label controlled by your module, then try something like this:
Here is how to get a count of users for each user role in a Drupal 6 or 7 site:
SELECT
COUNT(u.uid) AS user_count,
r.name AS role
FROM {users} u
INNER JOIN {users_roles} ur ON u.uid = ur.uid
INNER JOIN {role} r ON ur.rid = r.rid
GROUP BY r.name
ORDER BY user_count DESC;
(Note, this isn't the 'correct' way to do it in Drupal 7, we should really use the new Database API layer, but I'm lazy right now.)
This will give you a table something like this:
Here is how to retrieve a count of nodes for each content type in a Drupal 6 or 7 site:
SELECT
COUNT({node}.nid) AS node_count,
{node_type}.type
FROM {node}
INNER JOIN {node_type} ON {node}.type = {node_type}.type
GROUP BY {node_type}.type;
(Note, this isn't the 'correct' way to do this in Drupal 7, we should really use the new Database API Layer, but I'm lazy right now.)
This will give you a table something like this:
To provide a custom php variable that contains an html string to your custom node type's template file, use some code sauce similar to this...
(Scroll down to the bottom for a Drupal 7 example)
Drupal 6
First in your theme's template.php file, add this (replace my_theme with the machine name of your theme):
Here is how to send an e-mail with some custom code in your module and by utilizing hook_mail.
Add this example code snippet to your custom module where you would like to have an e-mail sent. For example, maybe you want to send an e-mail about a node when one of your module's forms are submitted.
Do you need to execute some custom code when a node's workflow state changes in Drupal? Yes? Ok.
In your custom module, implement hook_workflow provided by the Workflow module and try something like this:
To setup custom access control in Drupal 6, try something like this...
This example restricts access to everyone on a particular node type, unless the user belongs to a certain role or is the node author. Here is how I did it using hook_node_access_records and hook_node_grants in Drupal 6:
Download gource 0.37 (0.38 had too many dependencies that appear to be for Ubuntu 11+), extract its contents to your Desktop (or wherever you want), navigate to the directory where the files were extracted, then execute the following terminal commands (checkout the contents of the INSTALL file for more details):
UPDATE: Thanks to user comments, it turns out the easiest way to do this is with this command:
git add -u
Otherwise, feel free to read the example below for an alternative approach...
===============================
So today I was updating the filefield module in Drupal 6 with Drush (drush up webform), this worked great, as usual. However, my Drupal site is under source control with GIT. So after updating the module and running 'git status' I was presented with a whole bunch of changes. Something like this:
git status
Pages