why do u need to register anonymus user,that does not make sense
a user who is registered is authenticated or registered user...anonymous user is one who is not registerd
I want to add 2 type of users as
one as Autthenticate and
second as Non Authenticate with username and password.
Is this possible or not.
Please help me for doing this.
Ramesh Gollapudi.
iN my Project i have to users of types 3
one is visitors(withour login) Annonymous
second one is Authentocate(username and password) Authenticate
third one is clients (Username and Password).How to differentiate Authenticate and Client type user[This is the usertype only].Please tell me.
That is my doubt is how to add and differentiate 3 type of users in drupal project.
Thank you.
Ramesh Gollapudi.
iN my Project i have to users of types 3
one is visitors(withour login) Annonymous
second one is Authentocate(username and password) Authenticate
third one is clients (Username and Password).How to differentiate Authenticate and Client type user[This is the usertype only].Please tell me.
That is my doubt is how to add and differentiate 3 type of users in drupal project.
Thank you.
Ramesh Gollapudi
I completed this But i have one more doubt related to this how to add directly roles (differentiate roles) in user reigistration.Please tell me in drupal 5.
Roleassign module allows role to be defined and presented to the user during registration. Then the user chooses one of the roles and is assigned to that particular role. There is also a similar module autorole assign but I am not sure exactly how the two differ.
// Delete a blocked user's sessions to kick them if they are online.
if (isset($array['status']) && $array['status'] == 0)
{
sess_destroy_uid($account->uid);
}
// Refresh user object
$user = user_load(array('uid' => $account->uid));
user_module_invoke('after_update', $array, $user, $category);
}
else
{
$array['uid'] = db_next_id('{users}_uid');
print_r($array['uid']);echo $array['uid'];
if (!isset($array['created']))
{ // Allow 'created' to be set by hook_auth
$array['created'] = time();
}
// Note, we wait with saving the data column to prevent module-handled
// fields from being saved there. We cannot invoke hook_user('insert') here
// because we don't have a fully initialized user object yet.
foreach ($array as $key => $value)
{
switch ($key)
{
case 'pass':
$fields[] = $key;
$values[] = md5($value);
$s[] = "'%s'";
break;
case 'uid': case 'mode': case 'sort':
case 'threshold': case 'created': case 'access':
case 'login': case 'status':
$fields[] = $key;
$values[] = $value;
$s[] = "%d";
break;
default:
if (substr($key, 0, 4) !== 'auth' && in_array($key, $user_fields))
{
$fields[] = $key;
$values[] = $value;
$s[] = "'%s'";
}
break;
}
//echo "starts";echo
//print_r($array);
}
//echo "starts";echo
// print_r($array);
db_query('INSERT INTO {users} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $s) .')', $values);
//echo 'INSERT INTO {users} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $s) .')', $values;
//echo "user value=";echo $array['users'];echo "uid value=". $array['uid'];
$array['uid']=$array['uid'];$array['users']=$array['users'];
if($array['users']==4)
{
//echo 'INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $array['uid'],$array['users'];
db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $array['uid'],$array['users']);
//echo "user roles starts";print_r($account->uid);print_r($rid);
//print_r($values);
}
//exit;
// Build the initial user object.
$user = user_load(array('uid' => $array['uid']));
// Build and save the serialized data field now
$data = array();
foreach ($array as $key => $value) {
if ((substr($key, 0, 4) !== 'auth') && ($key != 'roles') && (!in_array($key, $user_fields)) && ($value !== NULL)) {
$data[$key] = $value;
}
}
db_query("UPDATE {users} SET data = '%s' WHERE uid = %d", serialize($data), $user->uid);
hi Ramesh...glad that you were successful...so what you did was install the role assign module and it'll take care of the rest or ....have you modified the code that is in the user.module?should I paste the code that you've given above...
pl guide in the right direction....
Advertising sustains the DA. Ads are hidden for members. Join today
Comments
why do u need to register
why do u need to register anonymus user,that does not make sense
a user who is registered is authenticated or registered user...anonymous user is one who is not registerd
Thank you but i want to add two type of users please help me
I want to add 2 type of users as
one as Autthenticate and
second as Non Authenticate with username and password.
Is this possible or not.
Please help me for doing this.
non authenticated user
non authenticated user cannot have a username and password...tell me for wat r u thrying htis whole stuff.i can come out with some other suggestions
THANK YOU.
Ramesh Gollapudi.
iN my Project i have to users of types 3
one is visitors(withour login) Annonymous
second one is Authentocate(username and password) Authenticate
third one is clients (Username and Password).How to differentiate Authenticate and Client type user[This is the usertype only].Please tell me.
That is my doubt is how to add and differentiate 3 type of users in drupal project.
Thank you.
THANK YOU.
Ramesh Gollapudi.
iN my Project i have to users of types 3
one is visitors(withour login) Annonymous
second one is Authentocate(username and password) Authenticate
third one is clients (Username and Password).How to differentiate Authenticate and Client type user[This is the usertype only].Please tell me.
That is my doubt is how to add and differentiate 3 type of users in drupal project.
Thank you.
You can creat different roles
Just go to admin >> user management >>roles and add new roles then go to admin>>user management access control and configure their access rights.
Thank you
Ramesh Gollapudi
I completed this But i have one more doubt related to this how to add directly roles (differentiate roles) in user reigistration.Please tell me in drupal 5.
i also need the same
I also want the same functionality.if you are successful post it
roleassign module and autorole assign
Roleassign module allows role to be defined and presented to the user during registration. Then the user chooses one of the roles and is assigned to that particular role. There is also a similar module autorole assign but I am not sure exactly how the two differ.
Online Business
Different roles in Registration success.Thank you.
Ramesh Gollapudi ,
It is the file in USERS Module in drupal.It is usefull for adding new users with different roles in Registration .Enjoy
function user_save($account, $array = array(), $category = 'account') {
// Dynamically compose a SQL query:
$user_fields = user_fields();
echo $user_fields[20]; //echo $user_fields(array[20]);
//echo $user_fields(array(["users"]))
echo "test";
echo $user_fields["users"];echo $users_fields[20][users];
echo $user_fields["users"][20].$user_fields["20"].$user_fields[users]['20'];
echo "hai";print_r($user_fields);
echo "starts";print_r($account->uid);echo "full";
if ($account->uid) {
user_module_invoke('update', $array, $account, $category);
//echo "starts";echo $account->uid;print_r($account->uid);exit;
$data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE uid = %d', $account->uid)));
foreach ($array as $key => $value) {
if ($key == 'pass' && !empty($value)) {
$query .= "$key = '%s', ";
$v[] = md5($value);
}
else if ((substr($key, 0, 4) !== 'auth') && ($key != 'pass')) {
if (in_array($key, $user_fields)) {
// Save standard fields
$query .= "$key = '%s', ";
$v[] = $value;
}
else if ($key != 'roles') {
// Roles is a special case: it used below.
if ($value === NULL) {
unset($data[$key]);
}
else {
$data[$key] = $value;
}
}
}
}
$query .= "data = '%s' ";
$v[] = serialize($data);
db_query("UPDATE {users} SET $query WHERE uid = %d", array_merge($v, array($account->uid)));
// Reload user roles if provided
if (is_array($array['roles'])) {
db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
//print_r($rid);exit;
foreach (array_keys($array['roles']) as $rid)
{
if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID)))
{
db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid);
//echo "154 starts";echo $account->uid;print_r($rid);
//echo 'INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid;
//exit;
if($form['account']['clients']==4)
{
$rids=$form['account']['clients'];$uids=$account->uid;
//echo "insert for clients starts";
$insert_query="insert into users_roles(uid,rid) values ($uids,$rids)";
//echo $insert_query;
//mysql_query($insert_query);
}
} //print_r($rid);
//echo "170 starts";echo $account->uid;print_r($rid);
//echo 'INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid;
//exit;
}
}
// Delete a blocked user's sessions to kick them if they are online.
if (isset($array['status']) && $array['status'] == 0)
{
sess_destroy_uid($account->uid);
}
// Refresh user object
$user = user_load(array('uid' => $account->uid));
user_module_invoke('after_update', $array, $user, $category);
}
else
{
$array['uid'] = db_next_id('{users}_uid');
print_r($array['uid']);echo $array['uid'];
if (!isset($array['created']))
{ // Allow 'created' to be set by hook_auth
$array['created'] = time();
}
// Note, we wait with saving the data column to prevent module-handled
// fields from being saved there. We cannot invoke hook_user('insert') here
// because we don't have a fully initialized user object yet.
foreach ($array as $key => $value)
{
switch ($key)
{
case 'pass':
$fields[] = $key;
$values[] = md5($value);
$s[] = "'%s'";
break;
case 'uid': case 'mode': case 'sort':
case 'threshold': case 'created': case 'access':
case 'login': case 'status':
$fields[] = $key;
$values[] = $value;
$s[] = "%d";
break;
default:
if (substr($key, 0, 4) !== 'auth' && in_array($key, $user_fields))
{
$fields[] = $key;
$values[] = $value;
$s[] = "'%s'";
}
break;
}
//echo "starts";echo
//print_r($array);
}
//echo "starts";echo
// print_r($array);
db_query('INSERT INTO {users} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $s) .')', $values);
//echo 'INSERT INTO {users} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $s) .')', $values;
//echo "user value=";echo $array['users'];echo "uid value=". $array['uid'];
$array['uid']=$array['uid'];$array['users']=$array['users'];
if($array['users']==4)
{
//echo 'INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $array['uid'],$array['users'];
db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $array['uid'],$array['users']);
//echo "user roles starts";print_r($account->uid);print_r($rid);
//print_r($values);
}
//exit;
// Build the initial user object.
$user = user_load(array('uid' => $array['uid']));
user_module_invoke('insert', $array, $user, $category);
// Build and save the serialized data field now
$data = array();
foreach ($array as $key => $value) {
if ((substr($key, 0, 4) !== 'auth') && ($key != 'roles') && (!in_array($key, $user_fields)) && ($value !== NULL)) {
$data[$key] = $value;
}
}
db_query("UPDATE {users} SET data = '%s' WHERE uid = %d", serialize($data), $user->uid);
installing the role asign module will do?or need to copy the cod
hi Ramesh...glad that you were successful...so what you did was install the role assign module and it'll take care of the rest or ....have you modified the code that is in the user.module?should I paste the code that you've given above...
pl guide in the right direction....