Hello Miles Clement
for a quick way to do this, you can use jQuery to interrogate the element in the header that always shows the Username ... the actual name is within an anchor tag, and looks something like this;-
<a href="/people/admin" data-username="admin" data-avatarid="-1" data-userid="1" data-online="false" data-presence="null" data-externalid="" class="jive-username-link ">Fred Bloggs</a>
you can then use jQuery to fiddle about with the name you get and insert it into your HTML widget within a named element.
jQuery will be available, since it's used extensively within the UI, and you can add the logic to do the work directly to your widget as in-line script.
Thanks for the suggestion
Looking at the page source there is already a variable we can use: _jive_effective_user_id
I have a jquery script that will then create the personalized url shown below.
The code works as a self contained web page
If i put it into a html widget it does not display anything
I'm logged in as an admin which should allow me to use scripts and it does in some cases. However this is not one of those.
Can you suggest why this may not work? or a better way of doing it?
<!-- This would come from the main page but is included so that if you cut and paste the code into a stand-alone file it works -->
var _jive_effective_user_id = "7936";
<!-- this is the text that would display -->
The url is <URL></URL>
<!-- this is a link to the jquery code source - is there a local copy we can reference? -->
<!-- this code creates a varable with a constructed url based on the user id. It then replaces the tag <YRL> with teh constructuted URL -->
var MyUrl = "<a href='https://www.securityforum.org/" + _jive_effective_user_id + "'>link</a>";
in order to use script tags in HTML widgets, you need to have admin privileges for that Space/Group.
Also note that getting alerts to display is liekly to cause some challenges for the page display (well, it did for me when I was testing !)
A couple of useful points though ...
i) we use '$j' to reference the jQuery namespace, and using that means you can make use of the libs that get pulled in automatically.
ii) I prefer to use span (or div) elements, simply because they are easy to attach an ID to and hence easy to find. Here's an example I pasted into my test instance which works for me.
Here is some text for you:
var MyUrl = "<a href='https://www.securityforum.org/44545'>link</a>";
hope that helps
The following code pasted into an HTML widget produces a URL that contains a user attribute. This enables a personalised link to be created for a user
<p>The user's username: <span id='fred1'></span></p>
<p>The user's jive id: <span id='fred2'></span></p>
<p>A link containing user parameters: <span id='fred3'></span></p>
var Un = $j("img").attr("data-username");
var UnID = _jive_effective_user_id;
var MyUrl = "<a href='http://www.mysurvey.com/?userid=" + _jive_effective_user_id + "&username=" + Un + "'>Take the survey</a>";
Thanks for your help