I had to urgently move to elgg 3. because older version of elgg are not working with latest ubuntu.(rewrite rules fails) I have to migrate tones of code now within a day.
But there s ino proper migration guide. For now someone can suggest me .
How to migrate the code which uses elgg_register_lib.?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- seri_ng@seri_ng
seri_ng - 1 like
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- iionly@iionly
iionly - 0 likes
You must log in to post replies.I've been working on upgrading my site from elgg2.3.7 to 3.0.3 as well and this is what I learned so far.
elgg_register_library is removed from elgg3.*. What I did with my plugins was using the word 'require' or 'require_once' inside init function in the start.php file of my plugin. Below is the example:
require elgg_get_plugins_path( ) . 'plugin_name/lib/library_name.php';
Read more here http://learn.elgg.org/en/stable/appendix/upgrade-notes/2.x-to-3.0.html?highlight=elgg_register_library
+1
Or move your code from library to start.php or classes
Let's say you have a library at mod/my_plugin/lib/my_lib.php. Then you can load it with the line
when adding this line at the top of start.php (not inside the init function). This is the easiest way if you don't want to use elgg_register/load_lib anymore (works not only on Elgg 3 but also on Elgg 2). The other way would be to rewrite the code to create a class from the library. But this requires more effort for sure.