gld
Forum Replies Created
-
Forum: Plugins
In reply to: [Participants Database] CSV Export ProblemNo problem. Thanks.
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationAnd …. BINGO! Nailed it. Thank you!!
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationI’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
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationBut 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]
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationOk, 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?
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationDisregard, got it working. Was overthinking it.
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationAh 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 responseI 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!
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB Integrationhere is the code I added to functions.php (in my theme’s folder) which works in case anyone else out there can benefit from it:
function addUserToWPDA() { // grab the values we need $user_login = $_POST['email']; $user_password = $_POST['password']; $email = $_POST['email']; // now create the account in the WP User Database $returnVal = wp_create_user( $user_login, $user_password, $email ); // just in case! if ( is_wp_error($returnVal) ) { echo $returnVal->get_error_message() . "<p>"; } // make sure we return the posted values to ensure the plugin that we have hooked in front of will continue to function properly return ($_POST); } add_filter( 'pdb-before_submit_signup', 'addUserToWPDA', 10, 1 );
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationSo far as I can tell, these errors are being caused by participants-database.php because I’m not forwarding the posted content correctly.
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationHi Roland. Still struggling with this. I don’t know how to return the data back from the hooked function. No matter what I try to return, I get several errors of:
“Warning: Illegal string offset …. “
followed by a final error:
Warning: Cannot modify header information – headers already sent by (output started at …./wp-content/plugins/participants-database/participants-database.php:1377) in …./wp-includes/pluggable.php on line 1121
( I’ve changed the source path to ‘….’ )
Also, I assume that somehow I am needing to return the original posted string right? I can evaluate that just fine but it still generates the above mentioned error when I used the PHP ‘return’ command
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationRoland thanks. I think that answers the last piece of the puzzle as to how to identify the incoming and there what needs to be returned by way of data. Thank you!
Forum: Plugins
In reply to: [User Access Manager] Using Code to change Member GroupHP specifically -> ie PHP
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationI’ve got the filter intercepting the form via the pdb-before_submit_signup tag just fine and it runs a function. What I’m not clear on is what the data is that the form is submitting in order to interrogate it and of course to ensure I return it. Where do I find reference to that? I assume it is the array?
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationThanks Roland. Using a filter does sound like the most elegant approach. Question though: if (via the filter) there is an error (eg a duplicate e-mail and/or login) can I prevent the plugin from committing the new PDB record once the filter exists and control is reverted?
Forum: Plugins
In reply to: [Participants Database] pdb_signup and WP user DB IntegrationHi Roland, I really seem to be stuck between methods here.
What I ultimately need a single signup form which creates both the WP DB user login and an associated PDB record. I want to be able to do it at the one time. I don’t want the user to have to create a WP DB user login, then login, then create a PDB record.
I have two choices for this:
1. Do it all in PDB but then generate the WP DB record via PHP. Fine however WP DB requires unique record for the login ID and the e-mail address. PDB can only check validity on one field correct? If so, it means I cannot use this method, or
2. Create the WP DB record first and once accepted, move on to create an associated PDB record.Your tutorial at https://xnau.com/using-participants-database-with-wordpress-users/ assumes the user is already logged on to the WP DB. Since ‘current_user->user_login’ is only visible if currently logged in. I tried to force the login after the creation of the WP DB entry but before calling pdb-signup using the wp_authenticate PHP function however this appears only to validate credentials, not cause a login.
I have found however that the pdb-signup form takes any variable defined in earlier php scripting if it has the same name and assigns it as the field’s default. This is great but the field must be visible for that to occur which we don’t want. If the field is set as hidden it doesn’t appear on the form at all, even as a type-hidden. This will cause an error on submission since it is a mandatory field. If I manually add these as hidden fields to the pdb-signup template, I cannot seem to obtain the same value defaulting behavior since the variable isn’t visible when I test for it in the template script.
So I’m still stuck. I guess my options are:
1. find a way to automatically login via PHP code (that works)
2. find a way to pass the default values to the php-signup template
3. figure out how to intercept the submission and inset code there
4. Understand if there is a way for PDB to validate uniqueness on 2 fields, not just onePlease let me know the best way forward.
Thanks! Greg