News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF Post Prefix

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

Previous topic - Next topic

Diego Andrés


SMF Tricks - Free & Premium Responsive Themes for SMF.

Diego Andrés

#41
New version 2.0!
Quote2.0 - 15 July 2015
Now you can decide to use text or show an icon.
Search topics by prefix.
Filter topics by prefix inside a board.
Added Spanish translation.
Each prefix now has an unique ID, and all of them have a general class so you can customize them using CSS.

Please report any issues  ;D

SMF Tricks - Free & Premium Responsive Themes for SMF.

br360

Awesome Diego, thanks for the updates. :)

I have tried installing 2.0 on two different sites though, and am getting the same error after I try to install-

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL default '500',
PRIMARY KEY (id)) ENGINE=MyISAM' at line 13
File: /home/genxcomm/public_html/test/Packages/temp/install.php
Line: 97

Diego Andrés

Sorry, my fault. I haven't slep since monday  :P
Try the new file, it should work now

SMF Tricks - Free & Premium Responsive Themes for SMF.

br360

Just tried the new file and still the same thing- same errors on different sites.

This mod is great and with the additions you made is going to be awesome. Get some sleep first though, as I can wait. ;)

Diego Andrés

Quote from: br360 on July 15, 2015, 03:12:56 PM
Get some sleep first though, as I can wait. ;)

Probably I should. In fact, the issue is very stupid  :P
This time it SHOULD DEFINITELY work.

And thank you I hope everyone likes it.

SMF Tricks - Free & Premium Responsive Themes for SMF.

br360

Yup, this time it installed without issue. Thank you. :)

Now, get some sleep...pretty sure you've earned it. ;)

Diego Andrés

Hey I just noticed another issue  :(
I forgot to actually update the PostPrefix.template.php

The package is already updated. If someone doesn't want to uninstall and install again, you can only replace the template and that's all.

Sorry about that.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Diego Andrés

Well, this is awkward  :-[
I introduced a bug in the 2.0 version, so I just released the 2.0.1 which this time I'm 100% sure is DEFINITELY the good one.

Again, is not necessary to update if you already have the 2.0 version with the PostPrefix.template.php file replaced
The only thing you have to do is
Code (find in Sources/Subs-PostPrefix.php) Select
'. ($all = true ? '' : '
Code (replace in Sources/Subs-PostPrefix.php) Select
'. ($all == true ? '' : '

This time the only thing I can say is: enjoy!

SMF Tricks - Free & Premium Responsive Themes for SMF.

br360

I've been playing with the new version, and it works great. Thanks again.

I was wondering though if there was a way to have the prefixes appear alphabetically in both the "Select Prefix" drop down list, as well as the filter by prefix section-instead of by when the prefixes were added.

Geor'G

Error while searching
'time' => timeformat($message['first_poster_time']),
'timestamp' => forum_time(true, $message['first_poster_time']),
'subject' => $message['first_subject'],
// Prefixes
2013 => 'prefix' => PostPrefix::formatPrefix($message['id_prefix']),
'href' => $scripturl . '?topic=' . $message['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $message['id_topic'] . '.0">' . $message['first_subject'] . '</a>',


Ru:
Ошибка при поиске

Diego Andrés

Quote from: br360 on July 15, 2015, 09:45:04 PM
I've been playing with the new version, and it works great. Thanks again.

I was wondering though if there was a way to have the prefixes appear alphabetically in both the "Select Prefix" drop down list, as well as the filter by prefix section-instead of by when the prefixes were added.

Sure it's doable, I'll add it for 2.2 as it is a mid improvement because it will have a new settings so you can choose how to order them.

Quote from: Geor'G on July 17, 2015, 09:49:38 PM
Error while searching
'time' => timeformat($message['first_poster_time']),
'timestamp' => forum_time(true, $message['first_poster_time']),
'subject' => $message['first_subject'],
// Prefixes
2013 => 'prefix' => PostPrefix::formatPrefix($message['id_prefix']),
'href' => $scripturl . '?topic=' . $message['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $message['id_topic'] . '.0">' . $message['first_subject'] . '</a>',


Ru:
Ошибка при поиске

Thanks for reporting, I'll take a look.

also for 2.2, fixed a little bug related with the permissions page.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Amargedon

First of all; thanks for this mod and you're work so far! I find the filter and search option a good one and was thinking/looking for a long time for a mod who could do that.

I tried to install the mod today and found the following two points:
1) Creating prefix works. However, when assigning the groups who can use it I used the "select all option" at the bottom of the list with groups. There was no change in the radio buttons, so it seems the javascript is broken? Tried it in Chrome and Internet Explorer without luck.
Workaround is to click each radiobutton to the desired option, but with 8 groups and a lot of prefixes (when using the mod later on) this would be nice to have working.

2) After creating the prefix I tried to create a topic. There was no drop-down box for the prefix selection. I added the prefix on all boards, so that should not be the issue. I switched to the default theme, also didn't make a difference.

Looked inside the source and investigated what was going on; found that the following line in Post.template.php is failing:
if (!empty($context['prefix']['post']) && $context['is_first_post'])
The context['prefix']['post'] is empty. Strange thing is that when I include debug in the sources (getPrefix function in Subs-PostPrefix.php) I can see that it's filled in (I see the prefix I added previously) based on the account, group and board where I want to create a topic.

Any idea?

ps; I can create the translation to Dutch if you're interested?

Diego Andrés

There are no related issues as far as I know.
Have you tried the mod on a test site?

Translations are always welcome.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Amargedon

Quote from: Diego Andrés on July 22, 2015, 02:13:07 PM
There are no related issues as far as I know.
Have you tried the mod on a test site?

Translations are always welcome.
Yes, I have a testsite running on a local system where I test everything before I put it on the live environment.

Ok; will look into finishing the translation.

Diego Andrés

Quote from: Geor'G on July 17, 2015, 09:49:38 PM
Error while searching
'time' => timeformat($message['first_poster_time']),
'timestamp' => forum_time(true, $message['first_poster_time']),
'subject' => $message['first_subject'],
// Prefixes
2013 => 'prefix' => PostPrefix::formatPrefix($message['id_prefix']),
'href' => $scripturl . '?topic=' . $message['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $message['id_topic'] . '.0">' . $message['first_subject'] . '</a>',


Ru:
Ошибка при поиске

I can't reproduce this, can you show me how to get that?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Diego Andrés

New version 2.0.2!

Quote2.0.2 - 27 July 2015
Added two new settings for selecting how to order the list of prefixes.
Fixed the way permissions were added.
Fixed the empty list of prefixes in search page.

Please report any issues  :)

SMF Tricks - Free & Premium Responsive Themes for SMF.

br360

Thanks for adding the ASC and DESC sort Diego. It works great when setting Name and ID in Prefix order. However, when setting it as Date, I get this error-

Unknown column 'p.date' in 'order clause'
File: /home/xxx/public_html/xxx/Sources/Subs-PostPrefix.php
Line: 241



233:              ORDER by p.{raw:order} {raw:dir}'),
234: array(
235: 'id_group' => $group,
236: 'post_group' => $postg,
237: 'board' => $board,
238: 'order' => $order,
239: 'dir' => $dir,
240: )
==>241: );
242: while ($row = $smcFunc['db_fetch_assoc']($request))

Diego Andrés

Sorry I thought I updated that
The error is in line 214 (Subs-PostPrefix.php)
Change date to added.

I just updated the package

SMF Tricks - Free & Premium Responsive Themes for SMF.

br360

Thanks Diego. Works great...and thanks again for this excellent mod.

Advertisement: