Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-06-28 20:05:55

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Incorporating the functionality of jmd_author into Textpattern core

I have been spending some time working on custom author templates for a theme, and found there is support for incorporating jmd_author as core functionality from a couple of regular code contributors.

Exhibit 1:

I too use this plugin; it fills a missing gap in the core tag set, and it’s fab. – Bloke

Exhibit 2:

Thanks for mentioning jmd_author, which appears to have all the features Els mentions. Hence it would be a good model for a feature request or patch. – jsoo

Just thought someone should formally make the proposal.

Offline

#2 2011-06-28 20:25:46

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

Re: Incorporating the functionality of jmd_author into Textpattern core

michaelkpate wrote:

Just thought someone should formally make the proposal.

The functionality was partly implemented in 4.3.0 with the addition of the title attribute (a situation I only just rectified in the docs because I forgot about it at the time, sorry).

I do recall trying to find a clever way to get at the other bits of info, primarily e-mail — I even considered modifying the email tag, but thought better of it. Suggestions welcome.


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

#3 2011-06-29 14:33:02

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Incorporating the functionality of jmd_author into Textpattern core

Actually, that was just what I was needing – except for the security issue of displaying the username, but maybe I can figure a way around that.

Thanks, B.

Offline

#4 2011-06-30 01:17:35

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Incorporating the functionality of jmd_author into Textpattern core

I’ve been working on ras_author_credits as a plugin. I’ve gotten a bit carried away with it, and as I go the ease with which new features seem called for suggests that much of this has been done before, and perhaps better. It’s tough to tell where it may overlap with other work and what may be useful as is, and in what direction, if any, if may be useful to go from here. Any opinions would be helpful.

Actual plugin code is here. ras_author_credits_v1.0

There is definitely call for the availability of author and user information on the public side.

Last edited by rsilletti (2011-07-03 01:55:02)

Offline

#5 2011-06-30 21:08:56

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Incorporating the functionality of jmd_author into Textpattern core

I ended up doing things a bit backwards with this bit of code…

<a rel="author" href="<txp:site_url />authors/<txp:php>echo preg_replace("/[ ]+/s", "-", strtolower( trim( author( $atts ) ) ) );</txp:php>"><txp:author /></a></span>

I tried to use aks_var at first, but I couldn’t figure out how to do the lowercase conversion that way. I can’t vouch for the regexp part either; it all came from Google. But it does produce a link in the form:

http://example.com/authors/firstname-lastname

which is just what I wanted.

Offline

#6 2011-06-30 21:44:44

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Incorporating the functionality of jmd_author into Textpattern core

michaelkpate wrote:

Actually, that was just what I was needing – except for the security issue of displaying the username, but maybe I can figure a way around that.

You are referring to a situation where the author doesn’t real name set? That can indeed happen, but is preventable. For example:

<!--
	Set variable name 'author' with author's
	(supposedly) real name.
-->

<txp:variable name="author" value='<txp:author />' />

<!--
	Compare the 'author' variable to author's login name.
	If the name matches, displayed name is the login.
-->

<txp:if_variable name="author" value='<txp:author title="0" />' />
	<!--
		We same, login name.
	-->
<txp:else />
	<!--
		Show the real name if different
	-->
	<txp:variable name="author" />
</txp:if_variable>

Last edited by Gocom (2011-06-30 21:47:28)

Offline

#7 2011-06-30 23:41:02

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Incorporating the functionality of jmd_author into Textpattern core

Gocom wrote:

You are referring to a situation where the author doesn’t real name set?

Actually, I was just thinking of not displaying the author’s username. Make it that much harder for someone trying to hack into an install. I realize that is pretty standard in some cases, but to me, it adds an extra layer of security.

But I hadn’t thought about cases where the author name wasn’t set. I will have to see how your idea and mine mesh together.

Offline

Board footer

Powered by FluxBB