none
Creating My Site Site Definition

    Soru

  • So I have added some web parts and changed the appearance of the My Site Profile and I would like to make this the standard for all My Site Profile pages. Basically whenever a user creates his My Site the My Profile should be provisioned according to this template....would I need to create a custom site definition? And how does this site definition fit in with the My Site site collection, since when a My Site is created its actually an entire site collection?

    Thanks for any help!

    09 Temmuz 2012 Pazartesi 18:29

Yanıtlar

  • Hi,

    Since feature stapling is just causing a feature to be activated when an action occurs, i.e. when a my site content site is created, the magic of adding a web part to a page would occur in the feature's event receiver FeatureActivated function. Your code would need to open a given page in the site collection, likely the default.aspx page, find the area where the web part should be added and then add the proper web part to that area. Unfortunately I do not have readily available code on how to do this, possibly someone else might?

    In regards to the top navigation on the my site content site. I believe you mean the links, My Site, My Newsfeed, My Content...

    This is defined in the v4.master Master Page which is used, by default, as your content site collection default master page. Near the top of this master page you will find a delegate control, <SharePoint:DelegateControl runat="server" ControlId="GlobalNavigation"/>. You can either move this tag, use a tool like Firebug for Firefox look for the id or styles (class .ms-globalnav) and provide custom styles to move this, or since it's a delegate control, create your own control that overrides the ControlID "GlobalNavigation". I would suggest the first method of moving this delegate control to below the ribbon.

    A few notes. One, this also includes the account dropdown. You might need to move this using custom styles. Two, each my site content site uses it's own copy of the v4.master, so if you customize your master page you will need to package it into a solution, then feature staplee this feature to My Site Content Site creation (TemplateName="SPSPERS#0").

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Yanıt Olarak İşaretleyen tudorH 17 Temmuz 2012 Salı 16:20
    10 Temmuz 2012 Salı 22:14
  • Hi,

    There is not too much in the ribbon for the My Site Host site, so it's hard to say how much is getting cut off. You may need to set one of the ribbon container divs overflow to visible.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Yanıt Olarak İşaretleyen tudorH 17 Temmuz 2012 Salı 16:20
    16 Temmuz 2012 Pazartesi 19:48
  • Glad the overflow comment helped.

    Regarding the padding / spacing issue, I noticed that in your css you provided you set a width in body #s4-ribbonrow. You normally would not want to set the width of the ribbon, SP handled that for you. The ribbon is normally set to 100% to account for different browser widths.

    Otherwise you will want to look at margin's, padding's and the position elements of your different divs that are either including your ribbon or containing your ribbon.

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Yanıt Olarak İşaretleyen tudorH 17 Temmuz 2012 Salı 16:20
    16 Temmuz 2012 Pazartesi 23:52

Tüm Yanıtlar

  • You should probably take a look at Feature Stapling.

    See http://blogs.msdn.com/b/spsocial/archive/2010/03/30/customizing-my-sites-in-microsoft-sharepoint-2010.aspx and http://sharepoint.stackexchange.com/questions/6075/customize-my-sites-on-sharepoint-2010.


    http://sharepoint.nauplius.net


    I've actually already looked through those for customizing the My Site, but I'm not sure how that information would help me with creating a template or definition of a My Site so each My Site that is created follows the same template/site definition. Would I accomplish this with feature stapling?
    09 Temmuz 2012 Pazartesi 18:54
  • Hi,

    You might always want to review the following codeplex project: https://sp2010mysite.codeplex.com/

    Creating your own custom My Site Content site template may work, although that may be tricky. Depending on how much you intend to custonmize within a Content site, it may be easier to use Feature Stapling. The feature that would be stapled to My Site Content site collection creation (staplee code can be found in the above codeplex project), would apply your custom branding elements via modules and feature event receiver code setting the custom master page. If you need to create custom content types, list definitions, list instances, etc, you can also create add those to your feature. You can also use your feature event receiver to add web parts to particular pages, etc.

    If possible I would prefer using feature stapling over trying to replace the My Site Content site template because that way I am not breaking the OOTB My Site Content site template, but creating a feature that provides all of your necissary changes may be time consuming. On a plus side once you have the feature making changes will be much easier, and you could use Powershell to upgrade your my sites with an updated feature, where-as with a site template you would be unable to push new changes to all my sites.

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    10 Temmuz 2012 Salı 16:36
  • Hi,

    You might always want to review the following codeplex project: https://sp2010mysite.codeplex.com/

    Creating your own custom My Site Content site template may work, although that may be tricky. Depending on how much you intend to custonmize within a Content site, it may be easier to use Feature Stapling. The feature that would be stapled to My Site Content site collection creation (staplee code can be found in the above codeplex project), would apply your custom branding elements via modules and feature event receiver code setting the custom master page. If you need to create custom content types, list definitions, list instances, etc, you can also create add those to your feature. You can also use your feature event receiver to add web parts to particular pages, etc.

    If possible I would prefer using feature stapling over trying to replace the My Site Content site template because that way I am not breaking the OOTB My Site Content site template, but creating a feature that provides all of your necissary changes may be time consuming. On a plus side once you have the feature making changes will be much easier, and you could use Powershell to upgrade your my sites with an updated feature, where-as with a site template you would be unable to push new changes to all my sites.

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    Thanks Eric, I actually found a guide to create my own so I am not stapling my features using Visual Studio but I am still not sure how to add a web part using feature stapling.

    One question though, how would I go about moving the top nav bar for a MySite below the top ribbon (the one containing, Site Actions)??? I can't seem to figure out how to swap their location, so it looks more like a regular site collection.

    Thanks again!

    10 Temmuz 2012 Salı 21:34
  • Hi,

    Since feature stapling is just causing a feature to be activated when an action occurs, i.e. when a my site content site is created, the magic of adding a web part to a page would occur in the feature's event receiver FeatureActivated function. Your code would need to open a given page in the site collection, likely the default.aspx page, find the area where the web part should be added and then add the proper web part to that area. Unfortunately I do not have readily available code on how to do this, possibly someone else might?

    In regards to the top navigation on the my site content site. I believe you mean the links, My Site, My Newsfeed, My Content...

    This is defined in the v4.master Master Page which is used, by default, as your content site collection default master page. Near the top of this master page you will find a delegate control, <SharePoint:DelegateControl runat="server" ControlId="GlobalNavigation"/>. You can either move this tag, use a tool like Firebug for Firefox look for the id or styles (class .ms-globalnav) and provide custom styles to move this, or since it's a delegate control, create your own control that overrides the ControlID "GlobalNavigation". I would suggest the first method of moving this delegate control to below the ribbon.

    A few notes. One, this also includes the account dropdown. You might need to move this using custom styles. Two, each my site content site uses it's own copy of the v4.master, so if you customize your master page you will need to package it into a solution, then feature staplee this feature to My Site Content Site creation (TemplateName="SPSPERS#0").

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Yanıt Olarak İşaretleyen tudorH 17 Temmuz 2012 Salı 16:20
    10 Temmuz 2012 Salı 22:14
  • Hi,

    Since feature stapling is just causing a feature to be activated when an action occurs, i.e. when a my site content site is created, the magic of adding a web part to a page would occur in the feature's event receiver FeatureActivated function. Your code would need to open a given page in the site collection, likely the default.aspx page, find the area where the web part should be added and then add the proper web part to that area. Unfortunately I do not have readily available code on how to do this, possibly someone else might?

    In regards to the top navigation on the my site content site. I believe you mean the links, My Site, My Newsfeed, My Content...

    This is defined in the v4.master Master Page which is used, by default, as your content site collection default master page. Near the top of this master page you will find a delegate control, <SharePoint:DelegateControl runat="server" ControlId="GlobalNavigation"/>. You can either move this tag, use a tool like Firebug for Firefox look for the id or styles (class .ms-globalnav) and provide custom styles to move this, or since it's a delegate control, create your own control that overrides the ControlID "GlobalNavigation". I would suggest the first method of moving this delegate control to below the ribbon.

    A few notes. One, this also includes the account dropdown. You might need to move this using custom styles. Two, each my site content site uses it's own copy of the v4.master, so if you customize your master page you will need to package it into a solution, then feature staplee this feature to My Site Content Site creation (TemplateName="SPSPERS#0").

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    Thank You!!! This is great information Eric and I really appreciate it. I am working on adding the web parts to the feature today, so hopefully I can figure it out and then post some code on here.

    As for the ribbon, I will try moving that as you suggested and see how it turns out. I found this article http://styledpoint.com/blog/ribbon-customization-changing-placement-look-and-behavior/ the other day and tried it on a regular site (not MySite) however I can't seem to get it working, the ribbon is always somewhat cut off and won't display anything.

    I will update this as soon as I figure something out. I will mark your posts as answers as well once I have my code working so as to provide further explanation.

    Thanks again!

    11 Temmuz 2012 Çarşamba 15:27
  • Basically I am trying to move the top ribbon (Site Settings...) above the top navigation bar (My Site, My Newsfeed..), this is the code I am using but I can't seem to make it work, I'm not sure if the right way to do it is with relative positioning?? When I do that the Site Settings menu gets cut off (there should be a bunch more options after the two) as in the screenshot I attached.

    http://i828.photobucket.com/albums/zz208/TooT3R/css_issue_ribbon.png

    EDIT: I did try messing with the z-index for the top ribbon but it did not work

    This is the CSS:

    • body {
    •     background-image: url(bg.png);
    •     background-color: black;
    •     background-repeat:repeat-x;
    •     background-attachment:fixed;
    •     background-position: left top;
    • }
    • /* ribbon color */
    • body #s4-ribbonrow
    • {
    •     background-color:black;
    •     width: 1041px !important;
    •     margin-left: auto !important;
    •     margin-right: auto !important;
    •     position: relative;
    •     top: -44px;
    • }
    • /* ribbon background */
    • .ms-globalnav {
    •     background-color: black !important;
    •     border-bottom: 1px solid #333333;
    •     height: 43px !important;
    •     width: 1041px !important;
    •     margin-left: auto !important;
    •     margin-right: auto !important;
    •     position: relative;
    •     top: 130px;
    • }
    • /* font colors */
    • .s4-sn li.static > a:hover, .s4-sn li.static > a, .ms-contactcardtext1, .ms-newsfeedheader,  .ms-WPBody a, .ms-contactcardtext2, .ms-contactcardtext2 a {
    •     color: #f06b00 !important;
    • }
    • /* hide hover underline in top bar */
    • .s4-mysitetn a:hover {
    •     text-decoration: none !important;
    • }
    • /* remove the overflow scroll */
    • .customBodyHolder .customPageWidth {
    • }
    • /* change padding and height */
    • .customBodyHolder {
    •     min-height:200px;
    •     padding-bottom: 50px;
    •     width: 1041px;
    • }
    • /* light blue area at top of profile */
    • .s4-sn, .ms-profilepageheader {
    •     background-color:#efefef;
    • }
    • /* make the site actions colors match the branding */
    • .ms-siteactionsmenuinner  {
    •     background:url("/_layouts/images/bgximg.png") repeat-x scroll 0 -467px #313031;
    •     border-color:#313031;
    • }
    • /* main body area */
    • .s4-ca {
    •     float: none !important;
    •     margin: auto !important;
    •     width: 1041px !important;
    • }
    • body #s4-leftpanel {
    •     display:none;
    • }
    • body #s4-bodyContainer {
    •     margin: auto !important;
    •     width: 1041px !important;
    • }
    Can anyone help me out with this?
    • Düzenleyen tudorH 16 Temmuz 2012 Pazartesi 15:35
    12 Temmuz 2012 Perşembe 22:24
  • Anyone have any ideas? Thank you!

    16 Temmuz 2012 Pazartesi 15:56
  • Hi,

    There is not too much in the ribbon for the My Site Host site, so it's hard to say how much is getting cut off. You may need to set one of the ribbon container divs overflow to visible.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Yanıt Olarak İşaretleyen tudorH 17 Temmuz 2012 Salı 16:20
    16 Temmuz 2012 Pazartesi 19:48
  • Hi,

    There is not too much in the ribbon for the My Site Host site, so it's hard to say how much is getting cut off. You may need to set one of the ribbon container divs overflow to visible.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield


    Wow, you are awesome! That totally did it, I did not even think that it could be the overflow, so I was trying to move the Site Action container around and that still didn't work! Thank You Thank You! I changed body #s4-ribbonrow to "color:#800000;font-face:Consolas;font-size:small;">

    One other question, if you look at my screenshot...the ribbon and top nav bar aren't quite centered on the screen and nothing I do makes them center without editing the positioning by pixels. Any idea why that is happening? Thanks again!

    16 Temmuz 2012 Pazartesi 20:21
  • Glad the overflow comment helped.

    Regarding the padding / spacing issue, I noticed that in your css you provided you set a width in body #s4-ribbonrow. You normally would not want to set the width of the ribbon, SP handled that for you. The ribbon is normally set to 100% to account for different browser widths.

    Otherwise you will want to look at margin's, padding's and the position elements of your different divs that are either including your ribbon or containing your ribbon.

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Yanıt Olarak İşaretleyen tudorH 17 Temmuz 2012 Salı 16:20
    16 Temmuz 2012 Pazartesi 23:52
  • Glad the overflow comment helped.

    Regarding the padding / spacing issue, I noticed that in your css you provided you set a width in body #s4-ribbonrow. You normally would not want to set the width of the ribbon, SP handled that for you. The ribbon is normally set to 100% to account for different browser widths.

    Otherwise you will want to look at margin's, padding's and the position elements of your different divs that are either including your ribbon or containing your ribbon.

    I hope this helps.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield


    Thanks Eric!!!! You are the man!!! I removed all my width settings and just changed the form width and now its all centered and looks nice. However, I think an issue with this approach is that the if images on the sites are very large they can overlap, I think I will deal with this when I encounter that problem haha. Thanks again!!
    17 Temmuz 2012 Salı 16:20