Participants Database
[resolved] Use a different record display template for administrators (4 posts)

  1. greenweeds
    Posted 3 years ago #

    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?


  2. xnau webdesign
    Plugin Author

    Posted 3 years ago #

    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.

  3. greenweeds
    Posted 3 years ago #

    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....)

  4. greenweeds
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Participants Database
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic