PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2008-05-22 00:29:16

Spanoman
New member
Registered: 2007-05-22
Posts: 9

MySQL help with attachment mod

Hello,
I have the attachment mod installed and up and running (punbb 1.2.17), but I want to change the default permissions (as it is now, default is no uploads and you have to set each forum individually).  I decided that one way would be to add the forum permissions to the DB when the forum is created.  I copied out the rule-setting query and stuck it into the edit_forum function in admin_forums.php, changing the variables (except for the forum id) to the constants I want to set, but despite trying every possible syntax variation (without actually knowing anything about mysql syntax), I keep getting an error - It seems like it should be easy, but I can't think of anything else to try - hopefully the error will be easy to spot.

Here's what I've got (in admin_forums.php around line 192):

Code:

// Original query to update forum info in DB
        $db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.$db->escape($forum_name).'\', forum_desc='.$forum_desc.', redirect_url='.$redirect_url.', sort_by='.$sort_by.', cat_id='.$cat_id.' WHERE id='.$forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());

//This is the query added to insert uploading rules into the DB along with other forum info - always gives "unable to create ruleset" :(

        $db->query("INSERT INTO '.$db->prefix.'attach_2_rules (group_id, forum_id, rules, size, per_post) VALUES ('4', \''.$forum_id.'\', '15', \'5000000', '1')")or error('Unable to create ruleset',__FILE__,__LINE__,$db->error());

Thanks very much for any help!

Offline

 

#2 2008-05-22 04:37:20

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: MySQL help with attachment mod

Code:

$db->query('INSERT INTO '.$db->prefix.'attach_2_rules (group_id, forum_id, rules, size, per_post) VALUES ('4', \''.$forum_id.'\', '15', '5000000', '1')')or error('Unable to create ruleset',__FILE__,__LINE__,$db->error());

Offline

 

#3 2008-05-22 08:26:07

Spanoman
New member
Registered: 2007-05-22
Posts: 9

Re: MySQL help with attachment mod

Thanks for the quick response - that line gives me this error:
Parse error: parse error, unexpected T_LNUMBER in \htdocs\admin_forums.php on line 195
I looked up the error, but can't figure out what's wrong with the line. sad
Any other ideas?
Thanks

Offline

 

#4 2008-05-22 17:05:09

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: MySQL help with attachment mod

Remove the single quotes around the numbers you're entering, or escape them, i.e: \'1\' or just 1. (I think that's the correct syntax).

Last edited by MattF (2008-05-22 17:08:21)

Offline

 

#5 2008-05-22 17:39:33

Spanoman
New member
Registered: 2007-05-22
Posts: 9

Re: MySQL help with attachment mod

That did the trick! Thanks so much for your help!

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.