Title: New Default
Last modified: March 6, 2021

---

# New Default

 *  Resolved [tequenikality](https://wordpress.org/support/users/tequenikality/)
 * (@tequenikality)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/new-default/)
 * Hey everyone;
 * I have a fairly niche application for CF7, and I’d like to enquire if there’s
   any way to default a form’s message to the Biographic info on the user’s profile?
   I have a site-specific plugin that I can add code to if that’s needed, but to
   be frank I wouldn’t know where to start – I’ve not been developing WordPress 
   sites for very long and I’ve barely even scratched the surface of developing 
   plugins.
 * Any help you can offer would be appreciated.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fnew-default%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [tequenikality](https://wordpress.org/support/users/tequenikality/)
 * (@tequenikality)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/new-default/#post-14144609)
 * After over 8 hours of research and trial-and-error, I’ve devised a pseudo-way
   of achieving this:
 *     ```
       add_filter( 'shortcode_atts_wpcf7', 'custom_shortcode_atts_wpcf7_filter', 10, 3 );
       function custom_shortcode_atts_wpcf7_filter( $out, $pairs, $atts ) {
               $my_attr = 'your-message';
               $user_id = get_current_user_id();
               if ( isset( $atts[$my_attr] ) and $user_id != 0 ) {
                       $description = get_user_meta( $user_id , 'description', true );
                       $out[$my_attr] = $description;
               } 
               return $out;
       }
       ```
   
 * This filter allows me to set the default from the user’s bio (description), as
   long as I add the attribute to the shortcode and set the form’s field to default
   to it.
 * In this snippet, it doesn’t matter what the attr ‘your-message’ is set to in 
   the shortcode – in the form, it will default to the user’s description regardless
   of the attribute’s content, as long as the attribute **is** set.
 * If you want to adapt this code to your own form, change $my_attr to the name 
   of the field you want to default, add `default:shortcode_attr` to the field in
   the form editor and add whatever you set $my_attr to into the end of the shortcode
   on your page.
 * Hope someone else finds this useful to justify my 8+ hours of suffering 😆

Viewing 1 replies (of 1 total)

The topic ‘New Default’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [tequenikality](https://wordpress.org/support/users/tequenikality/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/new-default/#post-14144609)
 * Status: resolved