Title: Alter the wordpress registration function
Last modified: August 22, 2016

---

# Alter the wordpress registration function

 *  [Opariti](https://wordpress.org/support/users/opariti/)
 * (@opariti)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/alter-the-wordpress-registration-function/)
 * Hi,
    I would like to add a new function – write a log comment in an external 
   text file – to the existing registration function of my WP installation. I imagine
   that I have to implement a hook (what is the format that, I suppose, I have to
   include in functions.php), I appreciate your help. Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Opariti](https://wordpress.org/support/users/opariti/)
 * (@opariti)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/alter-the-wordpress-registration-function/#post-5597602)
 * I have implemented the following and included in the twentyforteen’s (the active
   theme) functions.php file:
 *     ```
       if ( ! function_exists( 'register_for_cmsa' ) ) :
       	function register_for_cmsa($user_id)	{
       	// write in an external file
               // writeLogWP($msg) is a function from an included file in index.php
               writeLogWP("A new user is: " . $user_id);
       	}
       	add_action('user_register', 'register_for_cmsa');
       endif;
       ```
   
 * But, the code is not accepted (page blank) when running WP under wp-admin section
   when I try to add a new user. The user is added but the page doesn’t return to
   the users list and I get nothing in the file where it is intended to write.
    
   I have tested the writeLogWP($msg) as a statement elsewhere inside the same functions.
   php file and the file is written when I go through the site side of WP (not the
   admn one).
 *  Thread Starter [Opariti](https://wordpress.org/support/users/opariti/)
 * (@opariti)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/alter-the-wordpress-registration-function/#post-5597643)
 * The solution, for anyone having the same issue is related to the fact that IN
   ADMIN OPERATIONS the file index.php is not accessed. Therefore, all initializations
   done there MUST BE REDONE next to the place we use them. In my case it was to
   include the file with the writeLogWP($msg) function in the functions.php itself

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Alter the wordpress registration function’ is closed to new replies.

## Tags

 * [hook](https://wordpress.org/support/topic-tag/hook/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [Opariti](https://wordpress.org/support/users/opariti/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/alter-the-wordpress-registration-function/#post-5597643)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
