Getting current user information in Article

rated by 0 users
This post has 9 Replies | 2 Followers

Not Ranked
Posts 10
Points 130
wdwcrazy Posted: Sat, Jul 5 2008 12:05 PM

This SHOULD be simple - I want to be able to see the logged in user in an article.  Some of my articles have embedded iFrames and it would be just as good to be able to know the current user there too. I know the CSContext.currentuser.user has information - but how exactly do I reference that object from the article?  There is a little script in there already - can I just add it there?

Very new to CS and javascript so be as verbose as possible with replies!!

Thanks!!!

Top 10 Contributor
Posts 3,127
Points 46,365
TelligentSupportTeam

You can only use CSContext.Current.User.Username to get the current user in the codebehind of the asp.net page, not via javascript.

  • | Post Points: 35
Not Ranked
Posts 10
Points 130
wdwcrazy replied on Sat, Jul 5 2008 12:37 PM

ok - so what other alternatives do I have.  If I create an ASPX page that is embedded in an article iFrame will CS maintain the information as it passes to the embedded page?  If not, can I just create my own aspx page and have it be accessed from CS directly (without the article iFrame)?

Thanks!

 

  • | Post Points: 20
Not Ranked
Posts 10
Points 130
wdwcrazy replied on Sat, Jul 5 2008 12:46 PM

Also - I see in the article there is script that references the Document that loads it - could I stick the username in a tag of an attribute and grab it from there? I just need the username - I can get everything else I want from there.

  • | Post Points: 20
Top 10 Contributor
Posts 3,127
Points 46,365
TelligentSupportTeam

The current user should be maintained in as long as the user's logged in to your website, however you will need to ensure your custom ASPX page inherits CSThemePage for CSContext to work.

  • | Post Points: 5
Top 10 Contributor
Posts 3,127
Points 46,365
TelligentSupportTeam

Where in the article do you see script that references the document, and what script is it you see.

  • | Post Points: 20
Not Ranked
Posts 10
Points 130
wdwcrazy replied on Sat, Jul 5 2008 12:58 PM

<SCRIPT type=text/javascript>for (var i = 0; i < document.getElementById("CommonContentInner").getElementsByTagName("div").length; i++) if (document.getElementById("CommonContentInner").getElementsByTagName("div").className == "CommonContentArea") document.getElementById("CommonContentInner").getElementsByTagName("div").id = "HomeContentArea"; </SCRIPT>

It is on every article on this site I am wrestling with.

  • | Post Points: 20
Top 10 Contributor
Posts 3,127
Points 46,365
TelligentSupportTeam

Where in the article do you see this.  Can you provide a link?

  • | Post Points: 35
Not Ranked
Posts 10
Points 130

http://www.iasca.com/content/join/02ase.aspx

 

Since you aren't an admin, you can't see this - but this is the code behind the link:

 

<SCRIPT type=text/javascript>for (var i = 0; i < document.getElementById("CommonContentInner").getElementsByTagName("div").length; i++) if (document.getElementById("CommonContentInner").getElementsByTagName("div").className == "CommonContentArea") document.getElementById("CommonContentInner").getElementsByTagName("div").id = "HomeContentArea"; </SCRIPT>

<UL>
<LI>For only fifteen bucks, you’ll get a LIFETIME membership as an IASCA ASE member!&nbsp;
<LI>If that’s not enough, how about we give you a ONE YEAR SUBSCRIPTION to PERFORMANCE AUTO &amp; SOUND magazine!&nbsp;
<LI>AND, a FREE DTS audio A/B comparison CD!&nbsp;
<LI>PLUS, access to our members only forum on the IASCA website, giving you the opportunity to speak with IASCA Members all around the world AND your own page on our website to show off your ride!&nbsp;</LI>
</UL>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

<P align=center mce_keep="true"><B><A class="" href="http://store.iasca.com/index.php?app=ccp0&amp;ns=prodshow&amp;ref=IA_MEM_ASE" target=_blank mce_href="http://store.iasca.com/index.php?app=ccp0&amp;ns=prodshow&amp;ref=IA_MEM_ASE"><FONT size=6>Click here to Join as an ASE Member!</FONT></A></B></P>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

<P mce_keep="true">&nbsp;</P>

  • | Post Points: 5
Not Ranked
Posts 10
Points 130
Page 1 of 1 (10 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com