Support » Plugin: Participants Database » Use a different record display template for administrators

  • Resolved greenweeds


    My scenario:
    A user can update their record as per standard functionality.
    When an administrator clicks on the private_id link in the template, I would like a custom template page to be used where I have coded an additional link to automatically publish the participant’s record as a standard wordpress post.
    Everything is working EXCEPT that at the moment the admin link goes to the same page as the registered users link – which is set as a page in the settings – and consequently the option is either to provide the “publish” button to both parties or not to provide it at all and find a different way ..
    Can I give them different pages please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign


    Yes, you can do this by using a custom template for your [pdb_list] shortcode. Put a line like this after the line that contains $this->the_field():

    <?php if ($this->field->name == 'last_name' && is_user_logged_in()) $this->field->options['single_record_page'] = 120; ?>

    Change out the value the field name is matching to b the field you have your links on, and change the number ‘120’ to the ID of the page your logged-in users should access. If you want to restrict access to only certain types of users, use “current_user_can()” in the if test as well.

    Excellent thanks!
    I will give this a try and report the (positive) news…
    The extension is fab by the way… I’m looking forward to the oohs and aahs of admiration from our users (I wish….)

    Thank you, this was the solution.
    In case it helps anyone else, what I did in the end was use your suggestion but I created a custom version of pdb-record. If someone is logged into wordpress and uses the private id link to access the record page, then the publish-the-post link is shown, whereas if someone clicks on the private id link from their membership email, they are not logged in so they don’t get the publish link.
    Works a treat, thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Use a different record display template for administrators’ is closed to new replies.