cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Added Specific form selection to the database mode
October 7, 2011
12:42 pm
Martin Barker
Guest

Hello,

I have added some code to your plugin as it is licensed under  GNU GPL i though i would shear it in the hope you add it to the package as i could see loads of users finding this helpfull,

js/include/lib_database_overview.php

 

line 58
Remove

$where = '' 

Replace with

if(isset($_GET['form_id'])){
$where = "WHERE form_id = '".$_GET['form_id']."'";
if($_GET['form_id'] == '*'){
$where = "";
}
}

 
cforms-database.php
 
line 31
Add

### get the form names
$fnames = array();

for ($i=1; $i <= $cformsSettings['global']['cforms_formcount']; $i++){
$n = ( $i==1 )?'':$i;
$fnames[$i]=stripslashes($cformsSettings['form'.$n]['cforms'.$n.'_fname']);
}

 
line 46
Add

<p><form action="/wp-admin/admin.php?page=cforms/cforms-database.php" method="post">
<?php _e('If you\'re wanting results from one form please select the form name:', 'cforms'); ?> <select onchange="this.form.submit();" name="form_id">
<option value="*">Show All</option>
<?php foreach($fnames as $key => $val): ?>
<option <?php if($_POST['form_id'] == $key) echo 'selected="selected"'; ?> value="<?php echo $key ?>"><?php echo $val ?></option>
<?php endforeach; ?>
</select>
</form>
</p>

 
Line 70
Remove

 url: '<?php echo $cforms_root.'/js/include/lib_database_overview.php'; ?>', 

Replace with

url: '<?php echo $cforms_root.'/js/include/lib_database_overview.php'; ?>?form_id=<?php echo ($_POST['form_id'] == '1')? ' ': $_POST['form_id']; ?>',

And that's it all done it will then give an option for you select any of the forms you have created

October 10, 2011
2:19 pm
Martin Barker
Guest

Hello again,

Added a little update to my code changes so a when you click the download it will only download the results for the form you have selected.

Admin if you could confirm if your going to add my changes to the currently live version or if i'm ok to create a fork and add my code in there?

Updated the cformsadmin.js to allow the form_id to be passed to the download scripts please download updated file here: http://www.mediafire.com/?ad1v4960k7dded1

lib_database_getentries.php

Replace

else
$where = "";

With

if(isset($_REQUEST['form_id'])){
        $where = ($_REQUEST['form_id'] == "1")? "AND form_id = ' '":"AND form_id = '".$_REQUEST['form_id']."'";
        if($_REQUEST['form_id'] == '*'){
            $where = "";
        }
    }

cfoms-database.php

Add at line: 153

<input id="formID" type="hidden" name="form_id" value="" />

October 10, 2011
4:25 pm
Paul
Amsterdam, NL
Moderator
Forum Posts: 421
Member Since:
February 10, 2009
Offline

Thanks for the code contribution!

 

What strikes me is that form based download of records has been working forever, so on first sight, I'm not sure what your code adds. 

 

I'll take a look at it and will pass it on to Oliver to include it in the next version if it indeed adds functionality that's not already built in.

 

P. 

* Paul Silter
October 11, 2011
12:25 pm
Martin Barker
Guest

I have added it to the tracking as i could not find out how to get the per form download and i needed it easily found for my clients so i built it into the tracking page so that the results can be found from one page

On another note where can i get the result's for an single form so it can be downloaded as CSV?

October 11, 2011
1:41 pm
Paul
Amsterdam, NL
Moderator
Forum Posts: 421
Member Since:
February 10, 2009
Offline

Martin, not sure what cforms version you've been working on, but the tracking page really hasn't changed in prob a year or so.

The tracking page that displays all form submission offers filters for date, email address and form name. Once you set a filter and then simply click download, you'll get all submissions based on the filter set.

P. 

* Paul Silter
October 13, 2011
9:16 am
Martin Barker
Guest

Where is this filters system then i'm using the current cforms according to WordPress 
This is my tracking page, the red block is what my code adds to cforms, there is no filter on the page before my code, 

There are the options what what columns to show in the Table View and Ordering the results,

As for getting only the Data from 1 form i can not see a way of doing it

 My Tracking Page

October 16, 2011
9:47 am
Paul
Amsterdam, NL
Moderator
Forum Posts: 421
Member Since:
February 10, 2009
Offline

It's simple :-)

To the left of the "30" you see a zoom/magnifier icon, click that and it opens your filter options.

P. 

* Paul Silter
October 20, 2011
2:46 pm
Martin Barker
Guest

That lets you type in a form name it does not give you a list of forms for you to select form!

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
33 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3733

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5334

Posts: 18698

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)