Title: Automatically insert username
Last modified: August 22, 2016

---

# Automatically insert username

 *  [rhowal](https://wordpress.org/support/users/rhowal/)
 * (@rhowal)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/automatically-insert-username/)
 * Hello,
    Please let me know how to configure fep-class.php so that it will automatically
   fill in the “username” in the “To” field on the “Create New Message” form, so
   that the person sending the message does not need to type in the “username” (
   name of recipient)? I seen this posted by someone else but what was posted didn’t
   work for me. I have the latest version of WordPress with the latest version of
   the ClassiPress plugin. Please help me with this and be clear about exactly what
   I need to do as I am a beginner. Your help will be very much appreciated. My 
   new site is [http://www.okeechobeebartering.com](http://www.okeechobeebartering.com).
   Thank you. [rhowal2014@gmail.com](https://wordpress.org/support/topic/automatically-insert-username/rhowal2014@gmail.com?output_format=md)
   Rhonda
 * [https://wordpress.org/plugins/front-end-pm/](https://wordpress.org/plugins/front-end-pm/)

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

 *  [MCloney](https://wordpress.org/support/users/mcloney/)
 * (@mcloney)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/automatically-insert-username/#post-5273675)
 * I am also interested in this answer.
 * Thanks!
 *  [monolithdoes](https://wordpress.org/support/users/monolithdoes/)
 * (@monolithdoes)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/automatically-insert-username/#post-5273684)
 * I was able to do this by linking to the send message page and using a querystring
   variable, then grabbing that variable with php/jquery, and placing it in the 
   to box…
 * so on fep-class.php, around line 507 i put:
 *     ```
       <?php
                  $user = htmlspecialchars($_GET['user']);
               ?>
                 <script>
                 $(window).load(function(){
                   $('#search-q').val('<?php echo $user ?>');
                 });
                 </script>
       ```
   
 * To make sure this works correctly you have to be linking to the send message 
   page with a querystring variable. Your send message page may not be the same 
   as mine but something along the lines of.
 *     ```
       <?php
             $user_ID = 1;
             //There are many ways to get the user object, this is just an example
             $user = get_user_by('id', $user_ID);
             $user_to_message = $user->username;
       ?>
       <a href="<?php echo home_url(); ?>/messages/?fepaction=newmessage&user=<?php echo $user_to_message; ?>" Send Message </a>
       ```
   
 *  Plugin Author [Shamim Hasan](https://wordpress.org/support/users/shamim51/)
 * (@shamim51)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/automatically-insert-username/#post-5273697)
 *     ```
       <a href="<?php echo home_url(); ?>/messages/?fepaction=newmessage&to=user_login; ?>
       ```
   
 * pass user login somehow. to field will fill automatically from this user login
   value

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

The topic ‘Automatically insert username’ is closed to new replies.

 * ![](https://ps.w.org/front-end-pm/assets/icon-256x256.gif?rev=2309447)
 * [Front End PM](https://wordpress.org/plugins/front-end-pm/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/front-end-pm/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/front-end-pm/)
 * [Active Topics](https://wordpress.org/support/plugin/front-end-pm/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/front-end-pm/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/front-end-pm/reviews/)

 * 3 replies
 * 4 participants
 * Last reply from: [Shamim Hasan](https://wordpress.org/support/users/shamim51/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/automatically-insert-username/#post-5273697)
 * Status: not resolved