harski111
Forum Replies Created
-
Forum: Plugins
In reply to: [Participants Database] Last Update User field causing problemsHi!
Got this working!
It was my mySQL database settings that were messed up. Tried to add that missing column by myself and received error:Error Code: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.My row format was compact, changed it to dynamic and after that I was able to add that missing “last_update_user” column, and now everything works normally.
It would have helped if there was an error message at the record page, that tells if record saving fails with reason like this.
Now there was no error messages at all, I had to get it from the error log. Even a small error message that only tells if record saving fails with any reason.
Forum: Plugins
In reply to: [Participants Database] Last Update User field causing problemsHi!
Thanks for the reply but it didn’t help.
I looked at my database with phpmyadmin and noticed that wp_participants_database table (that stores the records) has no column called “last_update_user”.
Table wp_participants_database_fields has a row called “last_update_user”.
Hi!
Thank you for the answer!
I have read many articles and tutorials about the shortcodes and never seen a word that echoing is something you shouldn’t do. Unbelievable that authors of those tutorials haven’t noticed that.
But this solved my problem, thank you very much!
Hi again!
First, I have to tell that I got this working!
I turned on debugging and it showed that fields that were defined as read only were all empty, and all other fields were correctly set.
Even if I wrote manually to the $user_data array the fields were showing empty in the log. Something was making those fields values empty.
I even tested to fill the array manually in PHP. So I knew it was filled properly and it was not empty. Still no luck.
$user_data = array( 'action' => 'signup', 'first_name' => 'MyName', 'last_name' => 'MyLastName', etc... etc... );I looked at the
pdb_signupform and noticed that there was a hidden field that had name “action” and value “signup” (just like you’ve been telling to me), and I realized that why I don’t just put a hidden field with that same name and same value to my own CF7 form. And I did that and straight away everything started working!I don’t know why, but somehow (atleast) in my case putting that
'action' => 'signup'to the data array was not working, but when I included that to my form as a hidden field, it started working. So it leaves little bit a mystery what was making it work like that, but I’m very happy that I got this working and now I can continue with the code!Thank you one more time, I really appreciate your help!
Hi!
You can see the code in my third post.
I have a action hook (wpcf7_mail_sent) from another plugin (Contact Form 7), that fires when I submit a form from that plugin (in front-end).
Basically I get the data that is submitted to the Contact Form 7 form, and then I use write_participant method to add that data to ny database.
So it is a form submission, and it all happens in front-end.
I know that I could use the pdb-signup form itself for adding new participants, but problem is that we have many fields in our form that we don’t want/need to save to the database.
Thanks!
Hi!
I looked at the plugin code and found that
Participants_Db::write_participantmethod calls thefunction process_form( $post, $action, $participant_id = false, $column_names = false )function.And that function has following statement:
/** * readonly field data is prevented from being saved by unauthorized users * when not using the signup form */ if ( $field->is_readonly() && ! $field->is_hidden_field() && self::current_user_has_plugin_role( 'editor', 'readonly access' ) === false && self::apply_filters( 'post_action_override', filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ) ) !== 'signup' ) { $post[$column->name] = ''; }So if I understand correctly, because of
filter_input()I would need to be sending the ‘action’ => ‘signup’ using HTML-form, and now the function doesn’t get it from the $user_data array.My knowledge is limited to this point, I don’t know if there is a trick or something that I could send the
'action' => 'signup'variable using HTML-form (INPUT_POST) without actually using the HTML-form. Maybe that would be possible with some tricky PHP-coding?I was thinking of another solution that I will look at next, I will remove all the “readonly” attributes from my fields, and then with some filtering I will try to manualy add the “readonly” attributes only to my front-end
[pdb_record]form.I wouldn’t like to make filters like this because they might cause me troubles in the future, but at this seems to be the only option for me, if I want to add records manually. Other option would be adding the records manually to my SQL-database, but I don’t want to do that either.
Hi!
Thank you for your answer, but I tested this and adding
'action' => 'signup'to the data array didn’t affect the read ony fields at all. Still read only fields were not filled.$user_data = array( 'action' => 'signup', 'first_name' => 'My First Name', 'last_name' => 'My Last Name', 'address' => 'My Address' ); Participants_Db::write_participant( $user_data );Is there anything I can try?
Still I didn’t understand… Sorry.
So I’m using the write_participant method to save data that is given to the form created by Contact Form 7 plugin. I now that I could use the “signup” form by Participants Database plugin, but my form includes many fields that I don’t need to have added to the database. That’s why I’d like to do it this way.
Here’s my code, it is executed after form is submitted from Contact Form 7, and I can get the data that is send from the form.
add_action( 'wpcf7_mail_sent', 'add_to_PDB' ); function add_to_PDB( $contact_form ) { $title = $contact_form->title; $submission = WPCF7_Submission::get_instance(); if ( $submission ) { if ( $title == "Test101" ) { $data = $submission->get_posted_data(); $user_data = array( 'first_name' => $data['firstname'], 'last_name' => $data['lastname'], 'address' => $data['address'], 'zip' => $data['zip'], 'city' => $data['city'], 'phone' => $data['phone'], 'email' => $data['email'] ); Participants_Db::write_participant( $user_data ); } } return $contact_form; }Is it so simple that I add new item “action” with value “signup” to the $user_data array? Don’t believe it works like that..
I have to say that I highly appreceiate the support that you are giving! And also the plugin documentation is one of the best that I have seen! Unfortunatelly I didn’t find much documentation for this Participants_Db::write_participant method though, maybe you could provide some? I think many people would find that helpful!
Thanks for reply!
I didn’t completely understand your workaround, is there variable called “action” in the $data array? Or how is that done?
Hopefully I can figure a solution for this.
Forum: Plugins
In reply to: [Participants Database] Hook to bulk actions “approved/unapproved”Now I got it working!
Correct action was “pdb-list_admin_with_selected_approve” so there was one hyphen that needed to be changed to underscore. Now it works as it should!
Forum: Plugins
In reply to: [Participants Database] Hook to bulk actions “approved/unapproved”Yes, but still not working…
Here’s the code I use, it works in other places that I have used it. Also if I add ‘echo “hello”;’ to the code, it doesn’t appear so I believe the action is not fired…
add_action('pdb-list-admin_with_selected_approve', 'write_to_log_bulk_yes'); function write_to_log_bulk_yes( $ids ) { foreach ( $ids as $id ) { $pdb_db = Participants_Db::get_participant($id); $text = $pdb_db['log'] . "\n" . date("d.m.Y H:i:s") . " // Approved: Yes"; Participants_Db::write_participant(array('log' => $text), $id ); } }Forum: Plugins
In reply to: [Participants Database] Hook to bulk actions “approved/unapproved”Hi!
Actually the action you provided doesn’t seem to be working.
I also tried ‘pdb-admin_list_with_selected_approve’ (that is formatted same way as all other actions in the plugin), but no luck.
Also tried add_filter instead of add_action.Can’t find anything from Google or plugin files that might help…
Forum: Plugins
In reply to: [Participants Database] Hook to bulk actions “approved/unapproved”Ah, awesome!
That is exactly what I was looking for.
I didn’t find it from the documentation, but I was remembering that I had seen that kind of action somewhere.Thanks again!
Forum: Plugins
In reply to: [WP-Members Membership Plugin] Make fields disabled in Profile pageI got this solved.
“Disabled” attribute doesn’t send value to the server, I should use “readonly” attribute. With readonly it works! This was little bit too obvious answer 😀
Forum: Plugins
In reply to: [Participants Database] Generate unique member ID plugin is not workingFirstly I have to say that you are just amazing!
The php-tag was the first character in my file, that wasn’t the problem, but when I looked at the file more closely, I noticed that it was using UTF-8-BOM coding instead of UTF-8. That was causing the problems.
I can’t understand how that had happened, my editor has changed the coding somehow and I haven’t noticed that. But now everything is working perfectly. I was thinking that the problem might be something similar to this, because the symptoms were so weird and made no sense at all, but didn’t realise that this could be even possible.Thank you (again) for your great support!