Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-09-15 23:13:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: smd_bio : store additional biographical info about your users

Or perhaps this untested update to johnstephens’ solution…

<txp:thumbnail id='<txp:smd_bio_info author=''<txp:mem_profile var="name" />'' items="avatar" label="" />' />

(note the dual single quotes around the mem_profile tag to stop the thumbnail’s ID from prematurely finding the solitary single quote and thinking it’s the end of its attribute. It makes a difference on some tags — don’t ask! More on Textbook)

Last edited by Bloke (2009-09-15 23:23:01)


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

#14 2009-09-15 23:16:16

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: smd_bio : store additional biographical info about your users

johnstephens wrote:

Single quotes are required to parse txp:tags within txp:tags.

Thank you!!!

This does most certainly work:

<txp:thumbnail id='<txp:smd_bio_info author='<txp:mem_profile var="name" />' items="avatar" label="" />' />

Today has been too good in TXP forum world. There are a number of people on the forums here who have answered all the many of my questions within minutes as if the whole purpose of the forum was for people to wait on me. :) Thank you all.


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#15 2009-09-26 11:43:21

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

Re: smd_bio : store additional biographical info about your users

I am very impressed by power, usability, smooth integration to TxP, and overall elegance of smd_bio. And I am sorry to leave it and installing rss_author_info instead.

Since I have already made a separate section for author profiles with implemented <txp:author link="1" /> on my multi-user site, I lack only one feature — to display a portrait (photo, picture, avatar) next to the author’s name like in this forum.

All went well on admin side. On Extentions: Bio Config tab I have made one bio item named photo, selected type — Image. On Admin: Users tab — a drop-down selection of author photos appears.

While selectet, e.g. 52.jpg, its thumbnail 52t.jpg appears below and even hover infotip <img src="http://localhost/local.on.lt/images/52t.jpg" alt="Tomas" title="Tomas Baranauskas" width="64" height="64" /><br/> with this picture popups. But really the big 52.jpg version is displaying instead of 64×64 thumbnail 52t.jpg on this author’s live articles.

If only one small picture 53.jpg is associated with the author, it is shown on the bottom of Edit author settings, although not over his item on the list — hover popups only <br/> and background color — instead of the thumbnail. Although 53.jpg picture now is shown on this author’s live articles as should.

Offline

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
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.

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: 310
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: 11,445
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.

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: 310
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: 310
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: 11,445
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.

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: 310
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: 310
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

Board footer

Powered by FluxBB