Title: [Plugin: Theme My Login] Adding code to login?action=register
Last modified: August 19, 2016

---

# [Plugin: Theme My Login] Adding code to login?action=register

 *  Resolved [Stylw](https://wordpress.org/support/users/stylw/)
 * (@stylw)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/)
 * Is there anyway I could add a text/javascript file to my _registration page **
   only? **_

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

 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703515)
 *     ```
       function tml_request_callback( &$theme_my_login ) {
           if ( 'register' == $theme_my_login->request_action )
               wp_enqueue_script( 'my-script', 'http://mysite.com/my-script.js' );
       }
       add_action( 'tml_request', 'tml_request_callback' );
       ```
   
 *  [NomNomNom](https://wordpress.org/support/users/nomnomnom/)
 * (@nomnomnom)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703704)
 * I need help with something like this, I want to add my cpalead advertiser code
   to the registration page.
 * <script type=’text/javascript’ src=’[http://www.cpalead.com/mygateway.php?pub=1111111&gateid=1111111′></script&gt](http://www.cpalead.com/mygateway.php?pub=1111111&gateid=1111111′></script&gt);
 * I attempted putting the code in the ‘[http://mysite.com/my-script.js&#8217](http://mysite.com/my-script.js&#8217);
   area but that didn’t work.
 * PS: This is supposed to be in theme-my-login/templates/register-form.php , right?
 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703705)
 * [@nomnomnom](https://wordpress.org/support/users/nomnomnom/): Create a file called
   _theme-my-login-custom.php_ in your plugins directory. Add it there. Replace _
   [http://mysite.com/my-script.js](http://mysite.com/my-script.js)_ with _[http://www.cpalead.com/mygateway.php?pub=1111111&gateid=1111111](http://www.cpalead.com/mygateway.php?pub=1111111&gateid=1111111)_.
 *  [NomNomNom](https://wordpress.org/support/users/nomnomnom/)
 * (@nomnomnom)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703706)
 * It doesn’t do anything, looking at the theme-my-login-custom.php page in the 
   wordpress plguin edtior says it’s ‘inactive’, pic below.
 * [IMG]http://i51.tinypic.com/t84t9v.png[/IMG]
 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703718)
 * It is included as the first line of code in theme-my-login.php.
 *  [NomNomNom](https://wordpress.org/support/users/nomnomnom/)
 * (@nomnomnom)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703733)
 * By ‘It doesn’t do anything’ I meant that the script doesn’t get inserted into
   the registration page.
 * Just to verify something, the theme-my-login-custom.php page should be in /wp-
   content/plugins/theme-my-login rather than /wp-content/plugins/?
 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703738)
 * It belongs in _wp-content/plugins_.
 * If it were to be placed in the TML directory, it would be lost upon upgrade, 
   therefore defeating the purpose.
 *  [NomNomNom](https://wordpress.org/support/users/nomnomnom/)
 * (@nomnomnom)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703779)
 * I put it in the wp-content/plugins directory amd it ending up locking the entire
   site with the script, it also seems to mess up the header.
 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703780)
 * It’s still not right.
 * First of all, the second parameter of wp_enqueue_script shold be just the script’s
   URL.
 * Also, you must use opening and closing PHP tags in the file, for without them,
   you are just outputting HTML.
 * Copy this EXACTLY into _theme-my-login-custom.php_:
 *     ```
       <?php
   
       function tml_request_callback( &$theme_my_login ) {
           if ( 'register' == $theme_my_login->request_action )
               wp_enqueue_script( 'cpalead', 'http://www.cpalead.com/mygateway.php?pub=34025&gateid=MTQxNDQ1' );
       }
       add_action( 'tml_request', 'tml_request_callback' );
   
       ?>
       ```
   
 *  [NomNomNom](https://wordpress.org/support/users/nomnomnom/)
 * (@nomnomnom)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703781)
 * Thanks, sorry about the trouble.

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

The topic ‘[Plugin: Theme My Login] Adding code to login?action=register’ is closed
to new replies.

 * ![](https://ps.w.org/theme-my-login/assets/icon-256x256.png?rev=1891232)
 * [Theme My Login](https://wordpress.org/plugins/theme-my-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/theme-my-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/theme-my-login/)
 * [Active Topics](https://wordpress.org/support/plugin/theme-my-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/theme-my-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/theme-my-login/reviews/)

 * 10 replies
 * 3 participants
 * Last reply from: [NomNomNom](https://wordpress.org/support/users/nomnomnom/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-theme-my-login-adding-code-to-loginactionregister/#post-1703781)
 * Status: resolved