1
loukaum
Add user to a specific group.
  • 2007/12/5 17:43

  • loukaum

  • Just popping in

  • Posts: 93

  • Since: 2003/11/2


Hello All,

I got one group called "subscribed" and it´s groupid is 3.

I changed userinfo.php to show only to webmaster´s group a button on every user profile "Add to Subscribed Group" now I want to click on this button and put the users in this specific group.

How can I do that?

Thanks in advanced.
Resized Image

2
Bleekk
Re: Add user to a specific group.
  • 2007/12/5 18:03

  • Bleekk

  • Theme Designer

  • Posts: 940

  • Since: 2002/12/14


why do you not add the user to the new group over system admin -> edit user -> modify user ?

3
loukaum
Re: Add user to a specific group.
  • 2007/12/5 18:10

  • loukaum

  • Just popping in

  • Posts: 93

  • Since: 2003/11/2


The person who will do this task can´t have the admin access (I will change the group allowed to access the button when finished this tweak), this person needs to get some users data before put the user at this group...
Resized Image

4
loukaum
Re: Add user to a specific group.
  • 2007/12/10 15:24

  • loukaum

  • Just popping in

  • Posts: 93

  • Since: 2003/11/2


any clue?
Resized Image

5
mboyden
Re: Add user to a specific group.
  • 2007/12/10 19:36

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


Your best bet is to use a custom user/profile/registration module and give permissions to the right group to be able to administer the module (and thus do the group edits you want). The one I'd recommend at this point is SmartProfile (about all that currently exists).

Unfortunately, I've found there are still a few bugs in it, reported on the SmartProfile bugtracker at the devXoops site (site remains down at this point). First, get the CVS version 1.0.3 as posted in the forums, then to get it all updated to work right, you can get more info from a SmartFactory Posting or my posting.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

6
loukaum
Re: Add user to a specific group.
  • 2007/12/11 19:48

  • loukaum

  • Just popping in

  • Posts: 93

  • Since: 2003/11/2


Best regardings Mark!

First of all thanks for the link, I already use the Smartprofile and I need a lot the solutions that U developed! God blees U man! =D

Forgive my bad English, I try to do my best, but I know that isn´t enough. =D

Well let me explain about my environment on this site:

I got 5 groups who work on this site:

Webmasters
Anonymous
Registered
Subscribed
Selection Process
Financial

It´s for a Brazilian University, It´s an application form. Here in Brazil, to went to university U need to make a test with others students, the bests on the tests are able to study.

So, I have this form where people interested, can fill to do that test, so when he finish to fill the form and activate the account, he is on the Registered group. Ok! But only if he pay the "Subscribe Tax", he has the right to do the test, people ho has the right to do the test are in the Subscribed group.

Only the 2 members of the "Financial" group receive the report from the bank informing what users ID pay the tax. So they have to put that users in the "Subscribed" group to allow they to do the tests. But they also generate a report (made by hand) where they need some data from the custom fields. So, I setup the right permission in order to they see that fields.

What I want is: Hack SmartProfile, to allow The "Financial" group easily get that data (already working with smartprofile with right permisssions) and put the users on the "Subscribed" group. It´s almost everthing done, including the hacks on the SmartProfile to show the button "Mark as Subscribed" on the users profiles only to "Financial" group. But now, I don´t know what to put in that button to move the users from "registered" to "subscribed".

Basically, that´s it! :)
Resized Image

7
trabis
Re: Add user to a specific group.
  • 2007/12/11 20:15

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Precisas de direcionar o botão para um ficheiro que contenha estas linhas (entre outras claro)
$uid 120//deve conter o id do usuário que irá ser adicionado
$groupid 3//id do grupo ao qual vais adicionar.

$member_handler =& xoops_gethandler('member');
                            
// adicionar um usuário a um grupo
                            
if($groupid && $uid){

$result $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix('groups_users_link')." WHERE groupid='".$groupid."' AND uid=".$uid."");

list(
$group_check) = $xoopsDB->fetchRow($result);

$xoopsDB->freeRecordSet($result);

if(
$group_check == 0){

//Caso não esteja já adicionado então adicionar ao grupo

$member_handler->addUserToGroup($groupid$uid);

}
}


Atenção, eu não experimentei isto ainda mas deverá resultar.

8
loukaum
Re: Add user to a specific group.
  • 2007/12/11 21:03

  • loukaum

  • Just popping in

  • Posts: 93

  • Since: 2003/11/2


*** PROBLEM SOLVED ***

Trabis, muito obrigado pela ajuda! Saudações meu amigo.
Resized Image

Login

Who's Online

213 user(s) are online (136 user(s) are browsing Support Forums)


Members: 0


Guests: 213


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits