• I have 3 pages that work in succession to register someone for a particular event.

    Page 1 – Gravity Forms form that adds a person to the database in a temp table

    page 2 – displays the people added to the temp table. Has two links: 1st goes back to the form to add an additional person, 2nd goes to a completion page (page 3) that moves them to the new database, and then deletes the temp info

    page 3 – Adds users to the registered people table, then deletes the old data from the temp table

    ———————————

    Here is what my problem is (this is very simplified):

    On the totals page (page 2), everything works well, except it calls the shortcode from page 3, which deletes the people. Looking at the page with debug on shows no database calls that are within page 3’s shortcode. However, if I comment out the shortcode definition for page 3’s shortcode, this problem does not happen. So page 3’s shortcode is definitely being called on page 2, even after a shortcode AND function name change. It is not being called from page 2’s code, or that would have shown a different outcome.

    a simplified explanation using psuedocode is something like this:

    Page 2:

    [thetotals]

    - SELECT * FROM temp WHERE user_id = $current_user
    - generate table, row for each registrant
    - return $output;

    Page 3:

    [paymentsuccesshandler]

    - SELECT * FROM temp WHERE user_id = $current_user
    - MOVE temp_user TO permanent
    - DELETE temp_user
    - display printable confirmation, and print out registrants

    So somehow, page 3 ends up getting called inside of page 2, but not even WP_DEBUG logs the DB call. I would love to show my code, but each function is about 1,000 lines of PHP code each. I am very fluent in PHP and other CMS’s, but this is my first job working with WordPress. The site is complete and live, and was tested to be working, albeit this small error that I thought was just confined to an administrator.

    Now here’s the real kicker: This only happens in Firefox. Chrome, Safari, tablets, smartphones all work just fine without incident. That is where I am really confused.

    If anybody can help me out, I would really appreciate it. I am open to dialog about this unique problem. I would not like to have spent hundreds of hours on this, have the site go live, then have to shut it down and refund them their money.

    If someone asks, I will post both functions so you can go through them. They are just extremely long.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Scoobiefan

    (@scoobiefan)

    I want this resolved as soon as possible, so I am just going to paste my code in here.

    Here is Page 2’s shortcode definition and function:

    add_shortcode('thetotals', 'totals');

    [ 725 lines of code moderated, that’s just way too much. For that many lines of code please use pastebin.com instead. ]

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I want this resolved as soon as possible, so I am just going to paste my code in here.

    Don’t do that, posting that much code is unreasonable.

    Where did you get that code? If it’s from a commercial provider then then may be able to support you.

    Thread Starter Scoobiefan

    (@scoobiefan)

    I wrote that code. It is in the functions.php file.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    That’s cool. Can you post a pastebin.com link to that code?

    Thread Starter Scoobiefan

    (@scoobiefan)

    Ok, here is the code. These snippets are located in functions.php, with changed shortcode and function names. If they are names already used by WP, then it is accidental and a change I made just recently. Both pages only contain the shortcode I have pasted here.

    Totals page calculates shows the totals, and determines if they are free (sponsored) people. If they are, and have not chosen to donate money making their total 0, then they just go to the confirmation page where it moves just free people over, and then delete the rest.
    If they need to enter a credit card, then they go to a separate page that takes in that information, and the paid people get moved out of the temp table.

    On the Totals Page, after entering information on the first page (which then adds the info to the database and redirects to the totals page), the information shows up just fine, and is in the database. If I refresh, the information shows up on the page again, but is then deleted from the database. If I refresh a second time, the information does not show up anymore. If I comment out the shortcode definition for the Confirmation Page, I do not have this problem.

    So somehow the second page is executing the third page’s shortcode, or really the whole third page (since I included the post number), but only on a refresh. Using WP_DEBUG does not log any of the DB calls for getting the free people or the delete. It’s like a ghost page.

    Thread Starter Scoobiefan

    (@scoobiefan)

    url_vars_handler() on the third page puts the request_uri into an array and passes just the argument, in this case /walk/success/1/ activates the freebies code.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘strange shortcode code leak’ is closed to new replies.