Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Modifying Login Controller

13 years 11 months ago #150216 by laptoproadie
Modifying Login Controller was created by laptoproadie
I'm new to CB and Joomla in general, and have almost no experience coding my own components.


What I'd like to do is add functionality to CB's login controller to store a record in a db table anytime a user logs in. My website is going to house medical data and so they would like some reporting on who is logging in to look at the data.


How do I begin? I have a few questions if anyone could be so kind as to help me!

I'm looking in components/com_comprofiler/comprofiler.php which is where I think I need to start. But I can't find the actual function that executes the login. I can't tell whether CB is using a custom login controller or the base Joomla one.

Should I approach this differently? I don't like the idea of modifying CB code since that inhibits me from easily upgrading to a newer version, but I don't know how to add extra functionality to a component without modifying it's code internally.

Any help for a newbie would be much appreciated!

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
13 years 11 months ago #150258 by krileon
Replied by krileon on topic Re:Modifying Login Controller
There's no need to make modifications to the core, nor will we help you in doing so (we don't support core edits). This can be done with documentation subscriber incubator project CB Queries. This plugin allows execution of database queries (full substitution support!) at various triggers such as after user logs in. This would allow you to execute your query with absolutely NO php editing safely. More information on incubator projects can be found here .


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

13 years 11 months ago #150269 by laptoproadie
Replied by laptoproadie on topic Re:Modifying Login Controller
Thanks for your reply Kyle.

So far CB seems like a great and powerful tool, and it seems like you guys will eventually hook me into being a full subscriber.

My only concern is the same for the last extension pack we were trying to use for this same thing, Mighty Extensions.

I like their extensions as well, but their unwillingness to give up their source code even to members who paid for licenses is a dealbreaker.

If I can do everything I can ever possibly want to do without ever touching CB code, then I'll be a happy man. Are you telling me if I get CB Query and all the rest that there's no possible scenario in which I would need to touch the code? I would be hesitant to believe you if you said yes.

So, I want to purchase a membership...but I need some assurance that I will be able to customize code if needed otherwise my employer will never agree to purchasing.

Thanks Kyle

Please Log in or Create an account to join the conversation.

13 years 11 months ago #150271 by laptoproadie
Replied by laptoproadie on topic Re:Modifying Login Controller
I almost forgot that we also have another scenario in which we would need some customization.

We also need an extra user field called 'Member ID'. This integer field would be set when a user registers and would be an auto_increment database field. Anytime a user signs up, he/she gets assigned the next 'Member ID' integer, and the counter is incremented.

We also need to be able to create a small form on the backend that would reset the counter to whatever value they wanted.



Once again, I would love to become a subscriber, but I need to know that I can accomplish this custom solution before I can commit to becoming a habitual CB user.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
13 years 11 months ago #150328 by krileon
Replied by krileon on topic Re:Modifying Login Controller

I like their extensions as well, but their unwillingness to give up their source code even to members who paid for licenses is a dealbreaker.

All development except CBSubs is open source so you're free to edit them as you feel necessary. This means there is no encoding in place for CB Queries and various other projects. Notice that CB it self is not encoded.

If I can do everything I can ever possibly want to do without ever touching CB code, then I'll be a happy man. Are you telling me if I get CB Query and all the rest that there's no possible scenario in which I would need to touch the code? I would be hesitant to believe you if you said yes.

If all you're wanting to do is execute a database query say after a user logs in or after a user registers (or any other CB trigger.. see tutorials within my signature for trigger information) then yes you never have to touch CBs source code AND your queries would carry over everytime you upgrade CB, which would not happen if you made core edits.

We also need an extra user field called 'Member ID'. This integer field would be set when a user registers and would be an auto_increment database field. Anytime a user signs up, he/she gets assigned the next 'Member ID' integer, and the counter is incremented.

Users are already given a unique auto-incremented value. You can display this value using a delimiter field with the substitution [user_id].

Alternatively you could create a Read Only integer field. Then using CB Queries on the trigger "after registration" you can check and update that field to the next value. This would take a little bit of a complex UPDATE query then a simple + 1 appended to it (you should order by the integer field), but again completely doable without altering source or creating a new fieldtype plugin.

We also need to be able to create a small form on the backend that would reset the counter to whatever value they wanted.

Not sure how you'd achieve this aside from making the query explained above more complex.

Once again, I would love to become a subscriber, but I need to know that I can accomplish this custom solution before I can commit to becoming a habitual CB user.

There's no guarantee any of the plugins will provide what you want. Incubator projects are a bit more complex and "state of the art" as they're my personal projects with "no strings attached". There is no documentation for them and no official support for them (aside from the projects forums page).

Best I can suggest is review the incubator page given earlier and if at least 2 or 3 of the projects can be of user then it would certainly be a worthy investment IMO.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum