TinyPortal

Development => Support => Topic started by: Lum-chan on June 30, 2011, 01:05:50 AM

Title: Users can't post articles but admins can
Post by: Lum-chan on June 30, 2011, 01:05:50 AM
Link to my site: http://forum.lum-chan.com
SMF version: SMF 2.0 Gold/Final
TP version: TP 1.0 RC2
Default Forum Language: English
Theme name and version: Default Curve and Grasslands Curve Variation
Browser Name and Version: Firefox 3.6.17 and IE 8.0.6001.18702
Mods installed: See text below at bottom of post
Related Error messages: See text below, 3 errors in total, 1 critical


When a user tries to post an article, the following error message appears on screen after clicking on 'Save':


Quote
An Error Has Occurred!
Wrong value type sent to the database. Integer expected. (category)

This is what the errorlog shows:

Quote
http://forum.lum-chan.com/index.php?action=tpmod;sa=submitarticle2
2: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
File: /mnt/webg/d0/55/51962555/htdocs/forum/Themes/default/TPsubs.template.php(114) : eval()'d code
Line: 139

Quote
http://forum.lum-chan.com/index.php?action=tpmod;sa=submitarticle2
8: Undefined variable: txt
File: /mnt/webg/d0/55/51962555/htdocs/forum/Themes/default/TPsubs.template.php(114) : eval()'d code
Line: 22

Quote
http://forum.lum-chan.com/index.php?action=tpmod;sa=submitarticle2
Wrong value type sent to the database. Integer expected. (category)
Function: TPmodules
File: /mnt/webg/d0/55/51962555/htdocs/forum/Sources/TPmodules.php
Line: 744
The last one is marked 'Critical'

When posting an article as being a user, there are only the following fields:

Title field
Body Text field
Intro Text field

And of course the 'Save' button. That's all there is.

Currently using
SMF 2.0 Final
TP 1.0RC2

This happens on both the Default and the Curved themes

I made a membergroup called 'Author' and I changed the permissions on TP for the follwoing settings:
"Can submit HTML articles"
"Can submit BBC articles"
"Can edit own articles"

Made the Author membergroup the deault one for this user.
Made a 'User Articles' catagory but I don't know this is needed.
When logged in as Admin or another user with admin-right, it works as it should

Mods Installed:
1.    SMF Gallery Lite    3.0.4
2.    Random News Fader    1.0
3.    YouTube BBCode    2.6
4.    reCAPTCHA for SMF    0.9.8a
5.    Enhanced PM Popup    1.0.1
6.    Extended Help    1.0
7.    Highslide 4 SMF    0.7a
8.    Internal_Links_Use_Same_Window    1.2
9.    SMF Staff Page    1.7
10.    Spoiler Tag    0.7.2a
11.    SMF Links    2.3
12.    AvatarSelect    1.2.1
13.    Default Avatar    2.1
14.    TinyPortal    1.104
15.    Tapatalk SMF Plugin    1.0.2
16.    Nico Embed BBCode    1.0.3
17.    PM Sent Notification    1.0.5
18.    Treasury    2.10
19.    Users Online Today    2.0 RC1

What is going wrong or am I missing something? Thanks in adavnce for your time and efforts
Title: Re: Users can't post articles but admins can
Post by: IchBin on June 30, 2011, 03:11:11 AM
For the database error referring to 'category'.

Find in Sources/TPmodules.php:
$artc = $_POST['tp_article_category'];

Replace with:
$artc = !empty($_POST['tp_article_category']) ? $_POST['tp_article_category'] : 0;

The other errors referring to 'txt' and 'mysql_fetch_assoc' have something to do with a block that has code in it that is not compatible since you upgraded.
Title: Re: Users can't post articles but admins can
Post by: Lum-chan on June 30, 2011, 09:01:45 AM
Thanks IchBin! Your suggestion works like a charm. Me so happy  :D. I'll check the blocks on those two other errors. Thanks again!

I have a similar question. It's on the same site. When  I try to add categories to the Cat Tab and I select some categories and click save, I get the following error on screen:

Quote
An Error Has Occurred!
The database value you're trying to insert does not exist: val

and this appears in the Errorlog:
Quote
http://forum.lum-chan.com/index.php?action=tpadmin
The database value you're trying to insert does not exist: val
Function: do_postchecks
File: /mnt/webg/d0/55/51962555/htdocs/forum/Sources/TPortalAdmin.php
Line: 2794
This one is marked 'Critical'.

Somehow I feel it might be related? Can you look into this too, or should a create a new thread in the board?
Title: Re: Users can't post articles but admins can
Post by: IchBin on June 30, 2011, 08:23:49 PM
Sources/TPortalAdmin.php
Code (find) Select
array(
'val' => $catname,
'name' => 'cat_list',
)


Change $catname to $catnames
Title: Re: Users can't post articles but admins can
Post by: Lum-chan on July 01, 2011, 01:45:45 PM
Thanks IchBin! It works like a charm after your correction. Me very happy indeed
You the man!