Forums

[resolved] How to restrict access to certain 'parts' of a page? (3 posts)

  1. do77
    Member
    Posted 1 year ago #

    Hi,

    I would like to make certain parts of a page only accessible to registered users.

    Each post comes with contact information of the author (e-mail etc.). While the actual post should be accessible to everyone, only registered users should be able to read the contact information. If you are not logged in, a grey box (or so) should appear, where usually the contact information are showed, saying 'you need to be logged in to view this part'.

    Aynone an idea how to achieve that? Is there a plugin or should I do it with an if statement? The contact information of the author are inserted via a custom field.

    Thanks,
    do77

  2. do77
    Member
    Posted 1 year ago #

    Can I actually use this conditional tag and call the custom field within the echo '' ?

    ?php
    if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    };
    ?>
  3. Tccwebmaster
    Member
    Posted 6 months ago #

    I need to do exactly the same thing...almost: need different levels of logged-in users. Members-only access to the sensitive part of pages, and sensitive parts blocked to non-logged in AND folks who register for the purpose of buying tickets for events open to the public (using Events Manager plugin for that)

    Would your idea work with custom roles? And on posts? (I think events added in Events Manager are technically posts)

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.