TinyPortal

Development => Support => Topic started by: shawnlg on March 18, 2008, 06:34:33 AM

Title: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 18, 2008, 06:34:33 AM
As the title says I want to create funtionality to allow users to submit articles to the site and then allow the site to hold them until reviews.  Once reviewed I want it to submit it to the articles directory.

I want anyone to be able to submit to it as along as they are a user.
I dont want them to have access to the other submited articles.
I want a drop down box with the current categories.
I want to add additional form fields that users can fill in.

Currently the form on this site (isted below) sends me the info to my mail box

http://www.scifiandgod.com/content/index.php?page=7811

Instead I want it do funtion as I listed above.  Please let me know if someone can give me direction in developing such a creature.  I am willing to do the work involved I just need some direction.  If you wish to PM me on it please feel free or post it here.

As far as I know the funtionality isnt existant.  I searched for it but might have missed it. I am hoping to create it with help.  I think others could use it to.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: IchBin on March 18, 2008, 02:37:13 PM
You're basically asking for an additional article system to be added. While its possible, it is way out of the scope of support here. I don't have time to do such a thing, so good luck. :)
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 18, 2008, 03:52:51 PM
Thanks..  I figured so, is there a way you can pm me and give me an idea of which files and sql needs to be touched and I will figure it out from there. 
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: IchBin on March 18, 2008, 09:37:03 PM
TPortal.php, TPortalAdmin.php, TPortalAdmin.template.php, TPortal.template.php. I couldn't  tell you what SQL queries, as you would have to add your own tables and/or rows with the information that "you" need. My best advice would be to mimic what is already done but use different tables etc.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 18, 2008, 09:41:39 PM
Perfect thank you.  I will post my changes if I get this to work.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 19, 2008, 02:17:18 AM
I am making some progress on how I am going to make this work the simplest way possible and have came to the conclusion that if I can just add five extra fields on the add article page and the the display of the page I can make this work.

I have added the five extra fields in the database and now I just need to figure out how to make them display on both of those pages.

I have isolated the piece of text I need to replicate..
<textarea name="tp_article_body'.$mg['id'].'" id="tp_article_body'.$mg['id'].'" style="width: 95%; height: 300px;" wrap="auto">'.$mg['body'].'</textarea>
';

On line 2359

However when I replicate it on the very next line by doing something like this I get an error.
<textarea name="tp_Synopsis'.$mg['id'].'" id="tp_Synopsis'.$mg['id'].'" style="width: 95%; height: 200px;" wrap="auto">'.$mg['body'].'</textarea>
';

Can somebody help me with my sytax and tell me if I am on the right track.  Thanks in advance.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: JPDeni on March 19, 2008, 02:26:14 AM
This may be too obvious, but I have to post what I see.

Try starting your line (the one you're adding) with


echo '



Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 19, 2008, 02:35:21 AM
Duh..  yeah..  that eliminated the error.  Now I just need to figure out how to get it to show up on the page.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 19, 2008, 02:59:00 AM
I am wondering for someone who has gotten into this can tell me if I am on the right track.  Here is my line of thinking in adding an additional field in the add and edit  article section..

I was thinking that if I replicated and changed anywhere I found  tp_article_body code I could duplicate the functionality and add that additional field.

Anyone know if this has been done?  I have checked out the forum and didn't find that it was so, but I might have missed it.  Thanks!
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: IchBin on March 19, 2008, 03:22:21 AM
I have not seen anyone add any functionality to articles like this Shawnlg. So I don't think anyone could tell you how to do it.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 19, 2008, 03:29:37 AM
Ok..  I will continue to have add it.  If anyone has furnther suggestions I will take them.  Thanks again!
Title: Re: Create a special database field and funtionality to for user submited articl
Post by: Lord Anubis on March 19, 2008, 04:09:42 AM
example or better explaination would be great

or a link to a previous post :)
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 19, 2008, 04:30:41 AM
I couldnt find a previous example.

Check this screen shot out..

http://www.scifiandgod.com/bodytext.jpg

You will notice in the admin article section there is only the option to add the main body text and the intro text.  I want to add five more sections of text in order for the editors to be able to enter in exactly the format I am looking the the articles to be in..

You will notice on this page that I am currently using a mail form to do it.  I am hoping to make it more seemless it goes directly into the article section the the admins can aprove it.
http://www.scifiandgod.com/content/index.php?page=5203

Lord Anubis, Does that make any sence.  i am a much better verbal communicator so forums stretch me.   If not please tell me what other information would help.
Title: Re: Create a special database field and funtionality to for user submited articl
Post by: Lord Anubis on March 19, 2008, 12:28:30 PM
That makes more sense, I am a very visual person and so far I like the layout that you have created :)
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 19, 2008, 05:27:25 PM
Thank you.  I appreciate that.  I am really trying to make this site full featured.  I still have so much to do when I thought I was already done with it.  This site is kind of getting a life of its own.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: Lord Anubis on March 19, 2008, 07:06:41 PM
What I have learned is you are never done, new ideas always pop up.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 21, 2008, 09:47:20 AM
This looks over my head at this point, however I am not giving up.  I am going to study the code more and learn PHP and find may way around it.  I think this would help other people as well.

Here is my work around for now.  I am going to keep the subject headers on the site (See link below for reference) then for now I will have the writers just put the article information directly on the pages under the subject headers.  I am going to lower the permissions so that moderators can also edit the articles.  This will allow me to hand pick people to go in and make changes similar to wikipedia but a little tighter security.  It is not my ideal method but it will work for now.

My biggest struggle with the work around however is I was hoping to make it so the article would have to get approval from an editor to be shown on the site.  This wont happen now until I find a work around because I still want the template of the article to stay in tact until it is approved.

http://www.scifiandgod.com/content/index.php?page=7392

Please let me know if anyone has any suggestions.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: shawnlg on March 21, 2008, 05:59:52 PM
I modified the last post because it didn't make any sense.  I wrote it at 5:00am after being awake all night.  Hopefully this will make more sense now.
Title: Re: Create a special database field and funtionality to for user submited articles
Post by: JPDeni on March 21, 2008, 06:23:51 PM
If I was going to do what you're doing, instead of altering the article system, I would create a whole new system for the reviews, using a new database table and a php article. That way you don't have to alter the TP files so that when you upgrade, you don't have to worry about altering any new files.

It's really not that hard to do. I have a bunch of them on my site, although I can't really show you the forms for entering data because only admins can access the forms.