Online social networks and virtual communities often share the same meaning in the literature. However, they are two very different concepts. Let's elaborate.
Dholakia et al. differentiated between the two concepts, defining virtual communities as:
“consumer groups of varying sizes that communicate regularly and for some duration in an organized way over the Internet through a common location or mechanism to achieve personal as well as shared goals of their members” 
On the other hand, Ellison and Boyd argued that social network sites:
“are primarily organized around people, not interests… structured as personal (or egocentric) networks, with the individual at the center of their own community” 
The size of the network is a major factor of these two ways of functioning. Indeed, online social networks gather a broad audience enabling users to articulate and make visible their social networks, but the opportunity to come into contact with strangers usually is of minor importance .
Putnam  argued that weak ties – referring to social networks – imply a bridging behavior between individuals leaving aside emotional support whereas strong ties – referring to virtual communities – imply a bonding behavior involving a strong emotional support between individuals. This argument may entice interests in emotional values and gift concepts that are fundamental constructs in virtual communities.
Addressing similar factors, Meglino and Korsgaard argue that:
“sociality maintains that group members suspend their personal interests in order to ensure their group’s continued existence” 
Nevertheless, although online social networks and virtual communities are often confused in the literature, this concept will not always apply to both online networks. Virtual communities indeed differ from social networks, in particular because common interest is an important prerequisite for gift-giving culture through the Internet medium. 
Finally, within these virtual communities, one should also consider the differences in the users profiles and their willingness to participate in the group’s mission. Janzik and Raasch distinguish between:
‘’ (1) Innovators and activists, (2) crowd-followers and tourists and (3) lurkers. The group of innovators and activists leads discussions and forms opinions, and is a fundamental driver of the Online Communities for its survival and advancement. Tourists have a passing interest in the main topic of the Online Communities. Crowd-followers have individual interests differing from the main topic of the Online Communities and participate in discussions for other reasons e.g., closer social ties. Lurkers participate passively without contributing within the Online Communities’’
 Dholakia, U. M., Bagozzi, R. P., and Pearo, L. K. 2004. “A social influence model of consumer participation in network- and small-group-based virtual communities.,” International Journal of Research in Marketing (21:3), pp. 241–263.
 N. B Ellison et D.M. Boyd, « Social network sites: Definition, history, and scholarship », Journal of Computer-Mediated Communication 13, no 1 (2007): 210‑30.
 Sonja Grabner-Kräuter, « Web 2.0 Social Networks: The Role of Trust. », Journal of Business Ethics 90 (2010).
 Putnam, Robert. Bowling Alone: The Collapse And Revival Of American Community. New edition. S & S International, 1995.
 Bruce M. Meglino et Audrey Korsgaard, « Considering Rational Self-Interest as a Disposition: Organizational Implications of Other Orientation. », Journal of Applied Psychology 89, no 6 (2004): 946‑959.
 Magnus Bergquist et Jan Ljungberg, « The power of gifts: organizing social relationships in open source communities. », Information Systems Journal 11, no 4 (octobre 2001): 305‑320.
 Lars Janzik et Christina Raasch, « Online Communities In Mature Markets: Why Join, Why Innovate, Why Share? », International Journal of Innovation Management 15, no 04 (2011): 797‑836.