Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Is the original shortcode working with do_shortcode() ? –  birgire Apr 4 '13 at 4:46
    
Yes it works with 'do_shortcode()'. I hope it can work both ways. In the theme and in the post editor. –  user8514 Apr 4 '13 at 17:57

1 Answer 1

up vote 0 down vote accepted

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);
share|improve this answer
    
That worked great! –  user8514 Apr 6 '13 at 1:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.