Title: mackans's Replies | WordPress.org

---

# mackans

  [  ](https://wordpress.org/support/users/mackans/)

 *   [Profile](https://wordpress.org/support/users/mackans/)
 *   [Topics Started](https://wordpress.org/support/users/mackans/topics/)
 *   [Replies Created](https://wordpress.org/support/users/mackans/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/mackans/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/mackans/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/mackans/engagements/)
 *   [Favorites](https://wordpress.org/support/users/mackans/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/users/mackans/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/mackans/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/page/2/#post-9002686)
 * Yeah I know that, you have told me before 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/page/2/#post-8997732)
 * Ok. Earlier when I said the table showed up perfectly, that was obviously not
   true. I didn’t know I was supposed to get the search bar and some decoration 
   as well 🙂
 * Not sure if I can verify your hypothesis. The HTML looks identical if I execute
   the shortcode using ACF (as I have shown above) or just putting it in a post.
   The script is there in the bottom line. See this screenshot.
 * ![Script load ht](https://i0.wp.com/harnotrail.se/wp-content/uploads/2017/04/
   scriptloadht.jpg)
 * Thank you for taking your time!
    -  This reply was modified 9 years, 1 month ago by [mackans](https://wordpress.org/support/users/mackans/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8958666)
 * Hi again Michael
    Any ideas on this? Is there something wrong with my version
   of the plugin? If you try the same shortcode does it work for you? Are the cells
   editable? Do you think it has something to do with my custom theme? Is there 
   something missing in my custom theme? Anyone else had this problem before?
 * /Marcus
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8945929)
 * Sure, I’ll try to explain!
 * **Step 1.**
    ⌊Ht 1⌉ In the Advanced Custom Fields panel, I create a new field
   group with one field. I name the field, assign it a unique field name `registration-
   shortcode`, and choose the field type. In this case I choose a WYSIWYG-field.
   I also choose on which page/pages I wan’t this field group to show up so that
   I can edit the content in the WYSIWYG-field later.
 * **Step 2.**
    ⌊Ht 2⌉ In order to make the content I put in the WYSIWYG-field to
   display on front-end, I add this code to my HTML code `<?php the_field('registration-
   shortcode'); ?>`. Note the identical unique field names.
 *  **Step 3.**
    ⌊Ht 3⌉ Next I go to the page that I choose the field group to show
   up on. And here’s my recently created WYSIWYG-field ready to be edited. I add
   the shortcode `[cfdb-datatable form="Anmälan Långa" edit="cells" filter="email
   =$user_email"]`
 *  **Step 4.**
    ⌊Ht 4⌉ The content in the WYSIWYG-field will show up on front-end
   perfectly!
 * But the datatable is not editable.
    -  This reply was modified 9 years, 1 month ago by [mackans](https://wordpress.org/support/users/mackans/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8930398)
 * I’m using Advanced Custom Fields for most of my texts on the web. Didn’t know
   that I could put the shortcode inside a wysiwyg field. I just did that and the
   datatable shows up just fine. BUT, it’s still not editable!!
 * What am I doing wrong? As i said before I have everything installed and activated.
   The editor extension is working fine in the admin panel.
 * Marcus
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8927947)
 * I’m more confused than you are for sure. When I’m just putting the shortcode 
   directly in the HTML code this is what I get on my webpage:
 * ![Shortcode harnotrail.se](https://i0.wp.com/harnotrail.se/wp-content/uploads/
   2017/03/cfdbplugin.jpg)
 * I have many other shortcodes on the webpage and they work great, and I have put
   all of them in a “do_shortcode” call.
 * I’m using a custom theme and custom templates. Is that the reason why it’s not
   working to just put the shortcode directly into the HTML code?
 * /Marcus
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8923666)
 * Sorry, but I don’t really understand. If I just put
 * `[cfdb-datatable form="Form Name" edit="cells" filter="email=$user_email"]`
 * in the HTML code, the exact same will be shown on the web…
 * What about something like this, is this a good start? Can you help me finish 
   it if I’m on the right track?
 *     ```
       add_shortcode('editregistration', 'editregistration_callback');
       function editregistration_callback ('Form Name', array('edit' => 'cells', "filter" => "email=$user_email")) {
   
       }
       ```
   
    -  This reply was modified 9 years, 2 months ago by [mackans](https://wordpress.org/support/users/mackans/).
    -  This reply was modified 9 years, 2 months ago by [bdbrown](https://wordpress.org/support/users/bdbrown/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8909998)
 * Hmm okay. Is there another way to call a shortcode instead of using do_shortcode?
 * Marcus
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8909635)
 * I have now tried with the actual form name instead of * but it doesn’t work.
 * I tried the most simple shortcode like this:
 * `<?php echo do_shortcode('[cfdb-datatable form="Form Name" edit="cells"]'); ?
   >`
 * and that gives me the whole datatable with around 300 submissions but none of
   the cells are editable.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Edit submission on front-end doesn’t work](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/edit-submission-on-front-end-doesnt-work/#post-8903369)
 * Currently I have these two plugins installed:
 * Contact Form DB
    Contact Form DB Editor
 * Am I missing one more plugin?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Count, exclude row if empty field](https://wordpress.org/support/topic/count-exclude-row-if-empty-field/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/count-exclude-row-if-empty-field/#post-8886436)
 * Solved. See this thread for solution: [https://wordpress.org/support/topic/use-the-count-shortcode-inside-a-php-function/](https://wordpress.org/support/topic/use-the-count-shortcode-inside-a-php-function/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Use the count shortcode inside a PHP function](https://wordpress.org/support/topic/use-the-count-shortcode-inside-a-php-function/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/use-the-count-shortcode-inside-a-php-function/#post-8886428)
 * Thank you! It works!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Count, exclude row if empty field](https://wordpress.org/support/topic/count-exclude-row-if-empty-field/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/count-exclude-row-if-empty-field/#post-8884942)
 * EDIT: I have to clarify my first post as I’ve noticed it’s not understandable
   at all…
 * This is what I mean: The function above counts **all** submissions based on the‘
   submit_time’ column. I have another column namned ‘registrationcode’. Out of 
   100 submissions, only 5 submissions has a value in this column. I want to exclude
   those 5 rows from the count function (or any row that has a value in that column).
   In other words, I only want to include the rows that has an empty value in the
   column ‘registrationcode’.
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] Use the count shortcode inside a PHP function](https://wordpress.org/support/topic/use-the-count-shortcode-inside-a-php-function/)
 *  Thread Starter [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/use-the-count-shortcode-inside-a-php-function/#post-8880530)
 * Hi again
 * Your code above works great! I have another question now. How can I make the 
   function to exclude rows that has a value in a certain column?
 * For example, in the form I have a field that is optional to fill in. If the field
   is left blank I don’t want to include this submission (the row in the database)
   in the count function.
    -  This reply was modified 9 years, 2 months ago by [mackans](https://wordpress.org/support/users/mackans/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] preventing duplicate submissions from cf7](https://wordpress.org/support/topic/preventing-duplicate-submissions-from-cf7-3/)
 *  [mackans](https://wordpress.org/support/users/mackans/)
 * (@mackans)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/preventing-duplicate-submissions-from-cf7-3/#post-8827759)
 * Hi
    Install the plugin Shortcodes, Actions and Filters. Add a new function and
   add this in the code editor:
 *     ```
       function is_already_submitted($formName, $fieldName, $fieldValue) {
           require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CFDBFormIterator.php');
           $exp = new CFDBFormIterator();
           $atts = array();
           $atts['show'] = $fieldName;
           $atts['filter'] = "$fieldName=$fieldValue";
           $atts['unbuffered'] = 'true';
           $exp->export($formName, $atts);
           $found = false;
           while ($row = $exp->nextRow()) {
               $found = true;
           }
           return $found;
       }
   
       function my_validate_email($result, $tag) {
           $formName = 'NAME OF YOUR FORM'; // Change to name of the form containing this field
           $fieldName = 'NAME OF YOUR E-MAIL FIELD'; // Change to your form's unique field name
           $errorMessage = 'ERROR MESSAGE HERE'; // Change to your error message
           $name = $tag['name'];
           if ($name == $fieldName) {
               if (is_already_submitted($formName, $fieldName, $_POST[$name])) {
                   $result->invalidate($tag, $errorMessage);
       		}
           }
           return $result;
       }
   
       add_filter('wpcf7_validate_email*', 'my_validate_email', 10, 2);
       ```
   
 * Remove the * from the bottom line if the field is NOT a required field. Otherwise
   leave it. This works for me, that’s all I can say.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/users/mackans/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/mackans/replies/page/2/?output_format=md)