Download & Extend

How to trim unwanted characters off a node variable?

Project:Content Templates (Contemplate)
Version:5.x-1.8
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hello - I'm aware that version 5 is unsupported but I work on an old Drupal 5 site and need some help with a bit of PHP to customise the output of a node variable. The variable ($node->name) shows the node author, but some author names are hashed and display like this: smith_fshdu34hfi83499huwuioijsafjj0398 - all I need to do is output ($node->name) with all the characters starting from the underscore removed. I've found this article on php.net which has various recipes but I'm not much good at PHP and can't work out how to adapt these to do this. Any help appreciated! :-)

nobody click here