Textpattern Forum

You are not logged in. Register | Login | Help

#11 2009-09-15 22:58:03

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

Re: smd_bio : store additional biographical info about your users

<txp:smd_bio_info author="<txp:mem_profile var="name" />" items="avatar" label="" />
  • Uses <txp:mem_profile var="name" /> to get the author attribute in order to use the logged in user to determine whose stuff to show.
  • The avatar item is an image field defined with smd_bio.
  • Successfully returns 6 in my rendered HTML

Now to slap all that into <txp:thumbnail id="here" />:

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

Funny thing is that this shows <txp:thumbnail id="6" /> when I view source. But apparently the txp tag is not getting parsed and I’ve never seen one make it to the final browser view.

Questions:

1. Is their a better way to pull a users stuff based on who is logged in?
2. Am I thinking to far beyond the scope of this plugin? Would it be better to use another plugin or something to get stuff from the smd_bio table.
3. Is it reasonable to think that the author attribute can be thought of as a container supplied by the rvm, ign, mem plugins of the world in order to trick it into to thinking that it’s talking about an author of articles rather than a user of their account?


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#12 2009-09-15 23:01:40

johnstephens
Plugin Author
From: Harrisonburg, VA
Registered: 2008-06-01
Posts: 834
Website

Re: smd_bio : store additional biographical info about your users

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

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

Last edited by johnstephens (2009-09-15 23:03:15)

Offline

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,916
Website

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.

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: 372
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: 78
Website

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: 5,916
Website

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.

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: 78
Website

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: 5,916
Website

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.

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: 78
Website

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: 78
Website

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

Board footer

Powered by FluxBB