If a person does not have an eruv tavshilin to rely on, either because he has forgotten to set aside an eruv twice in a row (and thus may not rely on the rabbi’s eruv) or because he forgot just this time and is in an area where no one set aside an eruv for everyone, then if he has a friendly neighbor who did set aside an eruv, the person can give his food to his neighbor as a gift. Then, since the neighbor now owns the food, the neighbor can cook and prepare it for Shabbat, and then give him some.
If one realized on Yom Tov that he forgot to set aside an eruv, and he has not yet cooked his Yom Tov meal, he may fill a big pot with enough food for Yom Tov and Shabbat. Since the pot is placed on the fire only once, putting in more food (marbeh be-shi’urim) is permitted. However, once the pot has been placed on the fire, he may not add anything to it for Shabbat (SA 503:2; 3:4 above).
If one did not realize he had forgotten to set aside an eruv until after he finished all his Yom Tov cooking, then to allow him to honor Shabbat, the Sages were lenient and allowed him to bake one loaf of bread, cook one pot of food, and light one candle for Shabbat (SA 527:20; MB ad loc. 55).
If one transgressed and knowingly cooked on Yom Tov for Shabbat beyond what the Sages permitted, the food cooked may be eaten on Shabbat. There is no concern that people will learn from him to do likewise, as everyone knows that the cooking he did was forbidden. However, if one finished his Yom Tov meal and then cooked more food, claiming that guests may arrive or that he wanted to eat more, then his family may not eat it on Shabbat, because if we are lenient with this type of deception (ha’arama), everyone would start using it and would never again set aside an eruv tavshilin (Beitza 17b; Rambam 6:10; SA 527:23-24; see above ch. 7 n. 3 concerning ma’aseh Yom Tov).
If one has not yet eaten his Yom Tov meal, but has already finished preparing the food for it, when he realizes that he forgot to set aside an eruv, may he cook more food for Shabbat and then eat some of this food at the Yom Tov meal so that his cooking on Yom Tov is not solely for Shabbat? Some poskim say that since in truth he is not interested in eating the food on Yom Tov, even if he does so, it is considered deceitful and forbidden (Radbaz; the first opinion in SA 527:21). Others permit it, since a little of each type of food will in fact be eaten on Yom Tov (Rema 503:1; MA). Many practice leniently, but it is better to be stringent (MB 503:7, 11).