| Post |
|
Guest
| Martin Barker 12:42 pm October 7, 2011
| |
|
|
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
|
|
|
Guest
| Martin Barker 2:19 pm October 10, 2011
| |
|
|
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…..960k7dded1
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="" />
|
|
|
Moderator
| Paul Amsterdam, NL posts 421 4:25 pm October 10, 2011
| |
|
|
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.
|
|
|
|
|
Guest
| Martin Barker 12:25 pm October 11, 2011
| |
|
|
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?
|
|
|
Moderator
| Paul Amsterdam, NL posts 421 1:41 pm October 11, 2011
| |
|
|
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.
|
|
|
|
|
Guest
| Martin Barker 9:16 am October 13, 2011
| |
|
|
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
 
|
|
|
Moderator
| Paul Amsterdam, NL posts 421 9:47 am October 16, 2011
| |
|
|
It's simple :-)
To the left of the "30" you see a zoom/magnifier icon, click that and it opens your filter options.
P.
|
|
|
|
|
Guest
| Martin Barker 2:46 pm October 20, 2011
| |
|
|
That lets you type in a form name it does not give you a list of forms for you to select form!
|
|