Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2009-09-26 12:15:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: smd_bio : store additional biographical info about your users

Vienuolis wrote:

I lack only one feature — to display a portrait (photo, picture, avatar) next to the author’s name like in this forum.

Thanks for the kind words — I made the plugin specifically handle photos in a user’s bio so it should work like Example 3 in the plugin help.

<txp:smd_bio_info items="photo" label="">
   <txp:thumbnail id="{smd_bio_photo}" />
</txp:smd_bio_info>

That will display a small author’s photo on the page — assuming a thumbnail exists. If you wish to do some clever stuff like determine if the author has a photo or not, you can combine this with txp:variable and then take action to display an alternative (a ‘no photo’ picture, perhaps). Or use the ability of smd_bio to limit the x and y dimensions of the displayed photo by putting 64 in the ‘size’ field of your photo item which will set both dimensions to the same size.

I admit that the output on the admin side is a little bit rubbish. I intend to eventually allow you to configure which items are displayable in the hover tooltip via some plugin prefs — at the moment it shows an image thumbnail (if there is one) and text items only.

Remember that you can alter the layout of the bio items on the admin side if you create a stylesheet called smd_bio. Combining that with the ‘order’ field should allow you some degree of control over the input fields on the Admin->Users tab.


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

#17 2009-09-26 12:17:39

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 327
Website GitHub GitLab Mastodon Twitter

Re: smd_bio : store additional biographical info about your users

And shown quirky. The tag <txp:smd_bio_info items="foto" break="" /> is converted to HTML as <p><br/ class=" smd_bio_foto">Author's photo</br/>53</p> — as an item title and an ID number instead of the picture itself. Also with non-removable break:

Author's photo
53

The portrait is shown only by the extended code:

<txp:smd_bio_info items="foto" class="author-photo" label="" wraptag="p" break="">
   <txp:image id="{smd_bio_foto}" />
</txp:smd_bio_info>

Offline

#18 2009-09-26 12:32:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: smd_bio : store additional biographical info about your users

Vienuolis wrote:

The tag <txp:smd_bio_info items="foto" break="" /> is …an item title and an ID number instead of the picture itself.

It’s designed that way! Since I have no idea how you wish to format the picture — as a thumb, a full size pic, on hover, in a lightbox, etc — I decided not to limit you to one particular method of display. So the photo type only outputs the ID number of the photo and it’s up to you to do something with it.

Also with non-removable break:

That’s an unfortunate side effect of the labeltag. If you set label="" and still have a labeltag set to something (it is set to the item’s name by default) the core function I use in the plugin automatically inserts a <br />. Rather annoying. To remove the br you are right, you need to specify labeltag="" as well. If I find a decent way round this I’ll implement it in the next version.

I don’t know why the class is set with an extra space at the start though nor why it attaches itself to the erroneous first ‘br’ — I’ll have to look into that, thanks for letting me know.


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

#19 2009-09-26 12:58:52

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 327
Website GitHub GitLab Mastodon Twitter

Re: smd_bio : store additional biographical info about your users

I am sorry, I was not so quick in appending my report. Thanks for your explanation. One only question left: would be reason of setting default <txp:smd_bio_info type="image" /> (or name, items insted of type) behavior to simply display an image in its context? With no error actions if some image does not exist?

Offline

#20 2009-09-26 13:18:42

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 327
Website GitHub GitLab Mastodon Twitter

Re: smd_bio : store additional biographical info about your users

About the break tag. I think in most cases it will less appropriate than simple : between a field name and its container. E.g. RealName: Name Surname. When answer should be more than one line, <dl><dt>Definition term:</dt><dd>definition data</dd></dl> would fit better than <br />, I guess.

Offline

#21 2009-09-26 13:56:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: smd_bio : store additional biographical info about your users

Vienuolis wrote:

<txp:smd_bio_info type="image" /> … simply display an image in its context? With no error actions if some image does not exist?

Hmmm I tried to do that first but it was too limiting. Some people wold complain that outputting the thumbnail by default is “wrong”; others would complain if I used the full size image. So I left the choice to you :-)

The code:

<txp:smd_bio_info items="foto" class="author-photo" label="" wraptag="p" break="">
   <txp:image id="{smd_bio_foto}" />
</txp:smd_bio_info>

will display nothing and produce no error if there is no image to display. If you wish to display a default ‘no avatar’ image you might do this first:

<txp:variable name="has_bio_image" value='<txp:smd_bio_info items="mug">{smd_bio_mug}</txp:smd_bio_info>' />
<txp:if_variable name="has_bio_image" value=""> 
   <p><txp:image name="no-avatar" /></p>
<txp:else />
   <txp:smd_bio_info items="mug" label="" wraptag="p" break="">
      <txp:image id="{smd_bio_mug}" />
   </txp:smd_bio_info>
</txp:if_variable>

I have already raised an enhancement about the break in the labels. Nobody has complained yet so it might make it to the core. If not I’ll have to fix it in the plugins and not use the core’s label functionality.


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

#22 2009-09-26 14:20:01

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 327
Website GitHub GitLab Mastodon Twitter

Re: smd_bio : store additional biographical info about your users

so it should work like Example 3 in the plugin help.
<txp:smd_bio_info items="photo" label="">
<txp:thumbnail id="{smd_bio_photo}" />
</txp:smd_bio_info>
That will display a small author’s photo on the page — assuming a thumbnail exists.

Sorry, all is fine only on the admin side, but on live articles — big versions instead of thumbnails. I have tested 52, 52t, and 52t.jpg — the same result.

Offline

#23 2009-09-26 14:33:23

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 327
Website GitHub GitLab Mastodon Twitter

Re: smd_bio : store additional biographical info about your users

will display nothing and produce no error if there is no image to display.

Thanks, that’s perfect for this my site.

If you wish to display a default ‘no avatar’ image you might do this first:

The great tip — I will save it for the future, thank you very much!

Offline

#24 2009-11-10 15:24:28

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: smd_bio : store additional biographical info about your users

Hi Stef,

Great idea for a plug-in, just about to finalise a blog and this will be perfect. I’m running TXP 4.2.0 (and PHP 5.1.6) but when I click on the Bio Config tab I get the following error:

The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: php-fcgi-starter

Any idea what it all means?

Last edited by decoderltd (2009-11-10 15:24:59)

Offline

#25 2009-11-10 15:58:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: smd_bio : store additional biographical info about your users

decoderltd wrote:

Premature end of script headers: php-fcgi-starter

Bizarre. That normally indicates a PHP environment config problem but why the plugin triggers it I have no idea. Don’t think it’s doing anything out of the ordinary on that tab.

Are you running this on a live site or a local XAMPP? Anything in the log files that might shine some more light on it?


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

#26 2009-11-10 16:15:58

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: smd_bio : store additional biographical info about your users

Hi Stef,

I’m running it on a live site, I’ve checked the Diagnostics tab and everything seems fine.

Offline

#27 2009-11-10 16:30:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: smd_bio : store additional biographical info about your users

Sorry, I meant the server’s log files. Do you have access to those? While you’re in the Diagnostics tab, though, what are the following reported as:

Server
PHP Server API
Server OS

and are you using a stock .htaccess file?

/me clutching at straws

Last edited by Bloke (2009-11-10 16:31:20)


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

#28 2009-11-10 16:54:42

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: smd_bio : store additional biographical info about your users

Hi Stef,

Sorry, I don’t have access to the server logs, but here’s the other info you asked for-

Server: Apache
PHP Server API: cgi-fcgi
Server OS: Linux 2.6.17-11-server

I’m using the following .htaccess settings:

# DirectoryIndex index.php index.html
# Options +FollowSymLinks
# RewriteBase /relative/web/path/

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} -f [OR]
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^(.+) - [PT,L]

 RewriteRule ^(.*) index.php
</IfModule>

Offline

#29 2009-11-24 19:04:01

rsskga
Member
From: San Francisco, CA USA
Registered: 2007-06-23
Posts: 50
Website

Re: smd_bio : store additional biographical info about your users

I think this may be the right place to ask this question… I’ve read through the regarding community-drive TXP article, and am at least somewhat familiar with Manfre’s and Stef’s plugins, as well as Jonathon’s snooz site, Zem_Contact_Reborn, etc.

I’m wondering if anyone has enabled functionality that allows for sending emails to anonymized addresses – i.e. like on a dating site where the recipient’s email address needs to be obscured. On the surface, it seems like this shouldn’t be too hard… Maybe just mapping the anonymized email address to the user’s real email address somehow. Hopefully that way the anonymized emails wouldn’t actually have to exist as a real email address setup at a domain (which I would have no idea how to do dynamically). I don’t want to have to set up actual email forwarding, just a sleight of hand thing. I think that’s adequately secure for my purposes, but I could be naive.

Anyone have any thoughts on this? Advice for how I might approach it? I have some programming skills… should be able to edit and add to other people’s code. Probably not skilled enough to start a plugin from scratch though I’m going to go read the plugin development guidelines.

Thanks!


Swim Kitten, A Magento Site
When nothing but incredibly revealing dresses and swimwear will do

Offline

#30 2009-11-24 19:18:20

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: smd_bio : store additional biographical info about your users

Raina, perhaps this example will get you started

Offline

Board footer

Powered by FluxBB