News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMF Post Prefix

Started by Diego Andrés, May 11, 2015, 10:37:35 PM

Previous topic - Next topic

Alanar

Hi, Diego. With the new version, I'm getting an "Error: The database value you're trying to insert does not exist: id_board" when I try to post a new topic.

I don't get it any other time. I can make posts, delete topics, edit things, etc. I just can't post new topics.

When I uninstall the mod, I don't get the error.

Diego Andrés

Can you check the error in the errors log, maybe there will tell you more information about the issue.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Alanar

I fixed it, thanks.

Apparently the last version I had installed and uninstalled didn't remove the previous lines of code. I had duplicates everywhere. Cleared them all up and it's running fine!

Diego Andrés


SMF Tricks - Free & Premium Responsive Themes for SMF.

Alanar

And I'm back. Last errors it's throwing are undefined indexes on lines 208 and 216 of Subs-Postprefix.php

This one I'm not sure how to fix as it's happening on my test server and the live one.


196: {
197: $group = '';
198: $postg = '';
199: }
200: else
201: {
202: loadMemberContext($user_info['id']);
203: $group = (int) $memberContext[$user_info['id']]['group_id'];
204: $postg = (int) $user_settings['id_post_group'];
205: }
206:
207: // Order by thing
208: $orderby = $modSettings['PostPrefix_select_order'];
209: if ($orderby == 0)
210: $order = 'name';
211: elseif ($orderby == 1)
212: $order = 'id';
213: elseif ($orderby == 2)
214: $order = 'added';
215: // Direction
==>216: $direction = $modSettings['PostPrefix_select_order_dir'];
217: if ($direction == 0)
218: $dir = 'DESC';
219: else
220: $dir = 'ASC';
221:
222: $context['prefix']['post'] = array();
223: if (allowedTo('set_prefix') || allowedTo('manage_prefixes'))
224: {
225: $request = $smcFunc['db_query']('', '
226: SELECT p.id, p.status, p.name, p.added, p.boards, p.member_groups, p.deny_member_groups
227: FROM {db_prefix}postprefixes AS p
228: WHERE p.status = 1'. ($user_info['is_admin'] || allowedTo('manage_prefixes') ? '' : ('
229: AND (FIND_IN_SET({int:id_group}, p.member_groups) OR FIND_IN_SET({int:post_group}, p.member_groups))' . (!empty($modSettings['permission_enable_deny']) ? ('
230: AND (NOT FIND_IN_SET({int:id_group}, p.deny_member_groups) AND NOT FIND_IN_SET({int:post_group}, p.deny_member_groups))') : '') . '')) . '
231: '. ($all == true ? '' : '
232: AND FIND_IN_SET({int:board}, p.boards)
233: ORDER by p.{raw:order} {raw:dir}'),
234: array(
235: 'id_group' => $group,
236: 'post_group' => $postg,

Diego Andrés

Yes :( it's probably because I didn't add those "order" settings to the db. So it will show up until you go to the settings page and click save.

I'll upload a new package where it is corrected. It won't be a new version (no need to update) as it can be fixed manually through the prefix settings as I stated.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Alanar

Gotcha. I just had to change the option and then change it back. Thanks a lot. I hate to annoy people, but I'm not very adept at PHP so I rely on these mods. :)

Thanks again!

Diego Andrés

Yeah no problem! We are here to help ;D

SMF Tricks - Free & Premium Responsive Themes for SMF.

Alanar

Last thing I'm noticing. When a user searches for something using the search feature and doesn't select a prefix to search for (leaves it on [No Prefix]), I'm getting an undefined error in Search.php on line 2013 for id_prefix.

Diego Andrés

I'll take a look tomorrow, thank you.

SMF Tricks - Free & Premium Responsive Themes for SMF.

musicus

After I install made a repair of my forum and had set back all the mods with "fix_packages.php", I have installed latest version of "SMF Post Prefix" had, came first, no error. But when I click "Prefixes" in the configuration, this message appears:

Unknown column 'icon' in 'field list'
Datei: /homepages/14/d562938237/htdocs/musociety/Sources/PostPrefixAdmin.php
Zeile: 296


and when I open the file listed above, I see this:

// Get a list of all the item
$result = $smcFunc['db_query']('', '
SELECT id, name, status, color, added, member_groups, deny_member_groups, boards, icon, icon_url
FROM {db_prefix}postprefixes
ORDER by {raw:sort}
LIMIT {int:start}, {int:maxindex}',
array(
'start' => $start,
'maxindex' => $items_per_page,
'sort' => $sort,


How do I fix the error

Sorry my bad english

Diego Andrés

You need to add that column manually into the post prefixes table

SMF Tricks - Free & Premium Responsive Themes for SMF.

musicus

Thank you, I have uninstalled for now the addon. Too bad, was quite usable. But it is more important that my forum without any problems works. Better luck with the next update

Diego Andrés

It is working just fine.
But in some cases that column won't be added, so you have actually two options:
1- Add the column manually
2- When uninstalling the old version you must check the "Delete all data" thing. If you don't want to lose your prefixes, just make a backup of that table before the uninstall

SMF Tricks - Free & Premium Responsive Themes for SMF.

Juvept

Hi,

After i install this mod (without any problem), and i go to Admin > Forum > Postprefix this error appears:


QuoteFatal error: Cannot call method self::general() or method does not exist in /home/a6532119/public_html/Sources/PostPrefixAdmin.php on line 59

Can anyone tell me who to solve please?

DarkTexas

(i hope i'm at the right place!)

I've recently installed a mod "SMF Post Frefix". After that I couldn't access the forums anymore, that means it shows the following message:

Unknown column 'p.icon' in 'field list'
File: C:\Inetpub\vhosts\glj-ps2.de\forum.glj-ps2.de\Sources\Subs-PostPrefix.php
Line: 139

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.10, while your database is at version 2.0.9. The above error might possibly go away if you execute the latest version of upgrade.php.

Can anyone help me?

Diego Andrés

Previously commented above and I left a few solutions.

SMF Tricks - Free & Premium Responsive Themes for SMF.

DarkTexas

#77
Quote from: Diego Andrés on August 21, 2015, 09:34:37 PM
Previously commented above and I left a few solutions.

What and where do I need to add or delete something? - im sorry, I'm not an expert with that. :(
That is our Clan-Forum and that's a huge Problem when that's messed up >.<. On my test-Forums it worked -_-

Diego Andrés

Yeah, as I said above it's probably because you had installed the previous version so the columns weren't added when installing the new one.
Try this:
1- Upload the attachment to the root of your forum
2- Go to forumurl.com/postprefix_fix_2.0.2.php
3- Delete the file
4- Check that it fixed the issue nicely

SMF Tricks - Free & Premium Responsive Themes for SMF.

Goten22

Can I somehow check if topic has prefix? And display all topics with prefixes? (I don't mean url ";prefix=1")
Something like :
if ($topic[prefix]){
echo' $topic[name] $topic['link'] etc';}

Advertisement: