• I RUN A WORDPRESS BLOG AND I POST Links to different stuff like open source programs, freewares etc…. i actually want that the visitors (unregistered or those who didnt login) should be able to see my whole post but not the links,,, and in the links space it should be written “register or sign in to view links” only registered and logged in users should be able to see the download links….is it possible?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Don’t know of any plugin that would do this across a whole blog.

    Thread Starter darkppl

    (@darkppl)

    what about doing it for each post individually?

    My plugin hopefully can do this ( http://wordpress.org/extend/plugins/replace/ ). It searches for patterns and replaces it with specified string…

    I’ve just committed a possibility to specify different replaces for authenticated and non-authenticated users… (New in version 0.1.3)

    Did some tests… Warning, it is “beta-feature” but seems to work. I hate this but… “It works for me”.

    I’ll be back tomorrow and i’ll do some more tests.

    This will work.

    Probably you need another possibility: to specify “some posts” (by post IDs or in “Edit post” page) to be processed etc — this is “not available yet”; so you’ll need to fine-grain your regular expressions for links (by adding class="forregistered" or like that).

    SORRY

    Didn’t add re.place-restrs.php yesterday. Corrected.

    Anyway, it is working but still is being tested.

    Thread Starter darkppl

    (@darkppl)

    well dor can u tell me in detail for can i hide links in posts individually?

    Well, i plan to add a “restriction” to replace on certain post IDs (entered as comma-separated list)… so now you can do this on _links_ individually…

    For example, write

    <a href="..." class="forregistered">Link for registered</a>

    if you wish this link to be accessible by registered users only.

    Then add re.place entry let’s say like this:

    Search pattern:

    (<a [^>]* class="forregistered"[^>]*>([^<]*)<\/a>)

    Replace pattern:

    \1

    Restriction: for authenticated users

    Otherwise use:

    \2

    This will replace links with link text for guests; so <a href="...">Test it</a> will become Test it.

    In “Otherwise” field you can write smth like this:

    <span class="forguests" title="For registered users only">\2</span>

    … or:

    <a href="/your/registration/url?redirect_to=\2">\2</a>

    In above — you can change search pattern to have an original link URL as an \<digit> for reference.

    Also, a “tag” for links to be replaced must not be class="smth", you can use other “tags”.

    Well, i know, this a bit ugly if you need to do this on some posts basic, with no manual intervention like class=”smth” or the like… Hope i’ll add this possibility later.

    Now i’m figuring out how to change GUI to make it convenient if filled with this and possible other features.

    Thread Starter darkppl

    (@darkppl)

    well thats hefty work… aint there anything simple to do that?

    🙂

    You’re right.

    Yes, re.place hasn’t been created for this specific task.

    About anything simple… It seems that nobody knows so far 🙁

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘links for registered users only’ is closed to new replies.