Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#109 2011-06-19 19:20:30

njjram
New Member
Registered: 2011-06-19
Posts: 1

Re: smd_bio : store additional biographical info about your users

The javascript tooltips that appear on hover in the admin-tab seem not to work (“undefined”, it says) with JQuery version 1.6.1, which came with my new install of txp 4.4.1

I just downgraded to 1.5.1, and everything appears to be fine again. Probably a slight adaptation of the script would do the trick, but since JQuery is not really my cup of tea…

Offline

#110 2011-06-19 19:30:14

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

Re: smd_bio : store additional biographical info about your users

njjram wrote:

(“undefined”, it says) with JQuery version 1.6.1

Yeah. My crappy code, sorry. I have v0.40 — which is a significant upgrade and a fairly large departure from the v0.3x way of working — ready to launch. Just waiting on a couple of beta testers to report back. If you’d like to be one, please drop me a mail via my website and I’ll throw a copy over.


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

#111 2011-06-29 17:12:20

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

Re: smd_bio : store additional biographical info about your users

Stef, smd_bio should work with 4.4.1 right?

I’m in a development site using code exactly as I’m using it on another live site that works (previous Txp version), but in this case it’s not working. It seems to not be seeing the values defined by smd_bio. (Plugin is active, yes.)

For example this snippet that’s setup…

<txp:smd_bio_info items=“name”>
<a href=”<txp:site_url /><txp:section name=‘section’ />/<txp:smd_bio_info author=’{smd_bio_info_item}’ items=‘url_title’ label=” />”>
<img src=”<txp:site_url />images/<txp:smd_bio_info author=’{smd_bio_info_item}’ items=‘headshot’ label=” />.jpg” /></a>
</txp:smd_bio_info>

Is producing this as output…

<a href=“http://site.tld/directory/section/xxxx”>
<img src=“http://site.tld/directory/images/xxxx.jpg” /></a>

The two instances of “xxxx” (added here for demo) shows where the data is not showing up but should be.

If you think I should give the new one a try, I’d be happy to since on working on it right now.

Edit: Added the missing tag tail, but it is there in the actual code.

Last edited by Destry (2011-06-29 17:16:35)

Offline

#112 2011-07-05 21:31:28

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

Re: smd_bio : store additional biographical info about your users

Can anyone confirm this plugin is operational with 4.4.1?

Offline

#113 2011-07-05 21:35:14

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

Re: smd_bio : store additional biographical info about your users

Destry wrote:

Can anyone confirm this works with 4.4.1?

It works(ish) but wait 20 minutes or so and I’ll send you over the new version.


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

#114 2011-07-05 21:40:54

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

Re: smd_bio : store additional biographical info about your users

Sweet. I’ll be here. Just hanging out on this Paris apartment’s terrace in the cool air. Courtyard-side. It’s like Hitchcock’s Rear Window.

Offline

#115 2011-07-06 10:02:46

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

Re: smd_bio : store additional biographical info about your users

Destry wrote:

isn’t returning the three data types I’m trying to pull from the bio data.

Hmmmm, your example works for me (after I’d renamed your field names to match the ones in my Bio Config). You’re right the docs are cobbled together a bit right now and there should be an Overview section. I’ll add that.

When I refactored the code I tried to separate the distinction between the confusing names before and make things more consistent, but maybe I’ve still not managed it or chosen poor names (I just spotted one potential booboo: {smd_bio_info_field} should probably be {smd_bio_info_value} for consistency’s sake).

Anyway, here’s the lowdown:

  1. When you create a new field in the Bio Config pane, it has various attributes like name, title, size, value, etc. The name is the key: that is how you refer to the field using the field or fields attributes in the various tags.
  2. Each field has a variety of pieces of data that you may display. These are known as items and the primary ones are:
    1. value : the current value of the field that has been set by the user in their profile.
    2. title : the human friendly title (a.k.a. label in v0.3x) that you have assigned to your field in the Bio Config screen — this is handy if you want to print out the title alongside the data value itself, e.g. Department: sales.
    3. name : the field’s key (in the ‘Name’ column) as defined on the Bio Config tab. This is of less everyday use, but when building your own input screens for capturing bio data, it becomes handy so you can tell mem_form the name of the field it needs to store the bio data item in.
    4. The other items are useful for displaying counters and such like, or for diving deeper into the items from lists, radio sets, checkboxes, etc. To some extent <txp:smd_bio_iterate> has removed the need for these extra items, but I left them here so you have a choice.

So, to recap: field = your bio thingamybob (it’s Name / Key), and item = the bit of thingamybob you want to display: its value, title or name (i.e. key).

Now, when I put your <txp:smd_bio_info> tag in my site’s default form — inside <txp:if_individual_article> tags, because it needs article context — and viewed any article, it found the author of the article automatically and displayed their bio info as defined in the container.

If you’re trying to display bio info in a sidebar or on a list page that does not necessarily have article context, you need to specify the author(s) that you wish to display bio info from. You used to do that with the authors attribute but that was stupid in retrospect. In 0.40 you wrap your <txp:smd_bio_info> tag in <txp:smd_bio_author> and specify author="mulder, scully" to display those two named bios. You can of course use tags-in-tags there to pull the author login name(s) from somewhere else, or you can specify author="SMD_PRIVS:3:4" to show the bios for all Copy Editors and Staff Writers.

afaict, there’s nothing wrong with your code so I guess it’s a context thing that’s tripping you up. For reference, the following are functionally equivalent; the second just uses the more wordy <txp:smd_bio_data> tag:

<txp:smd_bio_info fields="url_title, headshot, iabc_fr_affil" label="">
   <a href="<txp:site_url /><txp:section name='board' />/{smd_bio_url_title}" title="Profile link">
      <img class="hs" src="<txp:site_url />images/{smd_bio_headshot}.jpg">
   </a>
   <h3>{smd_bio_iabc_fr_affil}</h3>
</txp:smd_bio_info>
<txp:smd_bio_info fields="url_title, headshot, iabc_fr_affil" label="">
   <a href="<txp:site_url /><txp:section name='board' />/<txp:smd_bio_data field="url_title" />" title="Profile link">
      <img class="hs" src="<txp:site_url />images/<txp:smd_bio_data field="headshot" />.jpg">
   </a>
   <h3><txp:smd_bio_data field="iabc_fr_affil" /></h3>
</txp:smd_bio_info>

One other thing that might be causing plugin confusion, although I’m not sure if it has any bearing on things, is that you have a field called url_title. That’s the same name as TXP’s built-in url title field. I doubt they’ll clash because one is being referenced from the txp_users table and the built-in one is from the textpattern table. But if your tag problems are not a context thing, I’d consider looking at that as possible source of breakage.

Does that explain things any better? I’ll copy ‘n’ paste some of this post into the plugin docs if it’s useful.

Last edited by Bloke (2011-07-06 10:06:00)


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

#116 2011-07-06 10:08:24

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

Re: smd_bio : store additional biographical info about your users

Ha! I deleted my previous post because I realized I was probably not supposed to be posting here yet since the plugin’s new version is still in testing mode. We are literally just crossing paths.

Thanks, Stef. I’ll give things another look, and see what happens.

Offline

#117 2011-07-06 10:34:59

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

Re: smd_bio : store additional biographical info about your users

Destry wrote:

probably not supposed to be posting here yet since the plugin’s new version is still in testing mode

No worries. Post away. This version is pretty much done anyway, assuming nobody finds any bugs.

I’ve updated the docs with the overview I posted above and have fixed those two stupidly-named replacement tags. Beta version of 0.40 is available for anyone who wants to try it out.


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

#118 2011-07-06 11:07:32

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

Re: smd_bio : store additional biographical info about your users

Your great explanations cleared up a few things for me comprehension-wise (I was closer than I thought), but unfortunately the plugin just doesn’t seem to be working for me.

I changed the name of the url_title field to url_only_title, but no diff, so I guess that wasn’t really the problem.

When I try it using the smd_bio_data tags, nothing is transferred. E.g, the URL for the link on the image shows up as http://site.tld/section/, but it should be http://site.tld/section/first-last.

When I use the replacement keys, it just outputs the key syntax. E.g., http://site.tld/section/{smd_bio_url_only_title}.

The plugin is activated, and the forms are in context to article output.

Here are two details to check, I guess. First, I’m using this in a subdirectory install. Don’t know if that would make any difference. Second, maybe I didn’t update the plugin correctly.

So just for the record, how do you update a plugin? (Believe it or not, I’ve not had to do this before. Ever. Largely because I’ve used so few plugins, or plugins so small/simple they’ve never, seemingly, needed updated.)

What I did was simply install the plugin as a normal plugin and it seemed to install over the old version on it’s own. If that’s right, then I guess that’s not the problem either.

Last edited by Destry (2011-07-06 11:12:09)

Offline

#119 2011-07-06 11:19:28

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

Re: smd_bio : store additional biographical info about your users

Destry wrote:

I changed the name of the url_title field to url_only_title, but no diff, so I guess that wasn’t really the problem.

OK, was a long shot.

When I use the replacement keys, it just outputs the key syntax. E.g., http://site.tld/section/{smd_bio_url_only_title}.

Hmmm, weird. And you’re definitely viewing an actual article, not a list or landing page? Does the debug=“1” show you that the keys have associated data? If they’re showing up ok in debug but not in the actual document then it’ll be a bug of some description, though I can’t think why it would happen. If you’d like me to take a closer look, please send me a login and I’ll see what I can find out.

First, I’m using this in a subdirectory install.

Don’t think that would have any bearing on it, but never say never.

Second, maybe I didn’t update the plugin correctly.

You did it right: just upload the new one and then activate it. The updater part of the plugin then runs automatically, but visit the Extensions -> Bio Config page just to make sure. If you have rss_db_admin_manager installed (or you can log into phpMyAdmin) you can check the table structure of the smd_bio_meta table contains the two new columns ‘coltype’ and ‘colsize’. If so, the upgrade went ok.


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

#120 2011-07-06 12:20:10

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

Re: smd_bio : store additional biographical info about your users

Yeah, some context would help, wouldn’t it. Just to be thorough, here it is.

The relevant code in the dedicated page, which calls one of two forms conditionally…

<div role="main" class="ie-crutch">
         <h1>IABC France Board</h1>
         <txp:if_individual_article>
              <txp:article form="bio" />
                   <txp:else />
              <txp:article_custom id="30">
    	        <txp:body/>
              </txp:article_custom>              
              <txp:article_custom form="bios-list" category="board" />
         </txp:if_individual_article>    
   </div><!-- end of main -->

The article list output that includes data from user accounts augmented with smd_bio…

<div id="profile">
<txp:smd_bio_info fields="url_only_title, headshot, iabc_fr_affil" 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>
   <h3>{smd_bio_iabc_fr_affil}</h3>
</txp:smd_bio_info>
</div><!-- end profile -->
<div class="boardmember">
    <h2><a href="<txp:site_url /><txp:section />/<txp:article_url_title />"><txp:title /></a></h2>
    <txp:body />
</div>

The individual article output using the same smd_bio data…

<h2><txp:title /></h2>
<div id="profile">
<txp:smd_bio_info fields="url_only_title, headshot, iabc_fr_affil" 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>
   <h3>{smd_bio_iabc_fr_affil}</h3>
</txp:smd_bio_info>
</div><!-- end profile -->
<txp:body />

You’ll notice differences in the way content is structured between list and single article but that’s strictly for presentational purposes only.

Offline

Board footer

Powered by FluxBB