PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

poll

  1. cinisli
    Member

    hello,

    is there any easy template to make poll with GF?

    thanks,

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  2. David Peralty

    What kind of poll are you looking for? Can you point to an example?

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  3. cinisli
    Member

    thanks for your quick reply. i need very easy poll like Which team is going to be the champion? , but i want the result logging method with IP , or similar

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  4. David Peralty

    So you can make the form with the choices and should then use the following code to limit by IP:
    http://gravitywiz.com/2012/05/12/limit-ip-to-one-submission-per-time-period/

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  5. cinisli
    Member

    i tried to make poll with radio button, it works but how can i show the results to users when i decide to end the poll? and the form sends me email every the they vote on it. is there any way to see the results like A: 54 times B:99 ... so on...

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  6. David Peralty

    Unfortunately, Gravity Forms was created for data collection, not collation, and as such, you wouldn't be able to easily show the calculated results without some customization that is beyond what I can offer here on the forums.

    As for seeing the results when it is done, you can export the entire data collected, and in Excel or LibreOffice Calc, sort and calculate the number of responses for each option.

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  7. cinisli
    Member

    ok than, how can i export the data to excell. i can do the rest :)

    thanks for your help

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  8. David Peralty

    Go to Import/Export in the Gravity Forms menu, and you should be able to select the form you want to export data from. It will provide you with a CSV file you can then use for whatever.

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  9. cinisli
    Member

    ok. i saw the import export section. thanks again

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  10. cinisli
    Member

    Hello again david,

    I made the changes as you said, added code to functions.php, made the changes in the code, but now it blocks all ip's ..

    http://Www.1907.net

    Poll is under anketler

    Thanks

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  11. Hi Cinisli,

    What do you change between when the code was working and now? I tested the code provided in the link locally and it worked without an issue.

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  12. cinisli
    Member

    I just place the code in my themes function php, and change :

    Update $gws_limit_message to the message visitors should see when they have reached their submission limit.

    Update $gws_limit_time to the amount of time the user must wait until they can submit the WordPress form again. This time must be provided in seconds. (i made this 48 hours in sec)

    Update the 5 in the filter gform_pre_render_5 to your own form ID.

    Thats all. Now the code blocks all ips .

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  13. cinisli
    Member

    and i just figure it out that after i put the code my other forms are not working aswell. i have error :

    There was a problem with your submission. Errors have been highlighted below.

    ---

    one more time i am placing this code in functions php :

    /**
    * Limit IP to One Submission Per Time Period
    * http://gravitywiz.com/2012/05/12/limit-ip-to-one-submission-per-time-period
    */
    
    $gws_limit_message = 'Ayni IP 48 saat sonra bir daha oy verebilir.';
    $gws_limit_time = 172800; // must be specified in seconds; 86400 seconds is equal to 24 hours
    
    // update the "5" to your form ID
    add_action('gform_pre_render_5', 'gform_limit_ip_submissions');
    function gform_limit_ip_submissions($form){
        global $gws_limit_message, $gws_limit_time;     
    
        if(!gform_has_ip_exceeded_limit($form, $gws_limit_time))
            return $form;
    
        $submission_info = rgar(GFFormDisplay::$submission, $form['id']);
    
        // if no submission, hide form
        // if submission and not valid, hide form
        if(!$submission_info || !rgar($submission_info, 'is_valid')) {
            add_filter('gform_get_form_filter', create_function('', "return '<div class=\"limit-message\">$gws_limit_message</div>';") );
        }
    
        return $form;
    }
    
    add_filter('gform_validation', 'gform_validate_limit_ip_submissions');
    function gform_validate_limit_ip_submissions($validation_result) {
        global $gws_limit_message, $gws_limit_time;
    
        if(gform_has_ip_exceeded_limit($validation_result['form'], $gws_limit_time))
            $validation_result['is_valid'] = false;
    
        return $validation_result;
    }
    
    function gform_has_ip_exceeded_limit($form, $limit_time) {
        global $wpdb;
    
        $current_ip = RGFormsModel::get_ip();
        $last_submission = $wpdb->get_var($wpdb->prepare("SELECT date_created FROM {$wpdb->prefix}rg_lead WHERE ip = %s and form_id = %d ORDER BY date_created DESC", $current_ip, $form['id']));
    
        if(empty($last_submission))
            return true;
    
        $time_out = strtotime($last_submission) + $limit_time;
        $current_time = time();
    
        return $current_time > $time_out ? false : true;
    }
    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  14. I was really excited yesterday when I found this.
    The poll itself works great..

    However, when I loaded it up and then previewed a new form, I'd see the entire index file of my wordpress install. YIKES. Did I do something wrong?
    Didn't want to leave it up and post that info to the world.

    Thanks
    kerch

    Posted 12 years ago on Tuesday August 14, 2012 | Permalink
  15. What does this mean exactly?

    I'd see the entire index file of my wordpress install

    If this is something sensitive, please email chris@rocketgenius.com with a URL where this can be seen, and reference this topic in your email. Thank you.

    Posted 12 years ago on Wednesday August 15, 2012 | Permalink
  16. It looks like your installation is missing the index.php file in the /website directory. That's the reason the directory index is showing all your files. This is related to having your WordPress URL and website URL different. You can do that, but I'm unsure if you need to in your case. The settings which control the location of the site and WordPress installation are at this URL for your server (replace example.com with your URL):

    http://example.com/website/wp-admin/options-general.php

    You can find out more about giving WordPress its own directory here:
    http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    Fixing that will make the polls work. However, to prevent your server from showing a listing of all files in a directory (for example, if someone loaded this URL for your domain: http://example.com/website/wp-content/plugins/broken-link-checker/ they would see a listing of all files there) you need to add to your site's .htaccess file (or create one if there is not one already), this line:

    Options -Indexes

    That will suppress directory listings when there is no index file present.

    When there is an index.php file, depending on server configuration, that is normally loaded and you don't see a directory listing. In your case, in the website folder, there is no index.php file. That's why the directory listing is shown, and that's why the poll will not preview.

    Posted 12 years ago on Wednesday August 15, 2012 | Permalink
  17. Chris
    OK thanks for that.. It totally makes sense.
    I have WP installed in almost all my sites in a directory different than the root. Never had this trouble before AND I recently deleted/replace the original index.php which is included in the wp directory ... it had this line:
    require('./wp-blog-header.php');

    I was afraid that might be mucking up stuff as what controls the site (in the root directory) is:
    require('./root/wp-blog-header.php');

    So I deleted the index.php that was in the wp directory.. and that screwed it all up.

    BTW, after our little chat (S) I replaced the wp index.php with a "Silence is golden" file.. and that made NONE of the previews show at all.

    THEREFORE, I think I am saying that when you copy the index.php to root and adjust for the folder, don't delete the index.php that came with the install.
    I hope I haven't confused everyone.
    But thanks for putting your finger on the problem.
    I love this poll plug in.. It's great!!
    Kerch

    Posted 12 years ago on Wednesday August 15, 2012 | Permalink
  18. Thank you for the update.

    Posted 12 years ago on Wednesday August 15, 2012 | Permalink

This topic has been resolved and has been closed to new replies.