Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#136 2011-07-13 19:12:40

stephan
Plugin Author
From: Bochum, Germany
Registered: 2004-07-26
Posts: 196
Website

Re: smd_bio : store additional biographical info about your users

It seems that if I add an image type field to my user and do not assign an image that this code will not return null or an empty string (as I had hoped) but it returns the placeholder:

<txp:smd_bio_info fields="author_image" label="">
IMAGE: {smd_bio_author_image}
</txp:smd_bio_info>

Yoko for Textpattern – A free blog themeMinimum Theme – If all you want to do is write.
Note: I am currently not actively using Textpattern, so I am not in the forums very often

Offline

#137 2011-07-13 19:21:09

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

Re: smd_bio : store additional biographical info about your users

stephan wrote:

It seems that if I add an image type field to my user and do not assign an image that this code will not return null or an empty string (as I had hoped) but it returns the placeholder:

Not sure why that one would show output — it’s supposed to keep quiet if it’s missing. I’ll look into it. For now, does the following code fix it, using the new <txp:smd_if_bio> tag?

<txp:smd_bio_info fields="author_image" label="">
   <txp:smd_if_bio field="author_image">
      IMAGE: {smd_bio_author_image}
   </txp:smd_if_bio>
</txp:smd_bio_info>

EDIT: get conditional statements in the right order.

Last edited by Bloke (2011-07-13 19:21:35)


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

Online

#138 2011-07-13 19:33:29

stephan
Plugin Author
From: Bochum, Germany
Registered: 2004-07-26
Posts: 196
Website

Re: smd_bio : store additional biographical info about your users

Nice try, no luck, though:

Tag error: <txp:smd_if_bio field="author_image"> ->  Warning: array_merge(): Argument #1 is not an array  on line 1540
textpattern/lib/txplib_misc.php(653) : eval()'d code:1540 array_merge()
textpattern/publish.php:1188 smd_if_bio()
textpattern/publish.php:1113 processTags()
textpattern/publish/taghandlers.php:3959 parse()
textpattern/publish.php:1188 if_plugin()
textpattern/publish.php:1113 processTags()
textpattern/lib/txplib_misc.php:1706 parse()
textpattern/publish/taghandlers.php:314 parse_form()
textpattern/publish.php:1188 output_form()
textpattern/publish.php:1100 processTags()

Yoko for Textpattern – A free blog themeMinimum Theme – If all you want to do is write.
Note: I am currently not actively using Textpattern, so I am not in the forums very often

Offline

#139 2011-07-14 09:31:45

stephan
Plugin Author
From: Bochum, Germany
Registered: 2004-07-26
Posts: 196
Website

Re: smd_bio : store additional biographical info about your users

One more thing. I noticed that when having a lot of images it gets very tedious to use the drop down list. Could you maybe add an option so that for the type image you can specify a category which can be used to select an image for smd_bio? If it can be set optionally it could greatly improve the management of several user’s images.


Yoko for Textpattern – A free blog themeMinimum Theme – If all you want to do is write.
Note: I am currently not actively using Textpattern, so I am not in the forums very often

Offline

#140 2011-07-14 13:36:46

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

Re: smd_bio : store additional biographical info about your users

stephan wrote:

Could you maybe add an option so that for the type image you can specify a category

Uhhh, from the help:

Value: … for images, it can be used to specify the parent category name under which the desired images are stored. If omitted, all images are available in the image select list

Is that not what you mean?

btw, I’ll look into the error message you cited, hopefully later today.

Last edited by Bloke (2011-07-14 13:37:21)


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

Online

#141 2011-07-14 14:03:16

stephan
Plugin Author
From: Bochum, Germany
Registered: 2004-07-26
Posts: 196
Website

Re: smd_bio : store additional biographical info about your users

Others have cryptonite as a weakness, mine seems to be literacy, I fear. Thanks for pointing in the right direction, this is exactly what I was looking for.


Yoko for Textpattern – A free blog themeMinimum Theme – If all you want to do is write.
Note: I am currently not actively using Textpattern, so I am not in the forums very often

Offline

#142 2011-07-14 15:45:35

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

Re: smd_bio : store additional biographical info about your users

stephan wrote:

Others have cryptonite as a weakness, mine seems to be literacy, I fear

:-) No worries, I do hide things in the docs sometimes.

Regarding the error message, can I just ask: do you only have one extra bio field defined in your theme (i.e. the author_image)? That might account for the warning message and the fact the plugin is falling over. If that is the case I’ll make sure I defend against that eventuality in the code.

Last edited by Bloke (2011-07-14 15:46:14)


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

Online

#143 2011-07-14 16:44:03

stephan
Plugin Author
From: Bochum, Germany
Registered: 2004-07-26
Posts: 196
Website

Re: smd_bio : store additional biographical info about your users

I got two fields: author_bio (textarea) and author_image (image).


Yoko for Textpattern – A free blog themeMinimum Theme – If all you want to do is write.
Note: I am currently not actively using Textpattern, so I am not in the forums very often

Offline

#144 2011-07-14 16:44:32

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

Re: smd_bio : store additional biographical info about your users

Actually, no worries. I’ve just fixed the plugin to get rid of the warning. Try re-downloading the beta and try again.

Sorry for the bug, and thanks for bringing it up.


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

Online

#145 2011-07-14 17:04:18

stephan
Plugin Author
From: Bochum, Germany
Registered: 2004-07-26
Posts: 196
Website

Re: smd_bio : store additional biographical info about your users

Thanks, I got the update. Actually it was michaelkpate who should get all the credit for finding this bug :-)


Yoko for Textpattern – A free blog themeMinimum Theme – If all you want to do is write.
Note: I am currently not actively using Textpattern, so I am not in the forums very often

Offline

#146 2011-07-14 18:51:27

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

Re: smd_bio : store additional biographical info about your users

stephan wrote:

Actually it was michaelkpate who should get all the credit for finding this bug

Oki doke. BTW, when I said earlier about using smd_if_bio, I broke my own rules. smd_if_bio goes inside an smd_bio_info tag.


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

Online

#147 2011-07-25 12:11:25

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: smd_bio : store additional biographical info about your users

Stef,

How might I setup a conditional output for a given field (e.g., inside of an article form output).

E.g., let’s say I’m collecting Linkedin profile URLs and Twitter IDs. But not everyone uses both. So when outputting, there needs to be a conditional so that that if data doesn’t exist, it’s not showing anything.

Here’s how the form code looks at the moment, with the social links at bottom that need to be conditional somehow. I’m trying to get my head around using a variable condition, but not sure that will work, or if so how…

<div id="bio-list">
  <txp:smd_bio_info fields="url_only_title, headshot" label="">
   <a href="<txp:site_url /><txp:section name='board' />/{smd_bio_url_only_title}" title="Profile link">
      <img class="hs" src="<txp:site_url />images/{smd_bio_headshot}.jpg">
   </a>
  </txp:smd_bio_info>
</div><!-- end bio-list -->

<h2><a href="<txp:site_url /><txp:section />/<txp:article_url_title />"><txp:title /></a></h2>

<txp:smd_bio_info fields="iabc_fr_affil" label="">
   <p>{smd_bio_iabc_fr_affil}</p>
</txp:smd_bio_info>

<txp:body />

<txp:smd_bio_info fields="linkedin, twitter" label="">
   <p><a href="{smd_bio_linkedin}">Linkedin profile</a></p>
   <p><a href="http://twitter.com/{smd_bio_twitter}">Twitter</a></p>
</txp:smd_bio_info>

Offline

#148 2011-07-25 12:18:30

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

Re: smd_bio : store additional biographical info about your users

Destry

Look up a few posts :-p

Try:

<txp:smd_bio_info fields="linkedin, twitter" label="">
   <txp:smd_if_bio field="linkedin">
      <p><a href="{smd_bio_linkedin}">Linkedin profile</a></p>
   </txp:smd_if_bio>
   <txp:smd_if_bio field="twitter">
      <p><a href="http://twitter.com/{smd_bio_twitter}">Twitter</a></p>
   </txp:smd_if_bio>
</txp:smd_bio_info>

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

Online

#149 2011-07-25 12:27:44

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: smd_bio : store additional biographical info about your users

Arg! Sorry… It’s even in the doc. / flogging myself /

Offline

#150 2011-07-25 13:04:54

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: smd_bio : store additional biographical info about your users

Hmm. Conditional is working great in relation to the single article form, but not the list article form (per example above), which seems not to be recognizing the conditional. Same conditional code in both forms. Nothing looks visibly out of place in the list form….

I’ll try looking at it later with fresh eyes.

Offline

Board footer

Powered by FluxBB