I want to change the userlevel to author when my form is submitted..
this form is a registeration for a higher level access in the site (and this form is already restricted for only registered users).
So I need some PHP Code that will use some Jobject to define the current userlevel as authour.
Some one can tell me what is the code I need to add for that?
Hi goomian,
Fredrik (nml375) has posted this a couple of times - try searching here on 'getuser gid'
Bob
Fredrik (nml375) has posted this a couple of times - try searching here on 'getuser gid'
Bob
I checked the code that you reffered me to but it's not working.
I tried writing this on the onsubmit after Email
It's working!!!
But the user need to log out and then log in again to see the author's restricted places in the site. how can I fix that???
The code that you referred me to is not working and the user GID became 0 so he cannot login anymore and not showing in the userlist of jumla. I found it later by looking directly at the database.
I tried writing this on the onsubmit after Email
<?php
$user =& JFactory::getUser();
$user->usertype = "Author";
$user->gid=19;
$user->save();
?>
It's working!!!
But the user need to log out and then log in again to see the author's restricted places in the site. how can I fix that???
The code that you referred me to is not working and the user GID became 0 so he cannot login anymore and not showing in the userlist of jumla. I found it later by looking directly at the database.
Hi goomian,
Sorry I've no idea if you can upgrade a user on the fly like that. You could just use a status indicator in a table and that would work instantly.
Bob
Sorry I've no idea if you can upgrade a user on the fly like that. You could just use a status indicator in a table and that would work instantly.
Bob
Hi,
The code I posted some time ago is intended to be used along with the User Registration plugin. The modifications you've done should work as you described though.
I believe that the reason your users need to logout/logon again to gain their privileges, is that the JUser object in the session storage has not yet been updated. You could try adding something like this to your code, though I havn't tried this myself:
Note that this would only update the current session, so a user logged in at multiple places would still have to relog on the other sessions.
/Fredrik
The code I posted some time ago is intended to be used along with the User Registration plugin. The modifications you've done should work as you described though.
I believe that the reason your users need to logout/logon again to gain their privileges, is that the JUser object in the session storage has not yet been updated. You could try adding something like this to your code, though I havn't tried this myself:
$session =& JFactory::getSession();
$session->set('user', $user);
Note that this would only update the current session, so a user logged in at multiple places would still have to relog on the other sessions.
/Fredrik
This topic is locked and no more replies can be posted.