Programmatically changing a user's group

Permalink
Hi, is there a way to automate changing a user's group? For instance, let's say there are two groups, Customers and Guests. Suppose a customer's subscription is over, I want the user's group changed back to guest in order to restrict access to store content. How can I pull this off? Thanks.

 
clint15 replied on at Permalink Reply
Never mind. Solved it using mySQL. Used php to query the user's subscription on the database. Depending on the subscription status, I would programmatically change the user's group using either;
if (!$u->inGroup($g)) {
    $u->enterGroup($g);
}

or
if ($u->inGroup($gr)) {
    $u->exitGroup($g);
}

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.