Category Archives: PHP

Media Button in WYSIWYG Module

We're implementing the new WYSIWYG Module in Drupal 6, and really digging it.  We are using it with our WYSIWYG Editor of choice: TinyMCE (3.2.1.1). We noticed, however, as we were setting up the module in Drupal, that our beloved media button was gone. Here's how we got it back in there: First, you need…
Read more

Control Drupal Forum Access by Role

We are developing an online community with forums which need to be private (only accessed by the members of the community).  Unfortunately, the forum.module for drupal allows anyone with 'access content' privileges to access the forums.  Obviously, we want visitors to be able to view the pages and almost all other content, but we want…
Read more

Get the ID generated from the previous INSERT opereration

With the PHP function mysql_insert_id( ), you can obtain the previous index generated from an insert operation. The need for this capability came about when we were generating a MySQL database for invoice storage.  Our database contains an INVOICE table for customer billing information, and an INV_ITEM table for individual items that are included in…
Read more

PHP 4.3: Remove a specific key from an array

PHP 5+ provides the built-in function array_diff_key() which can be used to delete a certain key from an array.  Although I'm not proud of it, some of our customers' sites are still running versions prior to PHP 5.  This is how we delete a specific key from an array in PHP 4+ (4.3).  Let's say…
Read more