Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • in reply to: Getting just the data out… #32261
    jwrbloom
    Participant

    Still getting…

    Fatal error: Uncaught Error: Call to undefined function add_filter() in /home2/csi/public_html/wp-content/plugins/csi_stats/csi_roster_process.php:4 Stack trace: #0 {main} thrown in /home2/csi/public_html/wp-content/plugins/csi_stats/csi_roster_process.php on line 15

    
    /**
     * Plugin Name: CSI Stats
     * Plugin URI: https://courtsideindiana.com
     * Description: Stat Module
     * Version: 1.0
     */
    
    //include("/home2/csi/public_html/resources/con.php");
    
    add_filter('quform_post_process_10', function (array $result, Quform_Form $form) {
        $session = quform('session');
        $session->set('form_10', $form);
    
        return $result;
    }, 10, 2);
    
    add_action('wp', function () {
        if(!isset($_GET['submitted_form_csv']) || !function_exists('quform')) {
            return;
        }
    
        $session = quform('session');
        $form = $session->get('form_10');
    
        if(!$form instanceof Quform_Form) {
            die('Form not found');
        }
    
        var_dump($form->getValues());
        exit;
    });
    

    Here is the URL I’m redirecting to:
    https://www.courtsideindiana.com/wp-content/plugins/csi_stats/csi_roster_process.php?submitted_form_csv

    in reply to: Getting just the data out… #32253
    jwrbloom
    Participant

    Tried both codes blocks separately, and they each produced this error:

    Fatal error: Uncaught Error: Call to undefined function add_filter() in /home2/csi/public_html/wp-content/plugins/csi_stats/csi_roster_process.php:3 Stack trace: #0 {main} thrown in /home2/csi/public_html/wp-content/plugins/csi_stats/csi_roster_process.php on line 3

    What I want is to submit the form, have it redirect to a .php and dump the data so I can treat it like a CSV.

    • This reply was modified 1 year, 1 month ago by jwrbloom.
    in reply to: Getting just the data out… #32252
    jwrbloom
    Participant

    Just answering the question you asked, then I’ll try out the code you posted.

    I’m sending the form to the PHP via the form’s settings.

    Settings > Confirmation > Default Confirmation > Display message then redirect to custom URL

    in reply to: Getting just the data out… #32247
    jwrbloom
    Participant

    I’ve tried getValues() as well.

    Same error.

    However, do I need to code in the array too? I’m just looking for a way to have all the data dumped.

    in reply to: Getting just the data out… #32242
    jwrbloom
    Participant

    That was the full code.

    Then I marked that out and put this:

    
    add_action('quform_get_value_for_storage_10', function ($value, Quform_Element_Field $element, Quform_Form $form) {
        $value = my_encrypt_element_value($value);
     
        return $value;
    }, 10, 3);
    

    Same error.

    • This reply was modified 1 year, 2 months ago by jwrbloom.
    • This reply was modified 1 year, 2 months ago by jwrbloom.
    • This reply was modified 1 year, 2 months ago by jwrbloom.
    in reply to: Getting just the data out… #32232
    jwrbloom
    Participant

    Just sending the form to a .php to try this out:
    $value = $form->getValue(‘quform_10_60’);

    I keep getting this error:
    Fatal error: Uncaught Error: Call to a member function getValue() on null in /home2/csi/public_html/wp-content/plugins/csi_stats/csi_roster_process.php:4 Stack trace: #0 {main} thrown in /home2/csi/public_html/wp-content/plugins/csi_stats/csi_roster_process.php on line 4

    Here is my code:

    
    		$value = $form->getValue('quform_10_60');
    			echo $value;
    		echo 'Hello'; 
            $post_data = file_get_contents('php://input'); 
            echo "<div> POST BODY <br>".$post_data."</div>";         
    
    
    • This reply was modified 1 year, 2 months ago by jwrbloom.
    in reply to: Getting just the data out… #32228
    jwrbloom
    Participant

    I saw the groups workaround, and that’s essentially what I’m doing. Great point about using the variables in the email. I can create my own CSV in the email.

    Is this another option?
    If I send that string of data (realizing they aren’t actually repeatable fields) to a .php, I could effectively add hidden elements to create field and line terminations. Does that sound about right?

    I guess my question is, can I just get some variation of a var_dump?

    • This reply was modified 1 year, 2 months ago by jwrbloom.
    in reply to: quform_post_process_X hook… #23796
    jwrbloom
    Participant

    It had it return all data, limit 10. It didn’t return anything.

    Once I get through this process, I’m going to look into converting my queries to mysqli. Not sure about this PDO stuff. I’ll email you the information you asked.

    in reply to: quform_post_process_X hook… #23746
    jwrbloom
    Participant

    UPDATE code: added this line:

    $num_rows = mysql_num_rows($results);

    …then put the $num_rows in the IF loop.

    I’ve tested with information I know exists in a_players, but it’s still showing $num_rows as NULL.

    
    add_action('quform_post_process_1', function (array $result, Quform_Form $form){
        $data = array(
            'f_school' => $form->getValue('quform_1_7'),
            'f_grade' => $form->getValue('quform_1_5'),
            'f_nameFirst' => $form->getValue('quform_1_3'),
            'f_nameLast' => $form->getValue('quform_1_4')
        );
     
     			Quform::log($data['f_school']);
     			Quform::log($data['f_grade']);
     			Quform::log($data['f_nameFirst']);
     			Quform::log($data['f_nameLast']);
    
    include (ABSPATH ."resources/connection.php");
    
     
    			$query = "SELECT nameFirst,nameLast,grade 
    						FROM a_players
    						WHERE nameFirst = '" . $data['f_nameFirst'] ."' and nameLast = '" . $data['f_nameLast'] . "' and grade = '" . $data['f_grade'] ."'";
    			
    			$results = mysql_query($query);
    			$num_rows = mysql_num_rows($results);
    			
    			Quform::log(mysql_error());
    			Quform::log(mysql_num_rows());
    			
    			Quform::log($results['nameFirst']);
    		
    		//	while($check = mysql_fetch_assoc($results)) {			
      
    					if (($num_rows) == 0) {
    			 			"INSERT INTO a_players (school, grade, nameFirst, nameLast)
    						VALUES ('".$data['f_school']."', '".$data['f_grade']. "', '" .$data['f_nameFirst']. "', '" .$data['f_nameLast']."')";
    					}			
    
    		return $result;	
     
    }, 10, 2);
    
    
    in reply to: quform_post_process_X hook… #23740
    jwrbloom
    Participant

    So I added…

    Quform::log(mysql_error());

    …to my code.

    And it came up with this.
    [08-Jan-2018 14:26:50 UTC] string(62) “Access denied for user ‘root’@’localhost’ (using password: NO)”

    Should I added my connection call to this file? I thought it would already be connected to AP since it’s posting to APR table.

Viewing 10 posts - 1 through 10 (of 10 total)
Be inspired. © 2020 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy