Cancelling CreatingContent event when trying to create a page will also show the error message further on when trying to create translation pages in same container

Vote:
 

Hi,

We are trying to stop users from creating pages in other language than our master language by cancelling the CreatingContent Event and showing an error message:

        public virtual void CreatingContent(object sender, ContentEventArgs e)
        {
            var languageBranch = ContentLanguage.PreferredCulture.Name.ToLower();
            if (languageBranch != "en-us")
            {
                e.CancelReason = string.Format("You have to create a page in master language en-US. You are trying to create a new page in {0}", languageBranch);
                e.CancelAction = true;
                return;
            }
}

This code will show the cancel message in the red error message field but doing this will also show this message further on when trying to translate pages in the same container which we of course do not want.

Changing to another container or doing a full refresh of the site will stop this message from showing any more.

Seems this may be a bug or do we need to add some more code to make it work?

Regards

Sammy

#120741
Apr 23, 2015 17:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.