MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Personal Blog  (Mono Support )

Viewed 12658 time(s), 3 post(s) 20.09.2011 07:38:07by Maxim
Maxim

Maxim

20.09.2011 07:38:07
Hi. How I can to allow user to create and populate this personal blog?
Dieser Inhalt wurde noch nicht bewertet. 
319 Reputation 30 Total posts
imarusic

imarusic

20.09.2011 08:21:29
Hi Maxim,

you have to create a blog for each user during the account creation. To do so you need to attach to membershipEditor AccountCreated event on registration page. Below is a code snippet:

1. Put this in Registration page init method.
ctlMembershipEditor.AccountCreated += new MonoSoftware.MonoX.ModuleGallery.MembershipModuleEvent(ctlMembershipEditor_AccountCreated);

2. This code will create a blog for user.
void ctlMembershipEditor_AccountCreated(object sender, MonoSoftware.MonoX.ModuleGallery.MembershipModuleEventArgs e)
{
            BlogEntity blog = new BlogEntity(GuidExtension.NewSequentialGuid());
            blog.Name = e.MembershipUser.UserName;
            blog.Slug = UrlSeoOptimizer.GetOptimizedString(blog.Name);
            blog.DateCreated = DateTime.Now;
            blog.UserId = new Guid(e.MembershipUser.ProviderUserKey.ToString());
            blog.ApplicationId = MembershipRepository.GetInstance().GetApplicationId();
            blog.LanguageId = LocalizationUtility.GetCurrentLanguageId();
 
            MonoXCacheManager cacheManager = MonoXCacheManager.GetInstance();
            cacheManager.RemoveAll(CacheKeys.Blog.Root);
            cacheManager.RemoveAll(CacheKeys.Blog.Editors);
 
            using (BlogRepository rep = BlogRepository.GetInstance())
                rep.SaveBlog(blog);
}


After user account creation you can navigate to your blog page with the following url:

/blog/posts/username/


Regards
Bewertet mit 5,00, 1 Besucher. 
3016 Reputation 428 Total posts
Maxim

Maxim

23.09.2011 12:58:26
thanks for you answer!
Can you explain me step 1 a little bit more. :) How I can to modify existing page?
Dieser Inhalt wurde noch nicht bewertet. 
319 Reputation 30 Total posts