Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
New Plugin
Good afternoon everyone. I am working on a plugin. Here is how it functions:
- Creates a discussion button that states, "New Review".
- Automatically adds, "Review: " to the beginning of the discussion title.
- Has a fillable form for review contents.
- Create a database entry exactly like comments that counts how many "Reviews" a user has made
Those are the four functions I would like out of the gate. I can post my code tonight for those that would like to help. I'm using the Q&A plugin as a reference but the lack of code comments is leading me to road-blocks.
Functionality that I wish to have in the future for this plug-in or separate plugins:
- Auto-fill sections of the form based on previous entries.
- Display a link next to the users profile in each discussion/comment detailing the number of reviews they've submitted which leads to a page that lists all of their reviews, much like comments.
What I am asking for right now, is any suggestions on how to approach this before I post by code.
Thanks.
0
Comments
Again, pointers from my cell phone while I'm away: (1) you are probably creating a new discussion type (QnA does) (2) Not sure QnA is a good basis. A combo of the example and Howto plugins will be just as good and possibly simpler (there is one that shows how to do forms). Good luck!
You have to decide if you re-use discussion/comment system from Vanilla or if you bake a complete new content type. Scan through shadowdares discussions: he created the article addon and was facing the same question. He decided to re-use discussion/comments and he is an experienced Vanilla developer.
I would strongly advise to reuse what Vanilla offers as much as you can!
qna plugin is very sophisticated and simply copying it would be very hard when this is your first experience with Vanilla. But basically it has all you need to get started. I would just recommend to write the plugin on your own and only look at the source to get a help how some problems can be solved
I've walked a few starters through creating simple plugins. This one wouldn't be simple, but if I would walk someone through it step by step, I guess I would give him this tasks.
That would take a while...
I'll go ahead and use the discussion/comment system for Vanilla with the exception of adding a form for my "New Review" discussion thread.
Would you like to see my current code?
Maybe that had been a bad advise. Try to add "some" field to the form...
For sure. You can either create a GitHub or bitbucket repo or simply post it here.
Alright. Here is what I have:
I also have three folders with their contents listed underneath:
locale
-en.php //no idea what this is, copied from QnA and left blank.
modules
-class.newreviewmodule.php //renders the "New Review" button
views
-commentoptions.php //uses default vanilla comments options
-discussionoptions.php //uses default vanilla discussion options
-newreviewpost.php // not sure what this does, copied from QnA plugin
-post.php //modified default vanilla post options to fit new review wording (change button names, etc.)
I'll get GitHub set-up for myself to make this easier next time. Link to my GitHub:
https://github.com/Rangerine/NewReviewPlugin
You know that there's no code to see here? Also the repo is just a cloned QnA plugin. I think you would learn better if you write the plugin from ground on up instead of modifying the QnA plugin.
It looks like he cloned the QnA and tried to just change the names but failed to do it on all the files..
I think this would be easier if they simple changed via definitions, Question to Review… the problem then would be what to call the answers… or when someone has accepted the answer.. what is the point … ?
@Rangerine Best make a plugin from scratch is right… and if you are going to use code written by someone else to create your plugin, you must include credits to the original author at the very least.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I uploaded the wrong folder. I did use the QnA plugin as a template. The credit is given in the beginning of the file.
Please take a look again. What I did was remove all of the extras that the QnA plugin has such as the badges, answers management, etc. and just left the sections I was concerned with (creating a new thread titled 'New Review').
@R_J I've commented the Plugin throughout to show what I know and don't know. I'm not ready to write one from scratch, this is turning out to be a very good introduction for when I write my first plugin from scratch.
@vrijvlinder I don't need the answers portion. I only need a button that starts a new thread as a new review.
The plugin is working and am now working to implement the following to it:
The plugin I will write from scratch will do the following:
Then why the fck did you publish it as your own ???
Indeed, so all you would have to do is change the definitions. Change the words question, with reviews…. Not clone an existing plugin and call it your own…
You would publish a plugin based on QnA that instead of the word question, it would be Review, and answers would be accepted reviews.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder I haven't published it. If I do I wont say I made it. I'll credit the original publisher.
I wouldn't just have to change the definitions.Accepted reviews are not dependent on comments/answers.
Have you taken a look at what I've uploaded to my Github? I'm new to all this so I appreciate the feedback but not the rudeness/sarcasm.
@Rangerine - Please do not be offended by what seems to be sarcasm, derision, and other feedback that may seem like forum bullying. I suffered from the same and while it is unfortunate, ignoring it (don't even acknowledge it exists) is well worth it for in the long run you will learn a lot and find those who offer the best mentoring.
I would recommend, however, that you take the advice given in good faith, like the one suggesting to use the basic example plugin as the source of your first plugin writing (either the example or one of the How to samples) - your life and those trying to help you will be so much easier.
This specific feedback relates to your last comment, I didn't have time this weekend to look at your code and I am going to be busy in the coming days, so I make no promises to review your code - sorry for that.
@rbrahmson Thanks. I just wanted to get a feel for things first by modifying the QnA plugin.
The next step is creating my own plugin for what I discussed above.
I'll be busy too and in the meantime I've been reading up on PHP and reading though the vanillaforums documentation.
Oh ? What's this then? It looks like QnA but called NewReviewPlugin … by you
https://github.com/Rangerine/NewReviewPlugin
I did and that is why I suggested you change definitions because your idea , based on QnA makes QnA not be QnA anymore. Make sure you change all the names of the files to the new name you will call QnA…
@rbrahmson said:
awe really ?? who ? lmfao!!
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder Yes. I was told to create a GitHub so others could view the code I was working on.
It looks like QnA but called NewReviewPlugin because I used it as the basis for the plugin. See the contents and you'll notice I give credit to who wrote it.
I have changed the names. I had originally uploaded the wrong folder (I had uploaded the QnA plugin folder instead of my NewReviewPlugin folder which is why everything looked wrong). I stripped almost everything from the QnA plugin code and left only the bits of code that performed the following:
I'm barely learning and I am slowly getting familiar with the syntax, vanillaforums documenation, and how it all goes together. I hope you all can be patient as eventually I hope to provide other newcomers with help and even submit wholly original plugins.
No you were encouraged to post the code here .
Some people may not have github and if that is where you want the feedback you are leaving people out who want also learn how to use other plugins to make their own.
The help forum is here… believe it or not, many people have asked and will ask the same questions you have, so you are helping others whether you realize it or not by posting here and working out the code here.
Some people have slow internet and github does not work for them. They might have an old computer with out dated browsers and github is not going to work. Pastebin also no no. Because you can't guarantee the image or code will be around forever. But it will be here forever. Because they never throw anything out.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder Posting all those separate chunks of code was a chore and didn't work out with the pair of " ` "s. See for yourself. I was instructed to create a GitHub or post the code here which I tried first.
Some people may not have Github which is why mines is public. You don't even need an account to view the code. Its much neater and organized on Github. No one is left out, if you can load these forums you can load the Github webpage. Github will outlast vanillaforums, so we are good on that end.
@Rangerine: everything is fine. If you prefer to work on GitHub that's okay, since the whole Vanilla project is on GitHub.
If you prefer to study a plugin and modify it, because that is the way you feel comfortable. It is also fine.
I'm not happy with that because in order to help you I would have to read and understand code that neither you nor I need. I'm also a strong believer that writing from scratch offers more chances to learn something than simply changing some lines. All in all I think in the best case you might end up with a really nice looking Frankenstein plugin when you could have born a new baby plugin, but that's really up to you
I'll see it as a bunch of questions. Some of them concerning an existing plugin and some of them concerning new code. I'm not happy with that, but it's really not up to you to make me or someone else around here happy.
You said you are not ready to write a plugin from scratch, but believe me: it is easier to write a simple plugin and enhance it step by step than than modifying a quite complex plugin. But again: it is up to you and you have made your decision (but it is not too late and you can still change your mind...)
I have not really taken a look at your repo because I thought you just forked it by then. I'll take a look at it again and see if I can add some comments or code or whatever.
It doesn't matter if he published it. He left the copyright notice, the license, and the original author comments in there. This is all that is required under GPLv2 (along with licensing derivatives in a compatible license).
Plenty of software starts as forks. If you look at yaga's repo, you will notice the first commit is by Todd Burry. I based Latest Post List (my first addon) on Who's Online.
For what it is worth, it is a lot easier to inspect known working code and tweak it to fit because you get immediate results. I agree that starting with a fresh plugin is better from a learning perspective. You also don't have the growing pains when you realize the original approach was not a good fit for you.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Just to give an update and to say thanks for dealing with my growing pains:
I used the pre-built settings in YAGA to have a button moderators can click on a thread when it is a 'review'. This awards the user with a premium credit redeemable in the MarketPlace for premium account access. YAGA takes care of the rest of the data beautifully. So when you click on the user's profile, you see all the reviews they've written under the review reactions link.
My modified plugin to start a 'New Review' is working well. The only thing I have left is to create a 'Review Form' which appears when the 'New Review' thread is initiated. I know it goes in the discussionoptions.php section of the plugin but I am at a loss as how to integrate an HTML or PHP form to that.
@hgtonight and @R_J , I definitely agree it is which is why I plan on writing my own plugins from scratch eventually .