winnischneider
Forum Replies Created
-
Forum: Plugins
In reply to: [Participants Database] Recording a field over JoinSorry I was study your hooks a bit better and could resolve the problem with this code snipet:
// Hook into the after_submit_signup and after_submit_update hooks add_action('pdb-after_submit_signup', 'update_occupation_label_field'); add_action('pdb-after_submit_update', 'update_occupation_label_field'); function update_occupation_label_field() { // Check if the necessary form fields are present in the $_POST data if (!empty($_POST['beruf']) && !empty($_POST['id'])) { global $wpdb; // Get the participant ID and occupation code from the $_POST data $participant_id = $_POST['id']; $beruf_code = $_POST['beruf']; // Query to fetch the occupation label from the database $query = $wpdb->prepare(" SELECT o.berufe AS berufsgruppe FROM {$wpdb->prefix}occupation AS o WHERE o.code = %s ", $beruf_code); $occupation_label = $wpdb->get_var($query); // Update the participant's 'berufsgruppe' field if ($occupation_label !== null) { Participants_Db::write_participant(array('berufsgruppe' => $occupation_label), $participant_id); } } }
So thanks very much for your time and attention.
Regards Winni
Forum: Plugins
In reply to: [Participants Database] Recording a field over JoinHi thanks for interest first. I try to explain in a nother way. I have participants in the participant table which can select from the table occupations some occupations (each occupation has a uniqu code) I store in the participants table the code. A nother user can choose as well from the occupation table the occupation-group and get matched via the occupation code with the frist users. this is all function so far, also the matched results are displayed correctly with the help of a join, to get instead of the code the occupations string displayed. (The join with the code is also needed because the table is multilinguals but the displying I need only in one language.) Now the problem is in displaying the general table with all results, where the occucpation field has just the code only but I need the string from the occupation table. Therefor I tried several things but discovered, the it seams do be unpossible to write something in the database and get this displayed. Finally it was posssible to record the labels in the database but they did not want to get displayed. Last idea was to create a field occupation_label in the participant database to get as well a field in the db table from the participants and to fill up this with a Join request and yes it got filled up but the data did not got displyed. My Question is: is there a kind of security check which does not permit db chances which get not made over the registration or update function? And is there a possibllity for a work around?
I hope you understand something of what is mmy problem and appreciate any hint.