Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Members section with existing data
I will have to build a TXP website with a members section. The pages of the members section should be password protected (not TXP users). My client has already ~100 members and I will have to convert the existing data of all members from Excel to a MySQL database. There are ~30 fields for each member in the existing spreadhseet.
New members will fill out an online form and will get a password assigned from the administrator.
The administrator should be able to search all the fields of the database and edit all fields as well. I’m planning to write this all in PHP (unless a out-of-the-box tool is available).
This brings up a few questions:
• Do I add the existing members data, which might contain various tables to the TXP database?
• I think ign_password_protect (which I have used before) won’t work, since I would have to create all existing members as TXP users. Will it be best to create all the members area login code in PHP, using sessions for security?
• How does PHP code and TXP code work together? Can I call TXP tags inside PHP code?
• Can a plugin like smd_query do all the work for the administrator in querying the members database? This will only be good for queries and not for changes of entries, correct?
• Is there a out-of-the-box tool available for the administration of all database entries, or is it best to code all administrator queries from scratch?
Lots of questions, but it would be good to get some pointers in the right direction, before I get started.
Many thanks in advance.
Offline
Re: Members section with existing data
otti wrote:
Do I add the existing members data, which might contain various tables to the TXP database?
You can. TXP will ignore them but you’ll be able to get at them from the core functions in lib/txplib_db.php
. You may also like to check out smd_bio which offers the ability to manage biographical information about (TXP) users should you decide to migrate the user info to TXP’s own tables. For member management I’d love someone to try out a combination of mem_form/mem_simple_form and smd_bio to do front-end editing of extended profile info. Perhaps you could be the guinea pig? ;-)
I think ign_password_protect (which I have used before) won’t work, since I would have to create all existing members as TXP users. Will it be best to create all the members area login code in PHP, using sessions for security?
Probably sessions, yes. You’re right that ign_pw_protect validates against the TXP table or its own table. But if you do migrate the users to TXP tables, I can heartily recommend rvm_privileged and some clever tweaks to the look of the login page so it appears your users are logging into the front end but they are really logging into TXP whereby they are redirected back to your web site’s front end. Works a treat and is more robust than ign_pw_protect at the moment.
Can I call TXP tags inside PHP code?
Yes. Every tag has an equivalent function name, e.g.:
<txp:related_articles section="foo" sort="Title desc" />
is:
echo related_articles(array("section" => "foo", "sort" => "Title desc"));
Can a plugin like smd_query do all the work for the administrator in querying the members database? This will only be good for queries and not for changes of entries, correct?
It can do it all if you wish: world domination, global thermonuclear war… :-p You can insert, delete, update, select, alter… whatever you like. The limit is your imagination. But for more structured alterations I suggest checking out mem_simple_form and some of the other plugins in Manfre’s arsenal. They may make life easier than doing it by hand in SQL.
Is there a out-of-the-box tool available for the administration of all database entries
There are plugins to look at the tables (rss_admin_db_manager) or your prefs (smd_prefalizer) which may help you to look at the table structures and data from TXP — instead of firing up phpMyAdmin — but nothing I know of that can build queries. Look at the safe_*()
functions in lib/txplib_db.php
as these allow you to do simplish queries using parameters without having to write entire queries from scratch.
Hope that helps some.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Members section with existing data
Thanks Bloke for those pointers.
I think I will create a separate database, just because it stays then portable.
I will create PHP scripts for login etc using sessions.
It is great to know that I can use TXP tags inside PHP code. I tried to use TXP code inside PHP before and couldn’t get it to work. Where do I find more information about combining TXP code with TXP code?
rss_admin_db_manager does a lot of good things, but I can’t get my client to access the database via this tool and query via an SQL window. I think that will be too hard for them (also a bit risky). smd_prefalizer, as you mentioned is good for structure, but I really look for something where I can allow the administrator to query all database entries and fields in a simple way. So, maybe mem_simple_form or smd_query it will be.
Thanks again.
Offline
Pages: 1