Viewing 10 replies - 16 through 25 (of 25 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Do not use the $_POST array.

    I gave you an example that you should follow. The filter callback function has an array passed into it. Use that array, then return that array after you have modified it.

    Do not use the $_POST array.

    Thread Starter gld

    (@gld)

    Ah yes of course, I have to add the ID generated by the WP DB into the array so that PDB can use that for the record ID to ensure alignment

    Passing the array back is working with the exception of the Captcha. The Captcha variable appears to be an array with two array elements of its own:
    1. What seems to be an encrypted string of what I guess is the Captcha question, and
    2. The user’s response

    I rebuild this array, placing it within the main array that is returned to PDB however despite all the other array elements being accepted by PDB, the Captcha continues to fail with the message ‘The Captcha field is required.’ being returned by PDB.

    Any thoughts? I think I’m very close now …. phew!

    Thread Starter gld

    (@gld)

    Disregard, got it working. Was overthinking it.

    Thread Starter gld

    (@gld)

    Ok, all is working now with the exception of applying the ID that was created in the WP DB into the PDB DB. I’m not sure I’m applying it to the right field. From the array that is being returned by the filter, what is the name I need to use for the array element that would hold the ID. Is it ‘id’, ‘ID’, ‘record_id’ … or?

    Plugin Author xnau webdesign

    (@xnau)

    You don’t have to do anything with the ID field, just let it pass through unchanged.

    Thread Starter gld

    (@gld)

    But then how is the PDB record is related to the WP record? Isn’t this needed to use the code below for after the user is logged in in future? In the filter, the user isn’t logged in. I’ve just had the function call ‘wp_create_user’ to create a new user (if it doesn’t exist yet). How then does PDB get the value that it will assign to what is presumably a field called ‘record_id’?

    [insert_php]

    echo do_shortcode(‘[pdb_record record_id=”‘ . Participants_Db::get_record_id_by_term(‘user_login’, $current_user->user_login, true) . ‘”]’);

    [/insert_php]

    Plugin Author xnau webdesign

    (@xnau)

    Oh, I see. You will have a field in your participant record for the WP user id or login. I wouldn’t call it “record_id” that might lead to confusion. The participant record has it’s own ID…that was what I was telling you to leave alone.

    So, when you create your user in the callback, you store the new user ID in the record by setting the $post[‘user_login’] value.

    Thread Starter gld

    (@gld)

    I’ve done that and am assigning the WP User IDs to a field I created in PDB called ‘wp_db_id’. That all works fine but I’m not able to get pdb_record to show the correct respective record. It seems the only filter that pdb_record recognizes is in relation to the record_id?

    This returns the correct result: [pdb_list filter=”wp_db_id=53″]
    This returns no record found: [pdb_record filter=”wp_db_id=53″]
    This returns no record found: [pdb_record wp_db_id=”53″]

    The record which has wp_db_id=”53″ also has a record ID of 1194 so the statement: [pdb_record record_id=1194] provides the correct result but of course that is no help since we have no way of querying the relationship between wp_db_id and record_id

    Plugin Author xnau webdesign

    (@xnau)

    You need to construct your shortcode using “do_shortcode” so you can insert the use ID dynamically. This usually has to be done in the WP template, although you may have success using a plugin that allows PHP in your page content.

    This is from the article on using WP users with Participants Database:

    echo do_shortcode('[pdb_record record_id="' . Participants_Db::get_record_id_by_term('user_login', $current_user->user_login, true) . '"]');

    Thread Starter gld

    (@gld)

    And …. BINGO! Nailed it. Thank you!!

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘pdb_signup and WP user DB Integration’ is closed to new replies.