The new version of EPiServers migration tool is supposed to support user personalization migration to the new enviroment. The good news is that it does migrate all users and generates a new password. The bad news is that it forgets which pages they subscribed too and the interval.

On this project, we also use SubscriptionCategories which basicly sends a newsletter everytime a page is created under that category which of course didn’t get migrated to the new enviroment.

What you need to know is open up a connection to the old database and fill up a datatable with info from tblUserProperty, tblSID and tblUser. You need to bring up the username, email (we use the email as username for all subscribers), interval, categories and which pages they subscribe too. I had to make three different queries to bring up what I needed though, one for the categories, one for the interval and one for the pages. I’m sure that an SQL genius can make it in one call.

Once you’ve filled up your datatable, bind it to a repeater and just print it all out. Might be nice to see it work before you do a full migration atempt. Once in the repeater, I call for the method I made to update the subscription information.

private void UpdateUserSubscription(string user, int page, string categories)
{
EPiServerProfile profile = EPiServerProfile.Get(user);
profile["SubscribeCategories"] = categories;
profile.SubscriptionInfo.Interval = CheckUserInterval(user);
profile.SubscriptionInfo.SubscribeTo(new PageReference(page));
profile.Save();
}

Basicly, you need to load up the profile you wish to alter and then fill it up with whatever information you need. SubscribeCategories is the custom part of our subscription and the rest is interval and page to subscribe to. Just dont forget to save your profile, otherwise it wont save it to the database. The only time you don’t need to save the profile is if you’re altering the currentuser which is logged in. Then you can call on the methods you like and they will work without save. But when altering users that are not logged in, you’ll always need to save.

It has been a very rough season. Started off awfully and kept it just as bad. It has taken way to many games to try and find the harmony I had last season but it seems like it has arrived. A few wins in a row has pushed us a bit away from the relegation fight and even a mid-table position can be possible to achieve. But with a tiny transfer budget of 1.8 million quid and a few new player that can barely speak english didn’t make things easy 🙂 I’m actually almost running the same team as last season and doing better than with the ones I bought in. Oliver Ouefio has been the best purchase so far since he came as a free agent and now all the big clubs are after him.

Ouefio

And here are just a few of the clubs that whish to purchase him.

picture-4

Here’s the graph of how the season has been. Not the most glamorous but atleast we’re above the surface.

picture-12

And here’s the table. 9 points in the safe zone but a mid-table position would be really great. Maybe next season I’ll get a bit more transfer cash since we’ve been gone positive every month with huge profits.

picture-21

Transfer window is now open and I’m just hoping I can keep my keyplayers.

Arf…. midnight and train. That’s about it. I’m way too intoxicated right now to wirte something that makes sence. Still, I feel like writing something. And see! I’m actually typing without any errors whatsoever! Or atleast I would like to think so. Ugm….. thats about it.

I’m using the PasswordRecovery control and find it both good and bad. The good part is that its rather simple. It does what it’s supposed to do and its painless to use. If you you’re not bothered with the looks then its really really good since all you need is basicly one row of code. I’ll just post a quickie on how to use the passwordrecovery control in a more friendly way. Nothing new and nothing revolutionary and if you have any ideas or comments to add, I’ll appreciate it and add it to the post.

It’s a simple ”type your e-mail and you’ll get a new password” feature. Without a question to answer and that’s because its based on episerver thinking and your e-mail is more than enough. Anyway, here it comes.

For the Front:

<asp:PasswordRecovery ID="ctrlPasswordRecovery" runat="server"
UserNameLabelText="Your Label"
UserNameTitleText="Your Title"
UserNameInstructionText="Your Instructions"
InstructionTextStyle-Font-Bold ="false" LabelStyle-Font-Bold="true" TitleTextStyle-Font-Bold="true"
SubmitButtonText="Send" TitleTextStyle-HorizontalAlign="Left" InstructionTextStyle-HorizontalAlign="Left"  SubmitButtonType="Image"      SubmitButtonImageUrl="images/send.jpg" />

And thats it. For some reason, everything is centered so I just put in a few left align to make it look better.

For the backend:

protected override void OnLoad(EventArgs e)
{
CreateMail();
base.OnLoad(e);
}

private void CreateMail()
{
ctrlPasswordRecovery.MailDefinition.From = "email"; //Fetch from db, xml or property
ctrlPasswordRecovery.MailDefinition.Subject = "Subject"; //Fetch from db, xml or property
ctrlPasswordRecovery.SuccessText = "Succeded"; //Fetch from db, xml or property
ctrlPasswordRecovery.MailDefinition.BodyFileName = "RecoverPassword.txt";
}

And thats it.

The one thing that is really really bad about the passwordrecovery is that you can’t modify the body without using a txt file. i.e you can’t just make a method to generate the mailbody. You can indeed override the sending method and make your own mailbody, BUT, you can’t send the username and password in a format you wish. e.g if you speak another language than english and would like to send the email in say, spanish. I’ve searched around quite a lot but all I’ve found is the same ”make a txt file”. If someone knows how to send the password and username, please let me know.

Otherwise in a txt file you just use <%UserName%> and <%Password%> and in that way you can modify your txtfile however you want.

Among many of my joys, you can find the love to marvel comics. Recently they made a new comic called Wolverine and the X-Men and it’s really entertaining, I do recommend it if you fancy Marvel. Anyway, their plane was kinda smashed and when it was fixed, the lad that fixed it was really anxious about them taking off with it. Wolverine then takes up his claw and makes this huge scratch on the side of it, the poor lad screams and ask why in earth he did that.

”The first one is always the hardest, might aswell get it over with and now you wont worry about it”

Oh so true that is. Imagine the first day at a new job, first day at school, first date, first time you screw up and the first post on a blog…. its hard 😛

Hopefully, I’ll fill this place up with decent content. The idea is to post quite a lot about developing (specially since I’m going to develope an episerver5 based on vb.net and I’m more than sure that I’ll find a lot of problems which might be interesting to post about), gaming and some personal stuff.

Some posts might pop up in swedish but I’ll just take it as it comes.

Now that I’m done with the install (which was painfully easy!) I’ll goof around and see what widgets and more stuff I can find for wordpress and play some FM09. Oh… and change my old blogs and so forth. With that comes twitter, facebook, Jaiku and so on and so forth.

Peace

/Rizo