1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function payment_behavior_extend_membership($users, $group, $periods = 1, $groupId = 0)
9{
10	$userlib = TikiLib::lib('user');
11
12	$users = (array) $users;
13
14	foreach ($users as $u) {
15		$userlib->extend_membership($u, $group, $periods);
16		$attributelib = TikiLib::lib('attribute');
17		$attributes = $attributelib->get_attributes('user', $u);
18
19		foreach ($attributes as $a) {
20			$attname = 'tiki.memberextend.' . $groupId;
21			if (isset($attributes[$attname])) {
22				$attributelib->set_attribute('user', $u, $attname, '');
23			}
24		}
25	}
26}
27