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).
planet drupal
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:
Here are a few helpful MySQL queries to retrieve file usage in Drupal (perhaps via IMCE or other file management module).
Total File Space Used by a Particular User
select SUM(filesize) as total_space from {files} where uid = 123;
Total File Space Used by a Particular Directory
select sum(filesize) as total_size from {files} where filepath like '%files\/my_sub_dir\/my_other_sub_dir%';
Here is how you can make a backup copy of your Drupal's MySQL database from a terminal:
mysqldump -u my_drupal_mysql_uer_name -p my_drupal_mysql_database_name > ~/my_drupal_sql_dump.sql
I like to clear all of Drupal's caches before running the dump so there isn't a bunch of cache data in the export.
If you'd prefer to use Drush, check out this article instead: Use Drush to Export/Import a Drupal MySQL Database Dump File
Pages