WordPress.org

Ready to get started?Download WordPress

Forums

Hide part of post unless logged in (2 posts)

  1. privatestorm
    Member
    Posted 9 years ago #

    Is there a plugin that will allow you to only display part of a post to the general public but the entire post to those that are registered on my site and logged in?

    This is what I want to do: create discography pages for a band site with all of the album info available to the general public. Those that are registered on my site and logged in will be able to see that information PLUS a Flash Play button next to each song.

    Something like this site:
    http://www.dubtribe.com/index.php?p=53
    But with the play button ONLY appearing if the person is logged in.

    Perhaps this could be an added feature to the Hide or Cut Post Text plugin?
    http://www.coffee2code.com/archives/2004/07/25/plugin-hide-or-cut-post-text/

    BTW, I plan to use this Flash MP3 button which works the same as wimpy button but is free:
    http://www.polenmusic.com/portfolio/portf_js.html

  2. privatestorm
    Member
    Posted 9 years ago #

    This is what I have tried so far:
    1) EZStatic plugin
    - installed and checked "Execute page content between <?php ?> as PHP."
    - added this code to the post:
    <?php
    if ($user_login) {
    echo "Message1";
    } else {
    echo "Message2";
    }
    ?>

    - this did not work: even though I was logged in it displayed Message2. when I logged out it still displayed Message2.

    2) PHPExec plugin
    - tried the same code as above but enclosed the code in <phpcode> tags as indicated by the plugin
    - this did not work either: even though I was logged in it displayed Message2. when I logged out it still displayed Message2.

    --
    So what code do I use to detect whether the user is logged in or not??

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.