This is a seriously noob question... but I am a serious noob with next to no programming experience. However, I wanted to put up a site... so I dove in.
Here's my challenge: I am trying to re purpose the blog plugin that comes with Elgg. I've used it as a base for a new plugin, trimmed some features out I don't need and renamed some items. However, I wanted to add some additional fields to the input form and use them later in different views. I've successfully added the fields to the new form.
My question: Where and how do I save the new variables and use them on other views within the plugins. (e.g. I've added an author field that I want to display on other views)
What I've done to date: I have scoured the documentation, the forums, tried to follow the various tutorials, and examined the code in a number of plugins trying to figure out what I just don't get. I'm sure the answer is disgustingly simple and obvious... but not to me. I've looked at how the blog plugin is saving variables such as "Title" but when I mimic the code with a new field like "Author" and later try to use it just like "Title" I get nowhere.
As I said, I'm sure this is a super simple answer, and I'm quite sure I'm missing the snake right in front of me, but with absolutely zero programming experience... I just don't know what I'm missing.
Thanks in advance for the help.
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
- ihayredinov@ihayredinov
ihayredinov - 0 likes
- elggnoob1@elggnoob1
elggnoob1 - 0 likes
You must log in to post replies.Brrrrr..
What did you write in here?
Please, just One question==One answer..
The general rule is that any database write operations should happen in actions, as they offer CSRF protection. So, look in the /actions folder for examples.
Adding metadata to entities is straightforward:
Certain entity attributes (e.g. title, description, owner_guid, container_guid, access_id) require you to call ElggEntity::save() to propagate the changes:
Creating new entities is straightforward as well:
Thank you Ismayil! This was enough to finally make things click in my head and make sense. I was able to do what I set out to. Thank again. Cheers.