I'm trying to do a simple PHP string replace and I'm not 100% sure if I've done this correctly. I've followed this guide to create a custom module which I have activated. Here's my code:

<?php
/**
* Function Description
* @param function_parameter
* @returns function output description
*/
function myfunctionlibone($type="page") {
	$nameTaken = str_replace ("This username is not available.", "This username is already taken.", "This username is not available.");
	Print $nameTaken;
}
function myfunctionlibtwo($show="list") {
// php function code
}

I'm using the 'Friendly Register' module and I want to replace the default feedback message. Does this code automatically run or on all pages or do I have to call

<?php myfunctionlibtwo("block"); ?>

If I do where should I place this piece of code?

Comments

tce’s picture

I think you're supposed to create a block and put the function call in there, with the php input filter turned on.

Have you tried using the string override module instead?

Jaypan’s picture

Here is an article on ways to change Drupal strings (including using the module tce mentioned): http://www.bluespark.com/blog/youre-doing-it-wrong-dont-hack-drupal-core...