I looked around for a detailed introduction to working in the framework, but only found the tutorial which pretty much assumes that you know how to work in the framework or that you've already written a plugin. I try to trace through the code, but usually find 5-line functions that call a series of other 5-line functions.
Here's the "simple" thing that I'm trying to do: add another "Add discussion topic" link to the beginning of the list of topics in a discussion, so users don't have to scroll down to find the link.
I found the text is from the language string "add:object:discussion".
I find this value used twice in the code:
The first is defining a list of routes, so I assume that's not it.
The second is using the value when calling elgg_view_page, passing it in as the $title value. That doesn't seem to be the right place either.
So, my questions:
Thanks in advance.
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.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- webmstr@webmstr
webmstr - 0 likes
- made the mods/discussions_local directory
- added a manifest.xml in this directory, showing a dependency on 'discussions'.
- copied the view.php you referenced from the discussions heirarchy into the smilar heirarchy in my plugin's directory.
- made the changes you described in my view.php
- enabled the plugin in the Admin dashboard (and to confirm, it's listed after the original discussions plugin).
- invalidated and flushed the caches
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- webmstr@webmstr
webmstr - 0 likes
- how can I made sure the new plugin is loaded? (is the fact that it shows as Activated enough?)
- can you think of a step that I'm missing in installing your plugin?
- how can i get debug info to appear in the logfiles?
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- webmstr@webmstr
webmstr - 0 likes
- webmstr@webmstr
webmstr - 0 likes
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
You must log in to post replies.You must to override this file:
Needed changes are:
Read this how to do it.
Read code.
Try to create your custom plugin.
Thanks for the quick reply. Based on those specifics and the links you provided, I tried to create my own plugin to extend 'discussions' with the new link:
Unfortunately, the new link doesn't appear.
I logged out, tried different users, restarted apache, all with no luck. I looked for an elgg-related log file, but didn't find anything.
Can you spot what I missed, or provide some hints on how to debug it?
Thanks again. I think this framework will really fit my needs, so I'm hoping to be sucessful with it.
Just tested and this works very well for me.
Only one error is a wrong guid: you should use container guid instead of user guid:
Regarding you plugin I assume you forgot about start.php, Bootstrap class, or something else.
Anyway, I made the dumbest plugin (with the best solution even) and you can try it right now.
Enjoy!
Yeah, the other instructions just said to install the view file, so I appreciate the extra details.
I tired using your sample plugin as a guide, but I never got the results that I was expecting. I deleted that work and installed your sample plugin (activated, flushed), but still don't see the extra link.
I turned logging up to "Log Everything" and don't see anything that seems relevant.
I saw a logging entry elsewhere in the view, so I added a debug line to the discussion view code in both plugins (the original and yours) but I don't see the line in the logfiles:
elgg_log("In discussion", 'INFO');
So, I guess the current questions are:
I really do appreciate the help, and hope that I can turn the corner on this soon!
1 - Download this plugin.
2 - Unzip it. Be sure folder name of plugin is discussions_ext and haven't any child folder with same name.
Shortly, you will have this structure of this plugin:
3 - Replace this unzipped plugin in /mod directory of your Elgg root installed folder.
4 - Go to Administration -> Plugins and activate it.
That's all.
Now go to any existed discussion on your site and check this button:
Thank you for the screen shot - it shows that you were working on a different page than I was expecting. Your plugin worked perfectly; it was my request that was flawed.
I had hoped to change the example.com/groups/profile/100/test-group page, which currently displays the following:
I don't like that the "Add discussion topic" moves down with every new topic, thus making it harder for people to start new topics. So, I'd like to either move that link above the topic shown (between the grey bar and the "test topic title"), or maybe add it where "View All" is, or add it as an option on the "Joined" pulldown in the top-right.
Can you point me to those locations?
Just exploring based on the url, I see that the page I'm looking at is not part of /discussions, but rather part of /groups, and the reason that I didn't find "add:object:discussion" here is because it's generated dynamically for different content types (e.g. discussions, pages).
It looks like a lot of the magic comes from groups/views/default/groups/profile/module.php, where the current "Add discussion topic" is part of $footer, the "View All" is part of $menu, and I could add it (not as attractively) to the beginning of $content generated for the section.
Since the pattern seems to be to have my own plugin override the existing behavior, it looks like I should copy module.php into my own plugin and it will override the default one. Since it needs to be loaded later than the original, I assume it's overwriting some registration before the page is rendered. Can you point out where in your plugin code that it identifies itself as replacing a 'discussion' element?
Of course, this is a groups/module view not discussion.
Copy
To same directory of your custom plugin and change this code on this:
This adds your desired link on the module at the top before 'View all'.
Keep in your minds, it was actually for Discussions only not other subtypes.
If you want to use it globally then change my code on:
Don't forget: Clean the caches after the changes