Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi

    Maybe this article could help you : https://xnau.com/adding-an-edit-record-link-to-the-frontend-list/ .
    I used it for my website and I succeeded in putting the word “edit” for the edit link

    Why did you make reduction audio recordings and how did you add this code? Why should all users be able to reduce? Create a better Hotel page “My records”, Plugin stone “PHP code” in it and create such a record”<?PHP
    $current_user = wp_get_current_user();
    Echo but this do_shortcode(‘[pdb_list filter=”user_login=’ . $current_user->user_login . ‘”template=edit-link]’);
    ?> > ”
    Short code that will give the plugin put on the page “My records”. Before all this, create a new field “User Login” make it “hidden” read-only “edit” and put in a separate group, so as not to interfere with the ” Main table “in PHP code is added in a convenient location “fields =” first_name, address, city, edit_link”
    And follow the further instructions by clicking on the link to throw polzovatelem above
    Once you’ve done that, you’ll have a page that shows the current user’s Records with the ability to edit them online
    If that’s not what you wanted, then I’m sorry I couldn’t help you.

    Thread Starter master331

    (@master331)

    @ natriya

    which part of the code you edited?
    if ($this->field->name == ‘edit_link’) {
    $this->field->link = $record->get_edit_link();
    }
    $this->field->print_value();
    ?>
    </td>

    Can you edit this code in this topic?

    Thread Starter master331

    (@master331)

    for natriya…can you put here link of your website?

    @master331 : I replaced the entire <tbody> by the one provided in the article (https://xnau.com/adding-an-edit-record-link-to-the-frontend-list/).

    Maybe you could just use the template provided in the article to test first : https://gist.github.com/xnau/96d5b0a38ed9c78aeca74bd56426f7de#file-pdb-list-edit-link-php

    I cannot share the link of the one I implemented because it is only available to the admin of the website (otherwise everyone would be able to edit every body’s record)

    Let me know if that helped. Otherwise you can post your template and maybe we can find out the needed adjustment.

    Thread Starter master331

    (@master331)

    @natriya

    <?php
    /*
    *
    * template for participants list shortcode output
    *
    * this is the default template which formats the list of records as a table
    * using shortcut functions to display the componenets
    *
    * If you need more control over the display, look at the detailed template
    * (pdb-list-detailed.php) for an example of how this can be done
    *
    * Please note that if you have more than one list on a page, searching, sorting
    * and pagination will not work correctly.
    *
    */
    ?>
    <div class=”wrap <?php echo $this->wrap_class ?>” id=”<?php echo $this->list_anchor ?>”>
    <?php
    /*
    * SEARCH/SORT FORM
    *
    * the search/sort form is only presented when enabled in the shortcode.
    *
    */
    $this->show_search_sort_form();

    /* LIST DISPLAY */
    /*
    * NOTE: the container for the list itself (excluding search and pagination
    * controls) must have a class of “list-container” for AJAX search/sort to
    * function
    */
    ?>
    <table class=”wp-list-table widefat fixed pages list-container” >

    <?php
    // print the count if enabled in the shortcode
    $this->print_list_count($wrap_tag = false);
    ?>
    <?php if ( $record_count > 0 ) : // print only if there are records to show ?>

    <thead>
    <tr>
    <?php /*
    * this function prints headers for all the fields
    * replacement codes:
    * %2$s is the form element type identifier
    * %1$s is the title of the field
    */
    $this->print_header_row( ‘<th class=”%2$s” scope=”col”>%1$s</th>’ );
    ?>
    </tr>
    </thead>

    <tbody>
    <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
    <?php $record = new PDb_Template($this); ?>
    <tr>
    <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>
    <td class=”<?php echo $this->field->name ?>-field”>
    <?php
    /*
    * put the edit link URL into the link property of the field
    */
    if ($this->field->name == ‘edit_link’) {
    $this->field->link = $record->get_edit_link(‘device’);
    }
    $this->field->print_value();
    ?>
    </td>
    <?php endwhile; // each field ?>
    </tr>
    <?php endwhile; // each record ?>
    </tbody>

    <?php else : // if there are no records ?>

    <tbody>
    <tr>
    <td><?php if ($this->is_search_result) echo Participants_Db::$plugin_options[‘no_records_message’] ?></td>
    </tr>
    </tbody>

    <?php endif; // $record_count > 0 ?>

    </table>
    <?php
    /*
    * this shortcut function presents a pagination control with default layout
    */
    $this->show_pagination_control();
    ?>
    </div>

    and in this part $this->field->link = $record->get_edit_link(‘device’);

    slug device is page were i set [pdb_record]

    Hi @master331
    It seems to me that your template is correct.
    Maybe it comes from the definition of the “edit” field itself in the manage field menu of the plugin

    Did you mark it as readonly and with a default value “edit” and a type “placeholder” ?

    • This reply was modified 8 years, 1 month ago by natriya.
    Thread Starter master331

    (@master331)

    you are great!!! πŸ™‚ i entered DEFAULT =edit and VALUE = edit and that resolveed problem

    I’m happy that it helped πŸ™‚
    long live to community mutual assistance πŸ™‚

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Editing single record’ is closed to new replies.