• Resolved MrAddy

    (@mraddy)


    Hello, I am looking for the form header thats on each template, but i cannot find it. I need to add a $_SESSION var to the action.

    <?php // output any validation errors
     $this->print_errors(); ?>
    
      <?php // print the form header
      $this->print_form_head()
      ?>

    Its found in the templates folder under record-default.php.
    Thanks

    https://www.ads-software.com/plugins/participants-database/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter MrAddy

    (@mraddy)

    I have found the function in question, which is in the Shortcode.class.php. I changed the action so it changes the action to add a parameter.

    In Chrome debug, i can see the element <form> and also see the action which correctly adds the parameter. So, for example it looks like:

    action="/?page_id=434&action=update&level=3"

    But, when i click the button which should, I thought, submit to this action, it moves to a new page slug, which is not part of PD, but a payment page, and its this payment page that requires the level. But i added the code on record-default.php template, so the 3 pages before the payment screen, it should have also added the level.

    How do I make it so when you click proceed on a multiform, keeping the new parameter in place throughout ?

    Thanks

    Plugin Author xnau webdesign

    (@xnau)

    I’d suggest doing this with javascript rather than edit the plugin code, that way you can continue to update the plugin without losing your changes. Write a short script that adds your variable to the action attribute and put it into your custom template.

    Thread Starter MrAddy

    (@mraddy)

    Is this possible ? When the button is clicked it goes to WP to redirect, so i would need to catch it in mid flow. Looking at Participants-database.php where you ‘process the form’, line 2273. action is action=update so not sure how i would add anything else to that and have it make sense for the server?

    Currently the only thing I have done is

    $redirect = $post_input['action'] == 'insert' ? $post_data['thanks_page'] : self::add_uri_conjunction($post_data['thanks_page']) . 'action=update' . $_SESSION['tempServiceLevel'];

    So I saved the new part in Session during the custom signup. But i agree using it this way is not ideal. So I could either add to the WP pluggable.php and the core wp_redirect function or leave it as it is. So not sure whats best ?

    Plugin Author xnau webdesign

    (@xnau)

    If you’re using a session value, you don’t need to include it in the form action, because session values are persistent across page loads.

    Just put the name of the page you want the user to go to after they submit in the shortcode as the “action” attribute:

    [pdb_signup action="payment-page"]

    Then on your payment page, you can just access your session value in PHP as $_SESSION[‘tempServiceLevel’].

    Thread Starter MrAddy

    (@mraddy)

    Sorry you are not understanding. I am jumping from PDB to a Subscription Service, and for Service to work it needs the level in the URL. Once the subscription payment has been made, it then jumps to the Thank You page in PDB to finish off the process. All this works fine, but only by changing the core.

    Because I am unable to change the URL. The URL is correct when its on the Sign Up page, but then loses the parameters on each click through the pages. Which is why i had to hack it. But surly its not meant to remove existing parameters, but append to them ?

    Thread Starter MrAddy

    (@mraddy)

    Plugin Author xnau webdesign

    (@xnau)

    OK, now I get it. This is how you do that…you don’t need to alter the plugin files. You’ll need to use a custom template…it can be either a signup form or a record form. Put this before $this->print_form_head()

    <?php $this->submission_page = $this->submission_page . '&level=1'; ?>

    That will add your variable to the url of the page the user is redirected to after they sign up. The “submission page” is the page the user is redirected to after completing the form.

    Thread Starter MrAddy

    (@mraddy)

    Perfect, that did the trick.

    Thank you ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Participation Database] Looking for $this->print_form_header()’ is closed to new replies.