You may need to use wp_get_current_user() before calling the shortcode. Details here…
Thanks it worked 🙂
One more question – i need to make an editable record. With the below code the logged in user can only edit one record (record is displayed without clicking on it, how can I get the logged in user to update more than one record by clicking on the individual record?
Thanks again for the great plugin.
echo do_shortcode('[pdb_record record_id="' . Participants_Db::get_record_id_by_term('user_login', $current_user->user_login, true) . '"]');
I need some help combining the below codes to make the EACH record editable by the user?
[insert_php]
echo do_shortcode('[pdb_list filter="user_login=' . $current_user->user_login . '"]');
[/insert_php]
echo do_shortcode('[pdb_record record_id="' . Participants_Db::get_record_id_by_term('user_login', $current_user->user_login, true) . '"]');
Thanks for your help
Hi
I got another question, the above works 100%.
I want to include an additional column with the below PayPal code. I created a new column called PayPal. Can you advise on how to include this code. The aim is to give each paypal record a unique name / id as a reference number.
Thanks again
<?php echo print_wp_cart_button_for_product(’$id’,price); ?>
For that, you’ll need a custom template so you can access the record values directly and insert them in the function. The example given in the custom template article should give you the basic idea…you’d have a conditional that looks for your PayPal column, then calls your function instead of showing the field data.
Hi
I had a look at the URL but I’m still lost. I’m new to php. The way I got it working is to put the PayPal shortcode directly into the papal column field under the participants database, the button is added to each record but the problem is the id is not unique, please can you advise me on how to implement the custom function.
Much appreciated.
Hi
I got the paypal button with reference almost working. I added the following code to the pdb list default.php . The code adds a link to the URL unique if. Please help me change the code to display the first name inplace of the unique id
$name = $record->get_edit_link('record-edit');
if ($this->field->name == 'paypal') {
echo print_wp_cart_button_for_product($name , 100);
}
Try something like:
$name = $record->values['private_id'];
if ($this->field->name == 'paypal') {
echo print_wp_cart_button_for_product($name , 100);
}
Working 100%. Thank you 🙂
I have tried both of the following:
[insert_php]
$current_user = wp_get_current_user();
echo do_shortcode('[pdb_record record_id="' . Participants_Db::get_record_id_by_term('user_login', $current_user->user_login, true) . '"]');
[/insert_php]
[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]
with no luck. It just shows the a blank page, with a strange yellow rectangle.
Any idea why this might be happening?