[Tiki-devel] Question about events and design

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Tiki-devel] Question about events and design

Fabio Montefuscolo
Hello,

I was trying to insert a new userpref in Tiki to hold XMPP password and what I did is add some line in tiki-user_preferences.php. Is it right?

Well, very close to point where I added those lines, I found `TikiLib::events()->trigger('tiki.user.update')`. If I could bind this event, I would be able to setup new userprefs in XMPP library instead edit a "core" file. In this way is easy to add and remove libraries. Makes sense?

But I couldn't bind event, because when POSTing, the trigger moment happens before I can bind it and also, I would break some development pattern.

Bye :)

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] Question about events and design

Jonny Bradley-4
Hi Fabio

Is this http://sourceforge.net/p/tikiwiki/code/61531 you are talking about? (i guess)

This is a very good question, and to be honest i'm not 100% sure - do we have a dev page about it? I can't see anything about it here https://dev.tiki.org/Create+a+new+preference

I think (!) you have it about right, make a new pref in lib/prefs/users.php (and one without the beginning users_prefs_ part for the default if you need it i think), and then you have to make the form inputs "by hand" in tiki-user_preferences.php and tiki-user_preferences.tpl - messy, that could be improved ;)

Does anyone know better? Or know of some docs about this? If there aren't any we should start some! ;)

Regarding the event thing, i don't completely follow you but i think you need to add a $events->bind in lib/setup/events.php to call the function you want to trigger in your library.

Does that help?

jonny





> On 7 Mar 2017, at 00:02, Fabio Montefuscolo <[hidden email]> wrote:
>
> Hello,
>
> I was trying to insert a new userpref in Tiki to hold XMPP password and what I did is add some line in tiki-user_preferences.php. Is it right?
>
> Well, very close to point where I added those lines, I found `TikiLib::events()->trigger('tiki.user.update')`. If I could bind this event, I would be able to setup new userprefs in XMPP library instead edit a "core" file. In this way is easy to add and remove libraries. Makes sense?
>
> But I couldn't bind event, because when POSTing, the trigger moment happens before I can bind it and also, I would break some development pattern.
>
> Bye :)
> ------------------------------------------------------------------------------
> Announcing the Oxford Dictionaries API! The API offers world-renowned
> dictionary content that is easy and intuitive to access. Sign up for an
> account today to start using our lexical data to power your apps and
> projects. Get started today and enter our developer competition.
> http://sdm.link/oxford_______________________________________________
> TikiWiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Loading...