Skip to main content
10 votes
Accepted

How to know which usergroup/specific access level user belongs to

To get an array of groups the currently logged in user belong to, you can use the following: $user = JFactory::getUser(); $groups = JAccess::getGroupsByUser($user->id); var_dump($groups); To ...
Lodder's user avatar
  • 26.9k
7 votes
Accepted

Redirect users to the last page visited, after login from component

Quite simple to do this. You will firstly need to create a Template Override for the following file: components/com_users/views/login/tmpl/default_login.php Once done, open the following file (your ...
Lodder's user avatar
  • 26.9k
7 votes

Direct logout link

As a final answer, Joomla has a builtin "Logout" menu item, added to core I think around 3.4* maybe 3.5. So now you don't need any additional plugins. The logout menu item also allows for a redirect ...
BodgeIT's user avatar
  • 677
6 votes
Accepted

Redirect users to the page pointed in the URL after login

First of all, com_users login is written to use POST method, so adding ?return= don't give you anything, it won't work. If we don't specify return in post data, model will use default pointing into ...
Lanah's user avatar
  • 522
6 votes
Accepted

Adding text to registration form

There are two ways you can do for that (both are safe from Joomla update / you won't loose the changes when updating your Joomla) 1. By using template override Copy the file /components/com_users/...
webchun's user avatar
  • 2,418
5 votes

User Enabled but not Activated

Enabled allows a user to login at will. If you switch Enabled for a user to 'off' they won't be able to get into their account. Activated however only happens one time usually by the administrator, or ...
Rafe's user avatar
  • 247
4 votes
Accepted

Check if a user account was activated by administrator

I have been able to resolve this question by writing my own plugin, as recommended by Lodder in the comments. My plugin is very simple; it merely creates a user note against the user when the user's ...
Simba's user avatar
  • 610
4 votes

Assign template to user

I believe you'd need to write/find a plug-in to fully achieve that. The following question gives a basic framework for such a plugin: https://stackoverflow.com/questions/20049266/how-to-set-a-...
RichardB's user avatar
  • 3,082
4 votes
Accepted

Find user by email

Joomla\CMS\Table\User::load() can only load rows by user ID. Use database query to get user ID by email and pass it to table's load() method: $db = JFactory::getDbo(); $query = $db->getQuery(true) ...
Sharky's user avatar
  • 11.5k
4 votes
Accepted

Redirect if userid is not found in a database table

The first problem is that you're using joomlausers->id which doesn't look correct. It should be $joomlausers->id (with a $ at the beginning). Secondly, loadObjectList() returns an indexed array ...
Lodder's user avatar
  • 26.9k
4 votes
Accepted

What is the correct way to programmatically delete a joomla user and their data?

The documentations has this : https://api.joomla.org/cms-3/classes/Joomla.CMS.User.User.html but it seems that no parameters are passed to user->delete? That's correct. This method works on the user ...
Sharky's user avatar
  • 11.5k
4 votes
Accepted

How to get user object in Ajax call

When importing classes using use statement, it has to be outside of your class. When put inside a class, it's interpreted as a use of trait. And when used inside a method it will cause a syntax error. ...
Sharky's user avatar
  • 11.5k
4 votes
Accepted

Non deprecated method in Joomla! 4 to load user by userid

Use Joomla\CMS\User\UserFactory. You can get it from the service container: use Joomla\CMS\User\UserFactoryInterface; $userFactory = $container->get(UserFactoryInterface::class); Or using alias: $...
Sharky's user avatar
  • 11.5k
3 votes
Accepted

When a content is trying to display to super user in Joomla 3.6.2, its not working with parse syntax error

you have some error in your code. Please try this : <?php //i want this to display only to super users $user = JFactory::getUser(); if($user->authorise('core.admin')) { ?><li><a ...
Joomler's user avatar
  • 1,811
3 votes
Accepted

Redirect users after they reset their password

The onUserAfterSave hook allows you to access this data at the appropriate time via a plugin.
RichardB's user avatar
  • 3,082
3 votes

Direct logout link

I found that on Joomla 3.9.22, a link to /component/users/?task=user.logout worked as a logout link that did not require a userToken. When I used index.php?option=com_users&view=login&layout=...
ApolloLV's user avatar
  • 141
3 votes

How to let users delete their account from the frontend?

Community Builder Profile Privacy plugin also does this, if you use Community Builder for your membership management. Besides deleting an account, it also allows user to temporarily disable their ...
Margaret's user avatar
3 votes

Is it possible to know the time spent by a student on a particular topic?

You can use the unload window event. Will be need make a plugin that send userId, pageId and time information to a controller that store this on database and provide statistics about it. <script ...
Guilherme's user avatar
  • 347
3 votes

Logout within plugin interfering with other plugins

The Joomla plugins run as they are ordered in the Joomla backend. Change the ordering - and ensure that the ordering of your plugin is last. This will ensure that all other plugins will run before ...
itoctopus's user avatar
  • 3,226
3 votes
Accepted

creating users programmatically causing conflict with logged in username display

I finally resolved the issue. All I had to do was make sure that once the new user was created I set the $user variable back to the active user data by using JFactory::getUser(). I was really over ...
user11029's user avatar
3 votes

Assign user to a specific group based on custom field selected

Write user plugin which will have the below file structure plugins/user/plugins_name/ plg_add_group.php plg_add_group.xml plg_add_group.xml - Write plugin manifest code here you can ...
Sudhir Sapkal's user avatar
3 votes

Get contact details from article override

You will firstly need to retrieve the user ID like so: $id = JFactory::getUser()->id; Then get the array of profile data, like so: $profile = JUserHelper::getProfile($id)->profile; You can ...
Lodder's user avatar
  • 26.9k
3 votes
Accepted

How to write the logged in user id in Plotalot queries?

Plotalot includes various variables that can be used in sql queries, eg. %%J_USER_ID%% is the currently logged in user_id. The Plotalot User Documentation Available as PDF here
jamesgarrett's user avatar
  • 3,299
3 votes
Accepted

create user and set its frontend language via php-script

Frontend language field is called language, not frontend-language. It also doesn't have its own column in the database. Instead it's JSON-encoded with other params and stored to params column. Remove ...
Sharky's user avatar
  • 11.5k
3 votes

Redirect if userid is not found in a database table

I don't think it is very direct to filter the result set when sql is perfectly qualified to do such logic. As Lodder corrected, you also need to use setQuery(), fix your missing $, adjust your result ...
mickmackusa's user avatar
  • 4,826
3 votes
Accepted

User Registration Assign to Specific Group

Briefly, these are your main options: Write a custom user registration component Write a User Plugin that will handle the usergroup of the registered users Use 3rd party Form extensions which ...
FFrewin's user avatar
  • 19.7k
3 votes

Front End Management of Joomla Users

This information does exist in the frontend model, but for whatever reason, isn't actually displayed. Copy /components/com_users/views/profile/tmpl/default_core.php to you template directory, so /...
Grant G's user avatar
  • 714
3 votes

Verification code not found

I suspect that because you've got the 403 error message "Verification code not found" that the request is actually being rejected by Joomla itself. The language string ...
Robbie Jackson's user avatar
3 votes
Accepted

How do I view the search history?

Joomla has two search options: Search and Smart Search. Depending on which you choose may dictate some factors. For Search (Components > Search) you will need to manually enable gathering search ...
Patrick Jackson's user avatar
3 votes

Joomla User Registration Form Plugin not working - simple registration (PlgUserSimpleRegistration)

I finally found the answer class PlgUserSimpleRegistration extends JPlugin change "Plg" with "plg" class plgUserSimpleRegistration extends JPlugin It's working now
Jeremy Sanglier's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible