3

I'm using the Contus HD Video Share component on my site. The component adds a table that tracks whether or not a user can upload videos. Unfortunately this table is not kept in sync with the users tables, so every time a new user registers I have to manually go in and activate their upload capabilities, which is what creates an entry in the component table with their ID.

I say all that to ask: is there a hook/trigger for when a user is created that I can extend to programmatically activate this capability?

1 Answer 1

4

I think you could try to use onAfterSave (http://docs.joomla.org/Plugin/Events) to populate the proper database table and the upload state.

Take a look at an existing user plugin:

https://github.com/joomla/joomla-cms/blob/staging/plugins/user/profile/profile.php#L331

You can ignore most of the contents there except the constructor. The other events or methods don't matter really. But you should be able to pull the userid this way and then inject it into the table for the component.

Also - if you need to check and see if the account is new or not you can probably start with a query which checks to see if the record is in the video component table already. If so, then skip the insert. If not then go ahead and do the insert.

4
  • Agree. onAfterSave will be the best event to do the job. May 13, 2014 at 8:50
  • Not onUserAfterSave? May 13, 2014 at 11:25
  • Hmmm. I don't see onAfterSave in your link. I see onUserAfterSave which redirects to a page that has been deleted. May 13, 2014 at 12:48
  • It might be onUserAfterSave. That's what the code example has on Github. Could be the documentation is out of date. if you get a chance to try this, let us know if one works and one doesn't, we can update the answer. May 13, 2014 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.