I am pretty sure that the Marriott Rewards policy intends that a member gets elite night credits only for the room the member stays in. Although, I have seen others comment that they have succeeded in getting elite night credits for other rooms their guests have stayed in which were booked under a different reservation using their member number. I found the following verbiage regarding the policy, and it seems to support that credit is only earned for those nights personally stayed by member. However, the verbiage seems a bit unclear.
Elite Membership Requirements
You'll get points for both rooms and all spends (except courtyards where it's the roomrate only, yeah, yeah, don't even go there!) but elite nights only for the room you stay in.
The elite nights track your nights towards the total annual elite target, you can add to the total by getting the marriott credit card though. My free UK version credits me 10 nights each year, though I understand theres a US version that awards 15!