Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#46 2010-05-17 15:37:02

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

Re: smd_bio : store additional biographical info about your users

johnstephens wrote:

When deleting an author from the Users tab, I temporarily lost my internet connection.

“smd_bio destroyed my ISP”. Now THAT would be a headline worthy of a tabloid. And impressive coding too :-)

Seriously though, eeek! From a “wiping my hands of this” perspective, smd_bio does not in any way touch the txp_user table; all admin functions in this regard remain the property of TXP. smd_bio simply piggy backs off the events that trigger an addition/deletion, and adds to its own table, keeping track of who’s who via the login name.

Worst case scenarios — looking at the world from smd_bio’s code since it deletes its stuff before TXP deletes the actual user:

  1. if the delete operation failed mid-delete, you’d have a corrupt smd_bio row. This shouldn’t be a problem but you may see smd_bio warnings if certain cols are empty. Can’t remember how defensive I’ve been in the coding
  2. if the operation failed after smd_bio but before TXP has a chance to delete, you’d have a user without any extended information: no problem
  3. if the operation failed during TXP’s delete process / asset reassignment you may well get a corrupt user entry in txp_user. If it’s the person you’re logged in as then your TXP admin side will probably be unusable as that user. If it’s another user, you’ll only notice if you try and log in as that user

In addition, smd_bio does not write to the prefs table except when changing the sort order of the columns in the Bio Config screen. Since you weren’t on that screen, smd_bio wasn’t writing to that table. The TXP delete process does not write to the prefs table either during a delete.

So, in summary, I’d say it’s highly unlikely that smd_bio caused the damage to your system because it’s pretty well isolated from the user table (by design!). I’m not ruling it out, I’m just saying it’s unlikely, especially because my coding isn’t actually advanced enough to leave that kind of destruction path behind. If this behaviour is repeatable then I’ll gladly take a look over the code and try to find out what’s causing it.

Of course, that doesn’t really help you figure out why it happened in the first place, which is rather maddening. And I bet you don’t want to repeat the test either! Though perhaps if you have time you would be so good as to do it in a sandbox environment that mimicks your current setup to help nail this down?

Chances are it’s one of those random acts of the ether whereby your connection hangs and a server process goes into freefall, bringing the database down with it. Or a brief disk head crash on your ISP’s server that corrupted the sector in which your MySQL .MYI / .MYD / .frm files reside. Unfortunately I don’t know what to suggest given the nature of the event. Someone with better diagnostics ability than me may be able to help track it down.

I do reserve the right to eat all these words if it turns out to be the plugin, and if it is I am truly sorry and hope you didn’t lose any valuable data.

Last edited by Bloke (2010-05-17 15:39:37)


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

Offline

#47 2010-05-17 15:59:42

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: smd_bio : store additional biographical info about your users

I didn’t mean to impute anything on smd_bio, I just didn’t know where I should turn first. As far as repeating the experiment is concerned, I just deleted the same author again with the same results*. After my DB is restored, I will attempt to reassign the author’s assets from the Articles tab first before deleting the author in the Users tab.

  • I didn’t lose my web connection this time, so I don’t think that is related. This time, the page showed that it was loading indefinitely, for at least ten minutes.

Last edited by johnstephens (2010-05-17 16:06:19)

Offline

#48 2010-05-17 16:06:34

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

Re: smd_bio : store additional biographical info about your users

johnstephens wrote:

As far as repeating the experiment is concerned, I just deleted the same author again with the same results

OK, then that wipes out the ‘random ether’ argument. So after restoring it again, and disabling smd_bio, if it doesn’t destroy anything I’ll get ready to eat my words. I wonder if there are any plugin clashes that might cause this behaviour. Perhaps smd_bio is unhappy with something else in the system.

If there’s any further info you can supply about the user in question — name, role, anything I can get my teeth into — or possible pluigns that might have an impact or perhaps even a login to some area where I can have a poke around if I may be so cheeky then I’d be most grateful.


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

Offline

#49 2010-05-17 16:10:04

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

Re: smd_bio : store additional biographical info about your users

johnstephens wrote:

the page showed that it was loading indefinitely, for at least ten minutes.+

The Admin-Users page? Freaky. So perhaps it is something to do with the asset reassignment step. I do a check in smd_bio to see if that’s set and if not, bomb out early. I wonder if that has any bearing on things. Hmmmmm.


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

Offline

#50 2010-05-17 16:20:04

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: smd_bio : store additional biographical info about your users

Bloke wrote:

OK, then that wipes out the ‘random ether’ argument. So after restoring it again, and disabling smd_bio, if it doesn’t destroy anything I’ll get ready to eat my words. I wonder if there are any plugin clashes that might cause this behaviour. Perhaps smd_bio is unhappy with something else in the system.

Bracing myself for another DB restore, I disabled smd_bio and deleted the user again, in the name of science. And this time, it deleted the user and reloaded immediately, without changing anything else in my database.

If there’s any further info you can supply about the user in question — name, role, anything I can get my teeth into — or possible pluigns that might have an impact or perhaps even a login to some area where I can have a poke around if I may be so cheeky then I’d be most grateful.

Okay here’s what happened: the author in question was the result of a text-file import from Movable Type 3.2. Importing from the DB resulted in all the articles being truncated, so I did my homework on the MT article tags and created an export template in MT to generate the text file. The result worked perfectly, but I made a mistake in the template so that the Author Real Names were exported in place of AuthorUserNames. This resulted in duplicate author entries, and the duplicates were assigned “Publisher” privs.

The user I was deleting was “Carl Sirname, Jr.”, a Publisher-privelege user with no assets and no bio information— not even an eMail address.

I wonder if the problems stem from the comma in the username? Anyway, I hope this report is useful!

Offline

#51 2010-05-17 16:54:21

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: smd_bio : store additional biographical info about your users

Update: The problem manifests differently when smd_bio is disabled, but it persists. If you continue to ponder this problem, I reckon it falls under the “TXP developer” role instead of “plugin author”.

Although I can delete the specific author above without any problems, when I begin to delete other duplicate imported MT authors, I eventually get the same result, requiring me to restore the DB.

Offline

#52 2010-07-07 10:06:48

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: smd_bio : store additional biographical info about your users

OMG!
You’r TXP GOD!!
Amazing plugin!

Last edited by Katalonian (2010-07-07 10:07:20)


<txp:txp_me />

Offline

#53 2010-07-19 09:26:26

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

Re: smd_bio : store additional biographical info about your users

Stef,

When creating an image item, the “size” value is simply to give the image a size in the Users panel, right? It’s not intended to define the size of the image as it should appear in the frontend, right?

At first I thought the intention of size was to actually define the image size as it would appear in the site, but that doesn’t seem to be the case. I’m fine with that, and my CSS does the job as usual, but I just want to make sure I understand the function.

Offline

#54 2010-07-19 09:32:33

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

Re: smd_bio : store additional biographical info about your users

Destry wrote:

When creating an image item, the “size” value is simply to give the image a size in the Users panel, right?

Correctamundo.


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

Offline

#55 2010-09-09 09:50:55

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

Re: smd_bio : store additional biographical info about your users

New question…

Is there a way to do a conditional check on a given bio field?

In this case, some users are board members having bio articles, and some users are just guest authors. In the case for board members, the article form is designed so that their headshot thumbnail and name are links to the biography articles. This is setup in smd_bio.

However, as it is now if a user does not have a bio, a link is still added and is broken, naturally. I’d like some kind of conditional solution so that if no biography link/title is provided in the smd_bio profile, no link is addeded to the photo/name at all.

The only way I can think to do this is with a conditional wrapper on the block of smd_bio form data, but I’m blanking on how that might be.

Is it possible? A simple hypothetical example I might run with?

Offline

#56 2010-09-09 10:23:55

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

Re: smd_bio : store additional biographical info about your users

Destry wrote:

Is there a way to do a conditional check on a given bio field?

Currently not natively but I could try and add a conditional tag that might help. I’ll see if I can figure out how you set your system up from your post and mess around with some solutions on my dev box.

For now you can try a variation on the TXP:variable dance which might get you out of the hole.

Last edited by Bloke (2010-09-09 10:24:30)


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

Offline

#57 2010-09-09 10:59:33

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

Re: smd_bio : store additional biographical info about your users

Stef, maybe this will help. :)

The relevant pieces of the profile fields setup in admin-side:

Name | Title | Type | Size | Value | Position

teamrole | Team Role | – | – | – | –

jobtitle | Job Title | – | – | – | -

company | Company | – | – | – | -

stcaffiliation | STC Affiliation | – | – | – | -

bioid | Bio Article ID | – | – | – | -

photothumb | Photo | – | – | – | -

urltitle | URL-only Title | – | – | – | -

The tags structure in the form:

<txp:smd_bio_info items="name">
<a href="<txp:site_url /><txp:section name='leaders' />/<txp:smd_bio_info author='{smd_bio_info_item}' items='bioid' label='' />/<txp:smd_bio_info author='{smd_bio_info_item}' items='urltitle' label='' />" title="Bio link"><img class="author-thumb" src="/images/<txp:smd_bio_info author='{smd_bio_info_item}' items='photothumb' label='' />.jpg" /></a>    
<p class="author"><a href="<txp:site_url /><txp:section name='leaders' />/<txp:smd_bio_info author='{smd_bio_info_item}' items='bioid' label='' />/<txp:smd_bio_info author='{smd_bio_info_item}' items='urltitle' label='' />" title="Bio link"><txp:smd_bio_info author='{smd_bio_info_item}' items='RealName' label='' /></a></p>     
<p class="authorinfo"><txp:smd_bio_info author='{smd_bio_info_item}' items='teamrole' label='' />,<br />
      <txp:smd_bio_info author='{smd_bio_info_item}' items='stcaffiliation' label='' /></p>
</txp:smd_bio_info>

And here’s an example of the code in use for a user having a biography (thumbnail and name links), and one for a user having no biography (broken links).

I’ll have a look at your alternate suggestion too.

Last edited by Destry (2010-09-09 11:04:36)

Offline

#58 2010-09-09 15:53:04

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: smd_bio : store additional biographical info about your users

Hello Stef,

I’m using your plugin to output the result of a bio item with the title: “What are you eating for breakfast ?” with 3 values: Bananas, Oranges, Kiwis

I would like to define other <txp:variables /> (plurals, first-capital…) based on the values returned by <txp:smd_bio_info />

So I’ve setup a form (myform) containing new empty variables:

<txp:variable name="flavor" value='<txp:smd_bio_info items="radioitems" label="">' />
<txp:if_variable name="flavor" value="bananas">
<txp:variable name="fs" value="Banana" />
<txp:variable name="fp" value="Bananas" />
</txp:if_variable>
<txp:if_variable name="flavor" value="oranges">
<txp:variable name="fs" value="Orange" />
<txp:variable name="fp" value="Oranges" />
</txp:if_variable>
<txp:if_variable name="flavor" value="kiwis">
<txp:variable name="fs" value="Kiwi" />
<txp:variable name="fp" value="Kiwis" />
</txp:if_variable>

When I try to output:

<txp:variable name="fs" />

It should, depending on what the user has selected as a breakfast item, output: Banana, Orange or Kiwi…

But through:

<txp:smd_bio_info items="radioitems" label="" form="myform"><txp:variable name="fs" /></txp:smd_bio_info>

It outputs nothing…

What am I missing here ?

Thanks !

Last edited by hablablow (2010-09-09 20:54:18)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#59 2010-09-09 16:12:17

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

Re: smd_bio : store additional biographical info about your users

hablablow wrote:

Is this a way to go ?

Without trying it out myself I’m not quite sure what you’re trying to achieve with the code. But my first question is: what is the closing smd_bio tag for? You have already self-closed it in the first line.


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

Offline

#60 2010-09-09 17:10:07

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: smd_bio : store additional biographical info about your users

Sorry my explanation wasn’t clear and it contained typos… So I changed it above…
Hopefully it’ll make more sense this time…
Thanks for your comprehension…

Last edited by hablablow (2010-09-09 17:10:32)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

Board footer

Powered by FluxBB