SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way that i can show a web part only for current logged in user .I want to achieve this on an out of the box content editor web part .Please suggest me

share|improve this question
What do you mean by 'current logged in user'? The user adding the web part? A specific user? Any logged in user (not anonymous)? And what do you want to show this user? – Per Jakobsen Aug 17 '12 at 20:22
I mean for example if i log in to the site that web part should be shown to me only .We have this requirement in mysite as in person.aspx page we are adding a content editor web part which will have a link to external application but when some one is searching for this user using profile search they are also seeing this web part .And we want to prevent this one – Anil Aug 17 '12 at 20:30
How do you currently add the web part to the page? – Per Jakobsen Aug 17 '12 at 20:58
I am a site collection admin so i will just edit the page and add the content editor web part .I am not sure whether i am answering your questoin. – Anil Aug 17 '12 at 21:02

yes you can, you make what you want in the content editor webpart and surround it with an if function that checks to see if the user is authenticated or not, If they are then do the code and show what you want to the authenticated user and if not an authenticated user do nothing, basicly show nothing or a message.

Its better to make your own webpart in visual studios c# or and check the user is authenticated like this and then and do the same logic. The only difference is you would have what you want to do in the creatChildControls and put everything in:

 using (SPWeb web = site.OpenWeb()) 
    // put all your code here to only show to authenticate users
share|improve this answer

There is no way to get a standard web part added to the common person.aspx to only show for the "owner" of the profile page.

In the general case need a custom webpart which only shows itself when it's the owner, but as far as I understand in your case there is nothing secret in the content you want to show, you just only want to show it on the persons own page, in that case you could include JavaScript to show/hide a section based on it being the same person logged in.

share|improve this answer

With a Content Editor Web Part you should be able to do Audience Targetting if you only want to display the content to a certain group or groups. You can then target your web part towards that particular audience. (e.g. Managers, Viewers, etc.), and it will only display for those select user groups.

You could create a SharePoint group for just your self, if you wanted to limit it to one person.

share|improve this answer
He wants to show the infomation to all users, but just only when they are seeing their "own" person.aspx page. – Per Jakobsen Aug 18 '12 at 8:39
@Quinn this wont work on my site. – Esteban V Feb 26 '14 at 11:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.