tremotrem
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
you-profile-custom-field-name – name field in user profile.
In my case, i created a field with name ‘surname’ in BuddyPress extended profile fields (codex.buddypress.org/buddypress-components-and-features/extended-profiles). So ‘you-profile-custom-field-name’ in my case is ‘surname’.
By default ‘key’ => ‘company’, so if you do not specify key you get user company name, if such a field exists in BuddyPress extended profile.
Hi!
Insert to CF7 dynamic text ext. plugin source file (contact-form-7-dynamic-text-extension.php).
Then in contact form you can add shortcode “CF7_get_xpr_current_user key=’you-profile-custom-field-name'” for dynamic text field.
Sorry for my english.
For anyone else who is trying to achieve the same, this works:
function cf7_get_xpr_current_user($atts){ extract(shortcode_atts(array( 'key' => 'company', ), $atts)); $field = $key; global $current_user; get_currentuserinfo(); $user_id = $current_user->ID; $val = xprofile_get_field_data( $field, $user_id ); return $val; } add_shortcode('CF7_get_xpr_current_user', 'cf7_get_xpr_current_user');
Viewing 3 replies - 1 through 3 (of 3 total)