People Lists
Only show fields to logged in users (4 posts)

  1. schmunk
    Posted 3 years ago #

    Great Plugin!

    I have a list with fields like: phonenumbers and adresses that i only want to show to logged in users. Other fields like: thumb, nickname, name i want to be visible to all.

    How do i do this without creating two lists? I have been fiddling around with this shortcode: http://www.wprecipes.com/wordpress-shortcode-display-content-to-registered-users-only But that did not work.

    Thank you!


  2. Robert.Vidrine
    Posted 3 years ago #

    I'm not connected with the developer of People-lists at all, but found a CSS-only solution for me that works pretty well (to visually hide the private content).
    In the People-lists template builder, I added a class of private, like this:
    <div class="user-address1 private">%people_lists_address1%</div>
    Then, I added a couple of style rules to my CSS stylesheet, like this:

    div.private {
    	display: none;
    .logged-in div.private {
    	display: block;

    And by the magic of WordPress, when a div with the class private is found, it's hidden.
    When a div with the class private is found within the class logged-in (which is added to the body tag automatically by WP, hence the "magic"), the div is displayed as a block (the default for divs).
    NOTE: This does NOT actually keep the information out of the page, it just hides it from visual clients. The content is still there, in the code, and can be seen by search engines. To actually have the content not added to the page, I had to create two lists, a private one and a public one, and put the private one on a separate page. It may be possible to do something with is_user_logged_in within the page template, to add the private list shortcode or the public list shortcode, but then it's getting pretty complicated, and a lot of the plugin's ease is lost...

  3. schmunk
    Posted 3 years ago #

    Neat trick!
    I ended up creating two seperate lists.

    Then i used logged in shortcode to show the lists in one page.


    [loggedin]private list[/loggedin]
    [loggedout]open list[/loggedout]

  4. Robert.Vidrine
    Posted 3 years ago #

    That's cool. I hadn't seen that one. That sounds like it provides an easier, shortcode way of doing the is_logged_in thing, without having to make a separate template and code the lists right into the template (since normally you can't execute PHP code in the page editor).

    I may have to look that one over...

    Thanks for the tip!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • People Lists
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic