Giter Club home page Giter Club logo

Comments (5)

villagedefrance avatar villagedefrance commented on August 24, 2024

Good point. I will have a look ...

from opencart-overclocked.

villagedefrance avatar villagedefrance commented on August 24, 2024

Alright, I had a look today ...

I can see the practicality of having a getGroupName() function in system/library/user.php, but I don't think it is being used enough to justify its addition to the user class.

However, there is a function in the admin user model file to get the User Group Name.
It requires 2 parameters: $user_id and $user_group_id.
It can be called anywhere under admin provided the model file is loaded:
$group_name = $this->model_user_user->getUserGroup($user_id, $user_group_id);

So I will not add it to the user class at this stage.

from opencart-overclocked.

gob33 avatar gob33 commented on August 24, 2024

I have the case in one of my OC extension where i needed current user group id and group name.
In your 1.7, group ID is already set at login. Having group name in the same query is easy.
This prevent doing +1 query.
With getUserGroup($user_id, $user_group_id), you need first to have current user group id (+1 query on OC).

from opencart-overclocked.

gob33 avatar gob33 commented on August 24, 2024

All you have to do is change

SELECT permission

to

SELECT name, permission

and add a function getGroupName() in library/user.php
Cost nothing.

from opencart-overclocked.

villagedefrance avatar villagedefrance commented on August 24, 2024

Yes, I actually tried that, but all I had as a result was a Url.
I'm not exactly sure why.
I will try to implement this again in time.

from opencart-overclocked.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.