Textpattern CMS support forum
- From: Plymouth
- Registered: 2008-05-22
- Posts: 72
Hope the TXP community can point me in the right direction.
A HR client is wanting to create a members area where their clients can log in and view their documents
Is this possible in TXP? It needs to be easy for them to setup a client and assign certain files etc so that the client and simply login and view them
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 8,495
Re: Members Area
miles wrote #315371:
create a members area where their clients can log in and view their documents
Public login can be handled by a few plugins. mck_login is one. cbe_frontauth (which has a companion plugin for extra functionality) is another. They both have stylable public-side login forms, or you can just direct people to the admin-login page if you fancy styling that up to look a bit corporate, but then you have to lock away the admin side (actually, you probably should do that anyway to such users or create a dedicated user group with no admin-side privs using smd_user_manager when it is eventually updated to be 4.7 compatible).
I think those login plugins both allow self-registration too but I can’t remember. If that’s not a requirement (e.g. your client is setting up accounts on behalf of their clients) then that’s no problem.
assign certain files etc so that the client and simply login and view them
Txp 4.7 has the
<txp:if_logged_in> tag which takes a
group attribute that accepts a comma-separated list of user roles. You can create a section with a template that is wrapped in that tag. Or you can go even more granular and limit the contained content to individual users.
If it’s unique files/articles/images then I would be tempted to simply get the client to upload all the content and assign the relevant Txp author to each. Inside your
<txp:if_logged_in> container you can then use the
author attribute of
<txp:file_download_list> etc to only show content for a specific author.
The trick here will be to feed the attribute with the “current logged-in user”. As far as I recall, we don’t have a tag to output that but you can get at it:
<txp:php>global $txp_user; return $txp_user;</txp:php>
Untested, but if you make a new Form called
current_user and stick the above code in it (doesn’t matter what Type; Misc is fine) then you should be able use it as a shortcode tag:
<txp:article_custom author='<txp::current_user />'> // Tags to show current user's content here </txp:article_custom>
Hope that helps.
Last edited by Bloke (2018-11-21 12:59:01)