Capture permalink value

50 views
Skip to first unread message

Stobot

unread,
Jan 8, 2020, 9:26:11 PM1/8/20
to TiddlyWiki
Hello all,

I'm hoping to simplify my end-user login experience using BOB. Currently I have each user enter their name when the load the wiki and then use that name to log things. My thought is that to save them the typing, I could send them a permalink and figure it out automatically from there. It seems I cannot do this the way I intended as the value I'm trying to expand is always blank...

Here's what I'm trying:

Start with link like
10.1.111.111:8080/Wiki#UserA

Make a new startup tiddler like $:/mywiki/startup and tag it $:/tags/StartupAction. Containing:
<$action-setfield $tiddler="$:/temp/startup" $field="user" $value={{{[list[$:/StoryList]first[1]]}}}/>

My logic being that the permalink will cause a single tiddler to open on startup (in my case "UserA"), then the StartupActions fire and the first tiddler in the StoryList would be UserA, which would then log to $:/temp/startup!!user. Instead, it's blank.

I keep trying things, like a hard coded value in the $value area - which does work. So that means the problem is either:
  1. It's the {{{ [[]] }}} notation in the $value area - which normally works, but doesn't during startup? I tried doing that part in a $set and it didn't help
  2. The order of operations is such that the StartupActions happen before the UserA even loads (this seems most likely)
  3. Something else?
Anybody have an idea why this doesn't work - or a different solution?

TonyM

unread,
Jan 8, 2020, 9:34:55 PM1/8/20
to tiddl...@googlegroups.com
Stobot,


$:/info/url/searchSearch portion of URL of wiki (eg, ?user=test)
$:/info/url/searchSearch portion of URL of wiki (eg, ?user=username)

Regards
Tony

Eric Shulman

unread,
Jan 8, 2020, 10:17:13 PM1/8/20
to TiddlyWiki
On Wednesday, January 8, 2020 at 6:26:11 PM UTC-8, Stobot wrote:
My logic being that the permalink will cause a single tiddler to open on startup (in my case "UserA"), then the StartupActions fire and the first tiddler in the StoryList would be UserA, which would then log to $:/temp/startup!!user. Instead, it's blank.
 
The order of operations is such that the StartupActions happen before the UserA even loads (this seems most likely)

Yes.  StartupActions are triggered BEFORE the PageTemplate is rendered, which also means before the story is rendered.  Thus, the StoryList contents are undefined when StartupActions are processed.

-e

PMario

unread,
Jan 9, 2020, 2:27:46 AM1/9/20
to TiddlyWiki
hi,

I think this could be easy to solve if my PR would be merged. If you +1 the comment [1] it may happen.

-m

Stobot

unread,
Jan 9, 2020, 6:18:05 AM1/9/20
to TiddlyWiki
That's great!

TonyM - that gets me exactly what I needed - and per the order of operations, the $:/info stuff (which I had no idea existed) seems to be populated before the StartupActions are run - awesome

Eric - thanks for confirmation on that, very useful information

PMario - I read through your link, and I'll have to admit that at this point it's still a little over my head and my interpretation was that there was still discussion to be had on the ramifications of the change? Given that my issue is now solved, I'm hesitant to vote that the change is needed, but let me know if I'm misinterpreting that.

Thanks all
Reply all
Reply to author
Forward
0 new messages