0

How would I put this together.

For plugin Contact Form 7 Data Base how would I add in the "Submitted Login" (user display name) to the search="name"

Original Shortcode

[cfdb-table form="Contact form 1" show="Submitted Login,your-email,your-message" search="AndrewA"]

Tried to put this together a few ways, none worked.

<?php echo do_shortcode('[cfdb-table form="Contact form 1" show="Submitted Login,your-email,your-message" search="' . $current_user->display_name .'"]');?>

This is so users can see their contact form data they have submitted.

Thanks for any help.

2
  • Is the original shortcode working with do_shortcode() ? Commented Apr 4, 2013 at 4:46
  • Yes it works with 'do_shortcode()'. I hope it can work both ways. In the theme and in the post editor. Commented Apr 4, 2013 at 17:57

1 Answer 1

0

If this works for you in the template:

$s='[cfdb-table form="Contact form 1" show="Submitted Login,your-email,your-message" search="AndrewA"]';
echo do_shortcode($s);

then you could try:

global $current_user;
get_currentuserinfo();
$s = sprintf('[cfdb-table form="Contact form 1" show="Submitted Login,your-email,your-message" search="%s"]',$current_user->display_name); 
echo do_shortcode($s);
1
  • That worked great! Commented Apr 6, 2013 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.