1 (edited by Kolya 2007-01-25 11:14:58)

Topic: Deleting categories and not requiring post names

First of all thanks for ochiba! I like it! :)
Now to my questions:

1. How can I delete categories short of deleting them in the database?
2. How can I set the name in posts to not be required (use "Anonymous" instead)?
EDIT: 3. How do I set the standard CSS?

2 (edited by Kolya 2007-01-25 11:49:28)

Re: Deleting categories and not requiring post names

Okay, I found the old support forum.
1. It seems there is no normal way of deleting categories. Correct me if I'm wrong.
2. Someone mentioned to insert this line:
$_POST["name"] = $_POST["name"]=="" ? $_POST["name"] : "Anonymous";
but the place where to add it seems to have changed. I tried putting it after the comment:
// Name is required
But to no avail. Well even if it worked the Name-line would still be red...mmh.
I'm thinking it would be nice if the input for name would just be "Anyonymous" by default.

So I tried this: In templates/post.tmpl
SEARCH
    <th class="required">Name:</th>
    <td><input id="name" type="text" name="name" value="{cookie_name}"/></td>
REPLACE
    <th>Name:</th>
    <td><input id="name" type="text" name="name" value="Anonymous"/></td>

This works just fine, the drawback being that if someone filled in their name it won't be remembered anymore. Maybe someone has an idea on how we could have our pie and eat it too? What I mean is: "Anonymous" by default and "{cookie_name}" if it was filled in before.

3. Still no idea

3

Re: Deleting categories and not requiring post names

1. Yeah, no way currently to delete categories. Some discussion of the complications here if you haven't seen it yet:

http://ochiba.x-maru.org/support/viewtopic.php?id=23

If your ochiba install is a fresh one with no or few images, then executing the SQL indicated should be sufficient.

2. The first line you inserted takes care of the server-side check. However, there is a client-side javascript check which actually prevents the form from even being sent to the server.  In js/ochiba.js, at line 166 there is this block:

    // Name is required
    if (!document.getElementById('name').value) {
        alert('A name is required');
        document.getElementById('name').focus();
        return false;
    }

You can comment out or delete that block.

3. In templates/site, near the top are these lines that reference css files

<link rel="stylesheet" type="text/css" href="{ROOT}/css/ochiba.css" title="ochiba" />
<link rel="alternate stylesheet" type="text/css" href="{ROOT}/css/classic.css" title="classic" />
<link rel="alternate stylesheet" type="text/css" href="{ROOT}/css/futallaby.css" title="futallaby" />

Of these, the one *not* marked as "alternate stylesheet" is the default one, so if you'd like a different one as default, change that one's rel to stylesheet and the other to alternate stylesheet.

4 (edited by Kolya 2007-01-25 13:46:13)

Re: Deleting categories and not requiring post names

Oh hey thank you for your help!

2. Okay, I commented out that javascript and in includes/post.php I put this line after "// Name is required" :
$_POST["name"] = $_POST["name"]=="" ? $_POST["name"] : "Anonymous";

Now after posting I get a screen saying:
"The following error(s) occurred
A name is required
"
The post isn't made.

3. Thanks, works fine. :)

5 (edited by Kolya 2007-01-25 14:16:10)

Re: Deleting categories and not requiring post names

Okay, I got it. In includes/post.php:

SEARCH
   if($_POST["name"]) {
       $name = $_POST["name"];
       setcookie("name",$_POST["name"],COOKIE_EXPIRES);
   } else {
       array_push($errors,$ERRORS["namerequired"]);
   }

REPLACE
    $name = $_POST["name"] ? name($_POST["name"]) : "Anonymous";
    setcookie("name",$_POST["name"],COOKIE_EXPIRES);


Also the changes in js/ochiba.js as described by hr above.

I have taken this code from the tripcode and it works but it would be even more elegant if there was a check, whether a cookie_name exists before posting, and if there is none:
setcookie("name","Anonymous",COOKIE_EXPIRES);
So that when one has never posted on the board before, the name is filled in with "Anonymous" by default.

EDIT: Next step might be to use a variable instead of "Anonymous" which by default is empty and throws the name-required-error. Once set in conf.php it uses whatever the Admin specified and throws no error anymore. Well, just thinking here. :)

6

Re: Deleting categories and not requiring post names

Next step might be to use a variable instead of "Anonymous" which by default is empty and throws the name-required-error. Once set in conf.php it uses whatever the Admin specified and throws no error anymore.

Hmm interesting. I've mentioned my feelings on so-called "Anonymous" posting before:
http://ochiba.x-maru.org/supportold/kar … 106307785/

However, your idea seems like it might be easy to add and make it configurable by the site owner.