1

Is there a way to remove the user photos from a discussion board in SP2013?

I would like to have the regular flat view but just without any user photos. My site is accessed from both internal AD users and outside non AD users. The non AD users get a login box trying to access the internal site that the photos are being pulled from. I would like to remove the photos to stop them from getting the login box.

I tried modifying the view and removing "Posted By (picture and name)" column and "Modified By (picture and name)" column but that didn't seem to work.

I tried looking in SP Designer to remove it but that wasn't very helpful or I must not have been in the correct place. Any suggestions? enter image description here

0

you can hide it using css or jQuery!

here is the way using css

Add a code editor web part to the page, then click on Edit Snippet and add the following line:

<style>
.ms-peopleux-userImgDiv {
    display: none;
}
</style>

jQuery: Add a code editor web part to the page, then click on Edit Snippet and add the following line: (providing you have jquery loaded, if not you can add a line before the line below

<script>
$('.ms-peopleux-userImgDiv').hide();
</script>
  • well, hiding would only remove it from the UI, the login issue will still occur – Aveenav May 5 '16 at 16:53
  • this is correct, the solution proposed above won't eliminate the double login screen! – Ahmed Mahmoud May 5 '16 at 17:06
0

The flat view of the discussion uses 'sp.ui.discussions.js' to create the UI.

One way to approach the problem is to override the specific function used by the author field (with image) renderer.

custom.discussion.js

SP.UI.Discussions.PostBehavior.prototype.$3A_0 = function (b) {
   ULS06I:;
   var a = SP.ScriptHelpers.getFieldFromSchema(this.$0_0.ListSchema, "Author");
   if (a) {
     a.WithPictureDetail = 0;
     a.PictureOnly = 1;
     a.PictureSize = "Size_48px";
     b.addCssClass("ms-comm-authorPicture");
     //(this.$3_0 || this.get_isRenderedByRootPost()) && b.addCssClass("ms-textXLarge");
     b.addCssClass("ms-comm-authorTitle");
     b.renderBeginTag("div");
     //b.write(spMgr.RenderFieldByName(this.$0_0, "Author", this.jsonItem, this.$0_0.ListSchema));
     b.renderEndTag()
   }
};

If you edit the web part property of the Flat.aspx, you can pipeline additional JS files to it. Or you also append your overriding function after the body. The idea is to override :-) On your web part properties, you'd want to look this this:

sp.ui.discussions.js | ~sitecollection/_catalogs/masterpage/custom.discussion.js

Note: Change the path if you placed your custom javascript file elsewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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