Category required

Usernet

Chevereto Fan
License owner
Hello,

What should I change to force the user to choose a category?

I will end up with thousands of photos not categorized by my users.

I would like to prevent this behavior.

Thank you in advance
 

Usernet

Chevereto Fan
License owner
I think the file to edit :

app\themes\Peafowl\snippets\anywhere_upload.php

From line 132...

My skills do not allow me to do it. I ask for your support

Thank you
 

DeCysos

Phoenix Foto Service
License owner
Yes in the file it would be possible.

So I just think of the following:
You create a category in the dashboard: "not arranged"
You write down the ID (number) of it.
app\themes\Peafowl\snippets\anywhere_upload.php:
                    <?php
                        if (get_categories()) {
                            ?>
                    <div class="input-label upload-input-col center-box text-align-left">
                        <label for="upload-category-id"><?php _se('Category'); ?></label>
                        <select name="upload-category-id" id="upload-category-id" class="text-input">
                            <option value><?php _se('Select category'); ?></option>
                            <?php
                                foreach (get_categories() as $category) {
                                    ?>
                            <option value="<?php echo $category['id']; ?>"><?php echo $category['name']; ?></option>
                            <?php
                                } //for
                            ?>
                        </select>
                    </div>
                    <?php
                        } // categories?
                    ?>
Replace the line <option value><?php _se('Select category'); ?></option> with <option value="YOURCATID"><?php _se('Select category'); ?></option>

Thus, you do not force the user to choose a category, but you have it later easier even assign the categories.
Everything else would be too complex now.
 

Usernet

Chevereto Fan
License owner
Thank you so much !

Category ID is the ID of category in the SQL table, not the ID configured in the control panel of Chevereto.

You are top on Chevereto đź‘Ť
 

DeCysos

Phoenix Foto Service
License owner
Category ID is the ID of category in the SQL table, not the ID configured in the control panel of Chevereto.
Yes, you can read the ID either from the MySQL table or from the source code of the page where the category is displayed.

Please, I help where I can.
 

DeCysos

Phoenix Foto Service
License owner
Update ....

When in the
Dashboard -> Website -> Explore (Guests) == Disabled
is, then no category is assigned to guests.

To change this one would have to do the following.

Post #3 has a code
The line 18 } //categories? would be replaced with the following content ....
PHP:
                        }else{ // categories?
                        echo '<input name="upload-category-id" id="upload-category-id" value="YOUR_CAT_ID" type="hidden">';
                        }
 
Top