for e.g., In the register form user is presented an option of choosing
user type 1. individual 2. organisation
how do i add the user to the appropriate group depending on his selection?
(i went through the group archives, and one solution was to use
request.args, but i want to use single register link)
I thought i should post the code, if anybody in future needs it:
#controllers/default.py
def __add_user_membership(form):
group =
db(db.auth_group.role==form.vars.user_type).select().first()
user_id = form.vars.id
auth.add_membership(group.id,user_id)
def user():
auth.settings.register_onaccept = __add_user_membership
# already existing code
def __add_user_membership(form):
group_id = auth.id_group(role=form.vars.user_type)
user_id = form.vars.id
auth.add_membership(group.id,user_id)
On Thu, 22 Dec 2011 01:52:50 +0530, Anthony <abas...@gmail.com> wrote:
Hi Kumar,
am at the wall with the same problem you hard, am not having success
default.py
def __add_user_membership(form):
group_id = auth.id_group(role=form.vars.account_type)
Thanks Anthony,