Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#196 2012-04-26 19:11:02
Re: smd_bio : store additional biographical info about your users
If you are using access to the restricted area as a means of collecting user data and don’t actually need your users to have an account, you might want to try an alternative approach using a combination of mem_simple_form + mem_form to create a custom collect form that saves to a custom_database (you need to set this up manually) and smd_access_keys to generate an access code.
If you don’t actually need to store the user data on the system, you could also do a normal zem_contact_reborn form which sends the user data as a mail, and create and show the smd_access_key in the thanks_form that shows after the form has been submitted.
TXP Builders – finely-crafted code, design and txp
Offline
#197 2012-04-26 20:25:49
- drudog
- Member
- Registered: 2011-02-01
- Posts: 20
Re: smd_bio : store additional biographical info about your users
Thanks for the ideas, Jakob!
I would like to keep a user’s contact info in a database and have it handled similar to the way postmaster handles it. Specifically, the bit where it allows a CSV export of the fields so that it can be imported elsewhere. (I apologize, scope creep is a #%&). This is getting to be quite a hack and I’m not sure it can be done. Further thoughts are appreciated!
On a side note, I’m having trouble installing the plugin. I’m not excited about it, but I’ve had to install txp on a IIs server for this site if that makes a difference.
EDIT: See next post (below) for more details
Last edited by drudog (2012-04-27 12:57:00)
Offline
#198 2012-04-26 21:52:42
Re: smd_bio : store additional biographical info about your users
Hmm, smd_bio certainly is a way to store more information about an author that is registered to the back end, however I’m not sure that this information can be collected at the same time as signing up with mem_self_register.
I suppose you could request the additional information after the new member logs in the first time by making a landing page that asks for the additional fields first. You could do that by making that page check if the required fields already exist in the database (e.g. output one of the smd_bio fields into a txp:variable, then use txp:if_variable name="myvar" value="" to test if it is empty):
- if required fields are empty show the visitor the form (using mem_simple_form / mem_form for example, or perhaps smd_bio),
- otherwise proceed straight to showing the content in the restricted area.
That might be a two-step approach that achieves the same thing.
I’m not familiar with postmaster, but you can make your own csv-export page template, for example using a dedicated section that outputs your fields in the structure of the csv and mg_setheader or alternatively with rah_external_output (that handles both code output and content/type) to make txp serve that page as a csv file. Seeing as csv is just a text-only format, you can also save the page straight from the browser. If you’re wondering how to output database fields that are not textpattern articles, either use the smd_bio tags (if you’re using smd_bio to store them) or look at smd_query.
No idea about the error message, sorry.
TXP Builders – finely-crafted code, design and txp
Offline
#199 2012-04-27 12:13:50
- drudog
- Member
- Registered: 2011-02-01
- Posts: 20
Re: smd_bio : store additional biographical info about your users
Ok the 2-step approach seems to be a slick method as well, however I’m a little hazy on some of the details (please bear with me!)
1. I use mem-self-register to create the account (got that part!)
2. In the automated email sent upon successful registration the link provided takes the user to a page where they log in with their credentials (ign-if-logged-in):
* if certain data is not available from smd-bio it askes for the missing info (this is the hazy part, not sure how to export smd-bio info to a variable and test for that variable)
* otherwise proceed to protected page
3. CSV file creation: so you’re saying just make a simple page/section that is created using txp tags and serving that page as simple text so that one can just copy and paste the info?
EDIT: Also, anyone know if this plugin is compatible with a IIs (windoze) server? I’m having trouble accessing the extensions -> Bio_Config tab after installation.
Last edited by drudog (2012-04-27 13:01:04)
Offline
#200 2012-04-27 14:58:55
Re: smd_bio : store additional biographical info about your users
I haven’t used the most recent version of smd_bio and I believe it has new, improved functionality now. My last attempt at using the plugin was this which is an example of using mem_simple_form to populate to the smd_bio fields (code example in the same thread). That might be some help in creating a form to input the smd_bio data. That example is in an admin tab but it should work in a password-protected front-end pane too.
For 2) You can output smd_bio details using the txp:smd_bio_info tag. The basic principle for testing with if_variable is to output a desired item into a txp:variable. If data has been provided this variable will contain something. Note: it’s important that you just output the item and silence any labels, break, wraptag, blank lines etc. that might count as output even if no data has been provided. You then test to see if the variable you just created is empty … something like this:
<txp:variable name="required_department"><txp:smd_bio_info item="department" label="">{smd_bio_department}</txp:smd_bio_info></txp:variable>
<txp:if_variable name="required_department" value="">
<!-- required info incomplete : present form here -->
<txp:else />
<!-- required info exists: show member-only infos -->
</txp:if_variable>
Untested but you get the idea, I hope. If you are having problems, try outputting <txp:variable name="required_department" /> temporarily to see if it really is empty when no data is provided.
3) That’s the principle. A normal page_template just outputs text but it’s served as an html page. If you leave out the html tags, it will output text on the screen. If you want the browser to not try and decipher it, you can set the content-type as described in the other thread you found. You can then use the browser’s “save …” function to save the file. You might have to experiment with your csv delimiter character and line-endings to get a constellation that works well for you or your client (and language, for example in Germany a semi-colon is often used instead of the comma, as commas are used for decimal numbers).
Sorry, I have no idea about windows server. Maybe it’s related to the php-version your IIS server provides?
TXP Builders – finely-crafted code, design and txp
Offline
#201 2012-04-27 15:22:46
- drudog
- Member
- Registered: 2011-02-01
- Posts: 20
Re: smd_bio : store additional biographical info about your users
Fantastic rundown, Jakob. One million thanks to you for your input!
I’ll dig in and start to string some of this together and keep you updated on the progress.
Thanks again.
Offline
#202 2012-04-30 22:06:06
Re: smd_bio : store additional biographical info about your users
jakob wrote:
I haven’t used the most recent version of smd_bio and I believe it has new, improved functionality now.
Yes, most notably the fact that the concept of authors and fields have their own tags. Also, you don’t necessarily need the txp:variable trick because v0.40beta (which, as far as I’m concerned, is probably the final version in all but name and just needs me to get round to flicking the release switch) has <txp:smd_if_bio> for rudimentary conditional testing of bio field data. That also bypasses all that messy label-silencing malarky.
drudog
I too have no idea about IIS and no way to test it, sorry. If you would like me to take a look in situ, feel free to mail me a login to your site and I’ll see if I can figure it out directly on your server.
Last edited by Bloke (2012-04-30 22:07:24)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#203 2012-05-01 13:34:50
- drudog
- Member
- Registered: 2011-02-01
- Posts: 20
Re: smd_bio : store additional biographical info about your users
PM sent. Thanks Bloke.
Offline
#204 2012-05-29 13:21:48
- Teemu
- Member
- From: Shanghai
- Registered: 2010-04-27
- Posts: 60
Re: smd_bio : store additional biographical info about your users
Stef,
Imputing Chinese characters to a text field returns question marks. Any possibility to get this to support special characters? Latin umlauts seem to work fine though.
Offline
#205 2012-05-29 13:47:21
- Teemu
- Member
- From: Shanghai
- Registered: 2010-04-27
- Posts: 60
Re: smd_bio : store additional biographical info about your users
Another question:
When using <txp:smd_bio_data> and widget setting on front-end, my textareas don’t have any size attributes? Textarea size settings work in the backend user manager . I use beta 0.40 with mem_form.
Offline
#206 2012-05-29 15:42:57
Re: smd_bio : store additional biographical info about your users
Teemu wrote:
Any possibility to get this to support special characters?
Ooops, I forgot to set the table collation properly. Try the latest beta which will upgrade the tables to UTF-8 when you next visit the Bio config panel. Should also fix the textarea sizes for you.
Please let me know how you get on. I’m planning to release this version later today.
Last edited by Bloke (2012-05-29 15:43:38)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#207 2012-05-30 02:42:43
- Teemu
- Member
- From: Shanghai
- Registered: 2010-04-27
- Posts: 60
Re: smd_bio : store additional biographical info about your users
New beta works great. I uninstalled the old plugin and then installed the new one, which seems to clear the smd_bio tables, but won’t drop them though. Fortunately I had only test data in.
Another question…
When displaying data from textarea with <txp:smd_bio_data> value attribute, would it be possible to keep line breaks as it shows inside the textarea?
Last edited by Teemu (2012-05-30 04:22:25)
Offline
#208 2012-05-30 03:09:56
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: smd_bio : store additional biographical info about your users
I just plugged in the beta download to take it for a spin, and I have some warnings that are persistent in all production status modes when I access the extensions tab. Nothing special about the environment I’m running it in.
Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘.COLUMNS where table_name = ‘mobilesmd_bio_meta’ AND table_schema = ‘textpattern’ at line 1 select COLLATION_NAME from mobileINFORMATION_SCHEMA.COLUMNS as INFORMATION_SCHEMA.COLUMNS where table_name = ‘mobilesmd_bio_meta’ AND table_schema = ‘textpattern’ AND column_name = ‘title’ in /Applications/MAMP/htdocs/mobile/textpattern/lib/txplib_db.php on line 89
Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘.COLUMNS where table_name = ‘mobilesmd_bio’ AND table_schema = ‘textpattern’ AND’ at line 1 select COLLATION_NAME from mobileINFORMATION_SCHEMA.COLUMNS as INFORMATION_SCHEMA.COLUMNS where table_name = ‘mobilesmd_bio’ AND table_schema = ‘textpattern’ AND column_name = ‘user_ref’ in /Applications/MAMP/htdocs/mobile/textpattern/lib/txplib_db.php on line 89
Textpattern version: 4.4.1 (r3575)
Last update: 2012-05-13 01:19:59/2011-06-18 05:17:14
Document root: /Applications/MAMP/htdocs
$path_to_site: /Applications/MAMP/htdocs/mobile
Textpattern path: /Applications/MAMP/htdocs/mobile/textpattern
Permanent link mode: section_id_title
upload_tmp_dir: /Applications/MAMP/tmp/php
Temporary directory path: /Applications/MAMP/htdocs/mobile/textpattern/tmp
Site URL: localhost:8888/mobile
PHP version: 5.3.6
GD Image Library: bundled (2.0.34 compatible); supported formats: GIF, JPG, PNG.
Server TZ: America/Denver
Server local time: 2012-05-29 20:55:46
DST enabled?: 0
Automatically adjust DST setting?: 0
Time zone: (+64800)
MySQL: 5.5.9
Locale: en_GB.UTF-8
Server: Apache
Apache version: Apache
PHP server API: apache2handler
RFC 2616 headers:
Server OS: Darwin 10.8.0
Active plugins: smd_bio-0.40
Admin-side theme: classic 4.4.1
Pre-flight check:
————————————
/Applications/MAMP/htdocs/mobile/textpattern/setup/ still exists
————————————
.htaccess file contents:
————————————
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
#ErrorDocument 403 default
<IfModule mod_rewrite.c> RewriteEngine On #RewriteBase /relative/web/path/
RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* – [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
#php_value register_globals 0
————————————
Offline
#209 2012-05-30 08:29:11
Re: smd_bio : store additional biographical info about your users
Teemu wrote:
New beta works great. I uninstalled the old plugin and then installed the new one, which seems to clear the smd_bio tables
It’s suposed to do both. Best upgrade path is simply to reinstall the new one so data is preserved. I’ll have to look into why it’s not dropping the tables on deletion.
When displaying data from textarea with <txp:smd_bio_data> value attribute, would it be possible to keep line breaks as it shows inside the textarea?
Ah, didn’t test that bit. Of course it should. I’ll fix that for you today, with luck.
rsilletti wrote:
…INFORMATION_SCHEMA.COLUMNS…
For some reason on some servers, this pops up. Since I run the upgrade check on every visit to the Bio config panel you’ll see it every time. I normally silence the warnings with PHP’s @ before the call but forgot this time. Will fix.
Out of curiosity, did your tables get upgraded to utf8-general-ci, or are they still latin? I have never worked out if this warning means the table alteration fails or succeeds.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#210 2012-05-30 11:00:30
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: smd_bio : store additional biographical info about your users
Tables are currently set to utf8-general-ci.
Offline