Textpattern hack : notepad
09 November 2004 @ really damn late | Comments (10)
*Update* 27 Mar 2005 -› This feature is now available as a plugin (>1.0RC3)
NOTE -› Modifications are for 1.0RC1 & 1.0RC2 (_but should still work on older versions with slight line number differences_). This hack/extension will add a ‘Notepad’ top-level tab to your admin interface and two subtabs (public/private). Every user — regardless of permissions level — has access to edit/view the public notepad. Each user also respectively has their own individual private notepad.
After some discussion on the Textpattern forum regarding the need for a notepad in the Textpattern admin interface, I decided to get a-hackin’.

- Notepad (parent tab)
- Public (subtab, all users)
- Private (subtab, user-specific)
Currently the status of this hack is tentative. Most likely there are improvements that can be made, mainly with the database table structure and its corresponding queries.
What’s Needed
There are 4 simple steps (_in order from easiest to hardest_):
- Upload:
- Edits(1):
/textpattern/lang/en-gb.txt - Edits(4):
/textpattern/lib/txplib_head.php - Add a table to your TXP database (txp_note_setup.php OR txp_note.sql)
Getting Started
Download txp_notepublic.php & txp_noteprivate.php and place the file in /textpattern/include/ with all the other txp_xxxx.php files. No other modification is needed for this step.
ADD (3 lines) /textpattern/lang/en-gb.txt -> line#347
tab_notepad => notepadtab_notepublic => publictab_noteprivate => private
ADD (1 line) /textpattern/lib/txplib_head.php -> line#19
$ntabs = array('notepublic','noteprivate');
ADD (1 line) /textpattern/lib/txplib_head.php -> line#23
elseif(in_array($event,$ntabs)) { $area = 'note'; }
ADD (1 line) /textpattern/lib/txplib_head.php -> line#70
areatab(gTxt('tab_notepad'), 'notepad', 'notepublic', $area),
ADD (4 lines) /textpattern/lib/txplib_head.php -> line#143
$areas['note'] = array(gTxt('tab_notepublic') => 'notepublic',gTxt('tab_noteprivate') => 'noteprivate');
Database
The final step involves adding the table txp_note to your database. This can be done one of two ways. You can either load the table directly into mySQL via the SQL dump txp_note.sql, or you can place the file txp_note_setup.php in your Textpattern directory and load it via your web browser (_the latter method is still a bit awkward because there is no confirmation screen to tell you if it’s worked_).
If any part of this is unclear, please leave notes in the comments or in the TXP forum. This modification may seem daunting at first, but I assure you it’s not all that hard. With SVN it’s even easier.
10 comments