Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-27 19:03:59

draganbabic
Member
From: Novi Sad, Serbia
Registered: 2006-09-27
Posts: 118
Website

Show a specific article to a specific user

Hi guys, here’s my problem. I have set up ign_password_protect plugin to protect a section of a site used for clients. It is just a page where a client can log in and download a file. Nothing more.

I simply create a new author within Textpattern and I am able to log in and view that section. Since there is a need of multiple clients – I need a way of showing a specific article depending on which user is logged in. Is there a way to do this?

To make matters worse – this needs to be done by a Textpattern novice – i.e. a trained client of mine who is not very Web savvy, so I can’t make him make a new section-per-client or anything like that.

Offline

#2 2007-12-27 19:30:29

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Show a specific article to a specific user

custom fields maybe?

does each client need to view a specific article only?

you could create a custom field named “client_name”. then for your each client article, just fill that client_name custom field with their specific username. then you could use @<txp:article client_name=”<txp:ign_current_user />” (or whatever the tag is for the current logged in user. i don’t use ign_password_protect sorry)

Last edited by iblastoff (2007-12-27 19:31:06)

Offline

#3 2007-12-27 19:41:35

draganbabic
Member
From: Novi Sad, Serbia
Registered: 2006-09-27
Posts: 118
Website

Re: Show a specific article to a specific user

I have come to this same solution by messing with it myself, but it seems asy_wondertag is giving me troubles, here is my page template:

<txp:asy_wondertag><txp:article_custom form="articleClients" limit="1" category="<txp:custom_field name="client-name" />" /></txp:asy_wondertag>

As you can see, I am trying to display articles that are from the category specifically made for that client (I will tell him to name the categories exactly the same as he names the clients, and put exactly that into the custom field for clarity). For some reason, I get this error:

Tag error:  <txp:custom_field name="client-name" /> ->  Textpattern Notice: Article tags cannot be used outside an article context  on line 1887

This is all in a article listing URI, e.g. http://mysite.com/clients/.

Offline

#4 2007-12-27 19:49:16

draganbabic
Member
From: Novi Sad, Serbia
Registered: 2006-09-27
Posts: 118
Website

Re: Show a specific article to a specific user

Here is my current solution:

          <txp:ign_if_logged_in>
          <div class="itemWrap">
            <txp:if_article_list><p>You are logged in</p><txp:else /><txp:article form="articleClients" limit="1" /></txp:if_article_list>
              <p><txp:ign_logged_user /></p>
          </div> <!-- .itemWrap -->
          <txp:else />
          <txp:ign_show_login login_msg="Please log in" />
          </txp:ign_if_logged_in>

So you see – if the client logs in to the http://mysite.com/clients/ address, after a successful login I display him a message – “you are logged in” ad after that he can’t go anywhere. He needs to know the URL to his project in order to see the article that is meant for him. Talk about security by obscurity, huh?

This is the best I could come up with, I’d love to be able to give the user a link to his project’s article, but I just can’t think of how.

Offline

#5 2007-12-27 21:21:52

draganbabic
Member
From: Novi Sad, Serbia
Registered: 2006-09-27
Posts: 118
Website

Re: Show a specific article to a specific user

I have just posted on ign_password_protect thread since it looks like I don’t even have the right version of the plugin. :(

Offline

Board footer

Powered by FluxBB