WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can you help me with the code where all I only want is to add the list of all submitters who submitted GF form on every post page right after the post content? Every post has its small CPT form on the bottom of the page and submitted forms goes to the custom post type portfolio page. I want to also display the list of clickable titles (the name of submitters with some fields already merged together by GF form) of the form with URL of that created page.

image 1 before submition: enter image description here

The post after 5 succesfull submitions, it should also be after the post content /div

image 2 after: enter image description here

The code I would like to use is here:

    add_action("gform_after_submission_7", "set_post_content", 10, 2);
    function set_post_content($entry, $form){

        //getting post
        $post = get_post($entry["post_id"]);

        //adding after the post content - how can I get something like this ?:

             a submitted portfolio URL 
                   div class"some class" 
                   submitted form title 

        //updating post
share|improve this question

closed as off-topic by Mark Kaplun, Pieter Goosen, Johannes Pille, birgire, gmazzap Aug 30 '14 at 10:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Mark Kaplun, Pieter Goosen, Johannes Pille, birgire, gmazzap
If this question can be reworded to fit the rules in the help center, please edit the question.

The two images you mentioned seem to be identical. Not sure if you're still trying to solve this one. Let me know. – GhostToast Jun 21 '13 at 13:47
Yes, they are very similar, and in fact I want to use the knowledge from one of those questions to solve another. Difference is that here I create and publish 1 post_type and update another CPT which already exists and at that page should be only added info about the submitter(name)+ possibly (age) OR from which country is so(country), I don't care where in the page, this way I would love to see the popularity of every page by seeing submitters in some "div".Second post is different, as the previuos case it will creates new custom_post_type but will also generate a brand new custom_post_type. – Daniel Foltynek Jun 21 '13 at 14:07
No I'm talking about the images linked are identical. – GhostToast Jun 21 '13 at 14:07
ahh I see now, you are right! I have changed that now. – Daniel Foltynek Jun 21 '13 at 14:20

In order to do this on the page where the form is, it would work well to know the ID of that page. We'll assume you have that and just want to embed this information into this page. So in your gform_after_submission hook, you'll want something like this:

$id_of_page = 36; // change this

// false means we want all values as array, not single
$array_of_submitters = get_post_meta($id_of_page, 'my_custom_field', false); 

    // has not yet been made, setup variable
    $array_of_submitters = array();

// add new value to array
$array_of_submitters[] = $entry[12]; // whatever field you need

// update!
update_post_meta($id_of_page, 'my_custom_field', $array_of_submitters);

Then in your page, you'll want to just echo those out like this:

$array_of_submitters = get_post_meta($post->ID, 'my_custom_field', false);

// make sure it has values first so we don't look foolish
    echo '<h4>People who did something</h4>';
    echo '<ul>';
        // echo each value out as list
        foreach($array_of_submitters as $submitter){
            echo '<li>'.$submitter.'</li>'; 
    echo '</ul>';
share|improve this answer
But the ID of the page will be unknown, because the little form is right now on the bottom of every post page, I have 1700 clubs there and on every post page will girls ask for the job, take a look here, it is in italian: 4ella.com/2012/12/la-perla-nightclub-cagliari , the ID of the page has to be get dynamically. – Daniel Foltynek Jun 21 '13 at 14:56
In that case, you will need to decide where you want to save it. It's a little unorthodox, but you could save it as post_meta for an important page, and just always reference it that way. For example, the home page. And instead of using $post->ID to get it, use that page's unique ID. – GhostToast Jun 21 '13 at 15:02
I would better choose your recommended solution, I don't know what should be the best one, but I hope that in future on that site should have 1000's posts their list of submitters (with their links to their portfolios), so it should be a lot of new data. – Daniel Foltynek Jun 21 '13 at 15:12
Should be fine to use home page's ID as long as you never delete the home page. Otherwise you could store this stuff in a custom table, but that is a topic for another question I think. – GhostToast Jun 21 '13 at 15:16
I will be very very happy if this feature will work and sincerely if this feature doesn't worse my website performance I don't mind where to store it, I think that storing I can always change in the future when I will have more time and more ability to do those things by myself, but as I said, you are an expert here, so if you will choose more easy way, I would be happy anyway, because it will work – Daniel Foltynek Jun 21 '13 at 15:25

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