Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#289 2016-06-25 14:55:52

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

Re: smd_bio : store additional biographical info about your users

Bloke wrote #299972:

How are the URLs generated? From smd_bio? Or from the code in your authors section? What does said code do? (paste here and I’ll take a look)

The answer to all of those question is, I don’t know. I thought the whole point of this weird /author/First+Last display thing was that it would generate a link just like that by itself. But let’s put that issue on hold a minute, because I’m not quite out of the woods on the author’s form, apparently…

This is my author’s form code now, which for the most part works (sorry about the large indents):

<txp:if_author>
<txp:smd_bio_author author='<txp:author title="0" />'>
  <txp:smd_bio_info fields="RealName, bio, author_photo, caption, website, twitter, gplus">
    <article class="principle profile grid">
      <h1><txp:smd_bio_data field="RealName" /></h1>
			<section class="c10 m">
				<txp:smd_wrap transform="textile">
					<txp:smd_bio_data field="bio" />
				</txp:smd_wrap>
				<h2>Articles written</h2>
				<txp:smd_bio_articles wraptag="ul" break="li" author='<txp:smd_bio_data field="RealName" />' section="articles"><txp:permlink><txp:title /></txp:permlink></txp:smd_bio_articles>
			</section>
		<figure class="biofigure c6">
			<txp:smd_if_bio field="author_photo">
				<txp:image width="0" height="0" id="<txp:smd_bio_data field="author_photo" />" />
			<txp:else />
				<img src="/assets/img/nohead.png" alt="typewriter">
			</txp:smd_if_bio>
			<figcaption class="headcap">
				<txp:smd_if_bio field="caption">
					<txp:smd_bio_data field="caption" />
				</txp:smd_if_bio>
				<txp:smd_wrap_all wraptag="ul" class="biocaptionlinks">
					<txp:smd_wrap wraptag="li" transform="link|Website">
						<txp:smd_bio_data field="website" />
					</txp:smd_wrap>
					<txp:smd_if_bio field="twitter">
						<txp:smd_if field='<txp:smd_bio_data field="twitter" />' operator="begins" value="http">
							<txp:smd_wrap wraptag="li">
								<a href='<txp:smd_bio_data field="twitter" />'>Twitter</a>
							</txp:smd_wrap>
						<txp:else />
							<txp:smd_wrap wraptag="li" transform="replace||@">
								<a href='https://twitter.com/<txp:smd_bio_data field="twitter" />'>Twitter</a>
							</txp:smd_wrap>
						</txp:smd_if>
					</txp:smd_if_bio>
					<txp:smd_wrap wraptag="li" transform="link|Google+">
						<txp:smd_bio_data field="gplus" />
					</txp:smd_wrap>
				</txp:smd_wrap_all>				
			</figcaption>
		</figure>
    </article>
  </txp:smd_bio_info>
</txp:smd_bio_author>
</txp:if_author>

However, I’m not getting the output for the articles in context of the person (e.g., the CSF Articles seen there), which is this part of the form code:

<txp:smd_bio_articles wraptag="ul" break="li" author='<txp:smd_bio_data field="RealName" />' section="articles"><txp:permlink><txp:title /></txp:permlink></txp:smd_bio_articles>

Is that because the articles can’t output to the homepage?

Offline

#290 2016-06-30 13:03:43

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

Re: smd_bio : store additional biographical info about your users

Coming back to this, Bloke (you’re like, “Oh, crap! This guy is non-stop!”)

I now have the author profile outputting to the homepage and appearing exactly as it appears here, except the list of article titles under the “CSF articles” header are not outputting for reasons that escape me. As mentioned previously, the piece from the authors profile form that’s not cooperating is:

<txp:smd_bio_articles wraptag="ul" break="li" author='<txp:smd_bio_data field="RealName" />' section="articles">
  <txp:permlink><txp:title /></txp:permlink>
</txp:smd_bio_articles>

Where’s the snake?

Offline

#291 2016-06-30 13:17:46

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

Re: smd_bio : store additional biographical info about your users

And here was the only other issue…

Bloke wrote #299972:

How are the URLs generated? From smd_bio? Or from the code in your authors section? What does said code do? (paste here and I’ll take a look)

I didn’t understand what yo meant at first, but I see now. The URL code being passed from the Authors section (the grid of faces):

<a href="<txp:site_url />author/<txp:smd_bio_data field="RealName" />"><span class="author-photo"><img src="/images/<txp:smd_bio_data field="author_photo" />.jpg" alt="<txp:smd_bio_data field="RealName" />" /></span><span class="author-name"><txp:smd_bio_data field="RealName" /></span></a>

Kind of messy.

So instead of links like ../author/Destry%20Wion or ../author/Destry+Wion, I’m hoping there’s some smd_wrap (?) magic we can do to make them of pattern ../author/destry-wion. The main reason being I can then do bulk redirects on them all. Most important, though, is to not have %20 showing up in the URLs, ever.

Offline

#292 2016-06-30 13:32:06

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

Re: smd_bio : store additional biographical info about your users

Destry wrote #300055:

except the list of article titles under the “CSF articles” header are not outputting

Hmmm, I can see a list of articles on your page in which, incidentally, your headshot is rather fetching with the whole Obi-Wan Kenobi thing going on :-)

I’m going to try and fix the admin-side MySQL errors in the plugin today, so at least I can test this more thoroughly with your actual code. Sorry for the delay.

Where’s the snake?

On a plane.


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

#293 2016-06-30 13:48:44

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

Re: smd_bio : store additional biographical info about your users

Destry wrote #300056:

<a href="<txp:site_url />author/<txp:smd_bio_data field="RealName" />">

Aha! Since you’re constructing the URLs by hand here in the href attribute, you can put whatever you like. If you’re lucky enough to have created forename and surname bio fields separately:

<a href="<txp:site_url />author/<txp:smd_bio_data field="forename" />-<txp:smd_bio_data field="surname" />"> ...

But if all you have is the RealName field then yeah some wrapper will do it:

<a href="<txp:site_url />author/<txp:smd_wrap_all transform="case|lower, replace|| |-"><txp:smd_bio_data field="RealName" /></txp:smd_wrap_all>"> ...

You should then be able to redirect to the RealName behind the scenes and serve the page. With luck.


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

#294 2016-06-30 14:03:31

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

Re: smd_bio : store additional biographical info about your users

Bloke wrote #300057:

Hmmm, I can see a list of articles on your page…

Yeah, that’s production, still running the Txp 4.5.7 old-school build with gbp_perm_links and a dedicated /people section for both list and bio.

But locally it’s refactored to drop gbp_p_l and use the homepage now for bio. It’s just the list of article titles that won’t spit out.

Offline

#295 2016-06-30 14:11:49

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

Re: smd_bio : store additional biographical info about your users

Bloke wrote #300058:

Aha! … If you’re lucky enough to have created forename and surname bio fields separately

I didn’t. And currently I can’t seem to create new bio fields (the bug). I’ll go with the wrap and maybe adjust later. Thank you so much!

Offline

#296 2016-06-30 14:15:44

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

Re: smd_bio : store additional biographical info about your users

Bloke wrote #300057:

incidentally, your headshot is rather fetching with the whole Obi-Wan Kenobi thing going on :-)

I rather like yours too… The static-infused video relay from the future. Reminds me of that scene in The Dark Prince, of exactly that: someone in the apocalyptic future trying to contact the past (our present) warning to not, in fact, let the devil’s spawn breach our dimension.

Offline

#297 2016-07-01 11:13:57

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

Re: smd_bio : store additional biographical info about your users

Bloke wrote #300058:

But if all you have is the RealName field then yeah some wrapper will do it:

<a href="<txp:site_url />author/<txp:smd_wrap_all transform="case|lower, replace|| |-"><txp:smd_bio_data field="RealName" /></txp:smd_wrap_all>"> ......

You should then be able to redirect to the RealName behind the scenes and serve the page. With luck.

Unfortunately it’s throwing a 404 error. Redirects don’t seem to help.

Offline

#298 2016-07-01 11:16:51

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

Re: smd_bio : store additional biographical info about your users

Destry wrote #300097:

Unfortunately it’s throwing a 404 error. Redirects don’t seem to help.

Figures. Txp interprets those quite a way up the chain.

Are your redirects in .htaccess, btw? If not, you might have more luck putting them there instead of in smd_redirect, since the latter runs after Txp interprets special URLs such as /author and /category.


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

#299 2016-07-01 11:19:11

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

Re: smd_bio : store additional biographical info about your users

I will try that.

Offline

#300 2016-07-01 12:32:29

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

Re: smd_bio : store additional biographical info about your users

Not working, though it could be how I’m adding the redirects.

I’m just adding something like this as a test at bottom of the .htaccess file of local dev

Redirect 301 /people/destry-wion http://csf.dev/author/destry-wion

Maybe there’s some other lines I’m supposed to accompany that with? Or a particular place in the file lineup I’m supposed to put it?

Offline

Board footer

Powered by FluxBB