Learners' community choice has a crucial role in e‐learning effectiveness. Indeed, individual and structural factors (i.e., learners pre‐existing profiles and networks of interactions) significantly affect how learners develop a collaborative e‐learning environment. In this context, social network analysis, singularly community detection has been a good approach to improve collaborative environment through discovering pertinent learners' communities and new effective relations. However, with social media emergence, many real‐world networks, such as learners' networks, evolve the connections in multiple layers, where each layer represents a different type of relationship. This, combined with their continuous evolution over time, has brought new challenges to the field of community detection. Thus, this paper proposes a new configurable algorithm for detecting collaborative and lifelong communities within dynamic multirelational social learners' networks. To do so, this algorithm is based on a graph model to represent these different interactions as well as different learners' profiles and characteristics. Moreover, by using particle swarm optimization, it aims to optimize a configurable combined metric to detect the most relevant community appropriate to a given situation. Finally, it considers the temporal dimension to find the final lifelong community. By the end of this paper, experimental results using synthetic networks prove that the proposed algorithm achieves better results compared with other community detection algorithms. Therewith, experiments on a real e‐learning network show this algorithm's role in improving collaboration within learners' network.