SharePoint and jQuery - Get the Authenticated User's Name and Modify Content Client-Side

1 2 3 | $(document).ready( function () { alert($().SPServices.SPGetCurrentUser()); }); |
we instead went with the following (note that this includes the resulting action). If you are not in an HTTPS environment go with the SPServices option...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <script type= "text/javascript" > $(document).ready( function () { var str = '' ; var strContainer = '' ; // find the container that contains the user's name (not always the same...) if ($(' #zz14_Menu').attr("accesskey") == 'W') {strContainer = 'zz14_Menu';} if ($(' #zz15_Menu').attr("accesskey") == 'W') {strContainer = 'zz15_Menu';} if ($(' #zz16_Menu').attr("accesskey") == 'W') {strContainer = 'zz16_Menu';} if ($(' #zz17_Menu').attr("accesskey") == 'W') {strContainer = 'zz17_Menu';} var str = $(' #' + strContainer).find("span").text(); // date driven var d = new Date(); var n = d.getDate(); if (n==26) // only show on the 26th... { if (str == 'Jane User ') { } } }); </script> |





