News:

SMF 2.0.19 has been released! Please update. Read more.

Main Menu

SMF Post Prefix

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

Previous topic - Next topic

Steve

Found a small quirk (bug?) ...

When in the topic list with the prefixes showing and you double click on the topic title of any topic and change anything in the title, the prefix disappears.

You have to go to the topic, modify the first post and without doing anything (except making sure the prefix you want is chosen) save it. Then all is well again.
Please do not PM me for support.

Julius_2000

I get a blank page when I try to load any "parse" for the Manual Installation info in the package tab of the mod's download site.

Diego Andrés

I'll pass it on, thanks.

In any case, this mod doesn't have instructions really as it uses hooks.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Steve

Hey Diego, is it possible to use two prefixes in the same topic title? I tried creating a prefix with the two prefixes I want but I got a 'string too long' error.
Please do not PM me for support.

Diego Andrés

No it's not possible.
Not sure how you manage to do that  :o

If it allowed multiple prefixes, it wouldn't be a prefix mod, it would be a labels mod.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Steve

Makes sense. I tried making a prefix of 'New York & New Jersey' and that's when I got the error.

But you're right, of course, doing that would be outside the intent of your mod (which I think is brilliant btw).
Please do not PM me for support.

Diego Andrés

It's alright.
The issue with the string might be because it's limited to 25 characters... Might be an inconvenience but I thought it reasonable at the time since some like to write extremely long titles.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Shades.

SMF 2.1.2

Any way to make this mod work with the thumbnail topic mod? I tried to install both but get errors...I even tried disabling "prefixes" in the boards that have the thumbnail mod active but didn't work.

Error
Type of error
Database
Error message
Database Error: '******_******.t.id_prefix' isn't in GROUP BY


SELECT
t.id_topic, t.num_replies, t.locked, t.num_views, t.is_sticky, t.id_poll, t.id_previous_board,
COALESCE(lt.id_msg, COALESCE(lmr.id_msg, -1)) + 1 AS new_from,
COALESCE(( SELECT 1 FROM ******_messages AS parti WHERE t.id_topic = parti.id_topic and parti.id_member = 1 LIMIT 1) , 0) as is_posted_in,

t.id_last_msg, t.approved, t.unapproved_posts, ml.poster_time AS last_poster_time, t.id_redirect_topic,
ml.id_msg_modified, ml.subject AS last_subject, ml.icon AS last_icon,
ml.poster_name AS last_member_name, ml.id_member AS last_id_member,
COALESCE(meml.real_name, ml.poster_name) AS last_display_name, t.id_first_msg,
mf.poster_time AS first_poster_time, mf.subject AS first_subject, mf.icon AS first_icon,
mf.poster_name AS first_member_name, mf.id_member AS first_id_member,
COALESCE(memf.real_name, mf.poster_name) AS first_display_name, ml.smileys_enabled AS last_smileys, mf.smileys_enabled AS first_smileys, IFNULL(big.id_attach, 0) AS big_id, big.filename AS big_filename, big.width AS big_width, big.height AS big_height,
IFNULL(thn.id_attach, 0) AS thn_id, thn.filename AS thn_filename, thn.width AS thn_width, thn.height AS thn_height, IFNULL(thn.id_attach, mf.body) AS mainpost, t.id_board
, t.id_prefix, pp.id AS prefix_id, pp.name AS prefix_name, pp.status AS prefix_status, pp.color AS prefix_color, pp.bgcolor AS prefix_bgcolor, pp.invert_color AS prefix_invert_color, pp.icon_class AS prefix_icon_class
FROM (
SELECT t.id_topic, t.id_first_msg, t.id_last_msg, t.id_prefix, pp.id AS prefix_id, pp.name AS prefix_name, pp.status AS prefix_status, pp.color AS prefix_color, pp.bgcolor AS prefix_bgcolor, pp.invert_color AS prefix_invert_color, pp.icon_class AS prefix_icon_class
FROM ******_topics t

LEFT JOIN ******_postprefixes AS pp ON (t.id_prefix = pp.id)
WHERE t.id_board = 8
ORDER BY is_sticky DESC, id_last_msg DESC
LIMIT 20
OFFSET 0 ) as st
JOIN ******_topics AS t ON (st.id_topic = t.id_topic)
JOIN ******_messages AS ml ON (ml.id_msg = st.id_last_msg)
JOIN ******_messages AS mf ON (mf.id_msg = st.id_first_msg)

LEFT JOIN ******_attachments AS big ON (big.id_msg = mf.id_msg AND big.attachment_type = 0)
LEFT JOIN ******_attachments AS thn ON (thn.id_attach = big.id_thumb)
LEFT JOIN ******_members AS meml ON (meml.id_member = ml.id_member)
LEFT JOIN ******_members AS memf ON (memf.id_member = mf.id_member)
LEFT JOIN ******_log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = 1)
LEFT JOIN ******_log_mark_read AS lmr ON (lmr.id_board = 8 AND lmr.id_member = 1)
LEFT JOIN ******_postprefixes AS pp ON (t.id_prefix = pp.id)

GROUP BY t.id_topic, big.id_attach, thn.id_attach, t.num_replies, t.locked, t.num_views, t.is_sticky, t.id_poll, t.id_previous_board, lt.id_msg,lmr.id_msg, t.id_last_msg, t.approved, t.unapproved_posts, ml.poster_time,
t.id_redirect_topic, ml.id_msg_modified, ml.subject, ml.icon, ml.body, ml.poster_name, ml.id_member, meml.real_name, t.id_first_msg, mf.poster_time, mf.subject, mf.icon, mf.poster_name, mf.id_member, memf.real_name, ml.smileys_enabled,
mf.smileys_enabled, big.filename, big.width, big.height, thn.filename, thn.width, thn.height, mf.body, t.id_board

ORDER BY is_sticky DESC, id_last_msg DESC
File
/home/******/public_html/Sources/MessageIndex.php
Line
361
URL of page causing the error
https://*******.com/?board=8.0

Backtrace information
#0: smf_db_error()
Called from /home/******/public_html/Sources/Subs-Db-mysql.php on line 494
#1: smf_db_query()
Called from /home/******/public_html/Sources/MessageIndex.php on line 361
#2: MessageIndex()
Called from /home/******/public_html/index.php on line 192
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Diego Andrés

This mod uses hooks, so you'd have to manually add the column into the group by for the other mod.

It occurs to me, that @vbgamer45 could include $message_index_selects in the group by, to account for the selects added by hooks?

SMF Tricks - Free & Premium Responsive Themes for SMF.

vbgamer45

Quote from: Diego Andrés on October 11, 2022, 10:48:19 AMThis mod uses hooks, so you'd have to manually add the column into the group by for the other mod.

It occurs to me, that @vbgamer45 could include $message_index_selects in the group by, to account for the selects added by hooks?
Possibly. hmm
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

mickjav

Don't know if this will be of use to anybody else, When I started using the prefixes I needed a way to automate the adding of prefixes.

I have over 300 so far, now I've added that many with the code below I have decided it's had enough testing lol

Updates you will want to make:
  • I have used prefix 1 to get all the boards and permissions for all new prefixes added with this mod
  • I call it like
    $TheEnd = (strlen($the) > 0 ? ', The' : '');   
            $pre = addArtistPrefix($aname.$TheEnd);
    You can just give it a name and it will return the new prefix ID
  • You should change or remove this line
    isAllowedTo('music_can_edit_artists');

//Auto Add Prefixes To Artists
function addArtistPrefix($art_name)
{

        global $smcFunc;

        isAllowedTo('music_can_edit_artists');
   
        //Do Main Record
        $art_name = $art_name . ':';
   
        $smcFunc['db_query']('', "INSERT INTO {db_prefix}postprefixes
                    (name)
                    VALUES('$art_name')");
                   
        $prefix = $smcFunc['db_insert_id']('{db_prefix}postprefixes', 'id');
   
    //Do Boards
    $boardquery = $smcFunc['db_query']('', '
    SELECT id_board
    FROM {db_prefix}postprefixes_boards
    WHERE id_prefix = 1');


        while ($brow = $smcFunc['db_fetch_assoc']($boardquery))
        {
            $board = $brow['id_board'];
            $smcFunc['db_query']('', "INSERT INTO {db_prefix}postprefixes_boards
                    (id_prefix, id_board)
                    VALUES('$prefix', '$board')");
        }
        $smcFunc['db_free_result']($boardquery);

    //Do Permissions
    $groupquery = $smcFunc['db_query']('', '
    SELECT id_group
    FROM {db_prefix}postprefixes_groups
    WHERE id_prefix = 1');


        while ($grow = $smcFunc['db_fetch_assoc']($groupquery))
        {
            $group = $grow['id_group'];
            $smcFunc['db_query']('', "INSERT INTO {db_prefix}postprefixes_groups
                    (id_prefix, id_group)
                    VALUES('$prefix', '$group')");
        }
        $smcFunc['db_free_result']($groupquery);       
       
        return $prefix;
}

All the best mick

Home of Chart Tracker Elite, Apollo & DJ 2020, Coming soon The Librarian.

Shades.

Quote from: Diego Andrés on October 11, 2022, 10:48:19 AMThis mod uses hooks, so you'd have to manually add the column into the group by for the other mod.

It occurs to me, that @vbgamer45 could include $message_index_selects in the group by, to account for the selects added by hooks?
Can someone tell me where to add this? I tried adding it myself but got more errors cause I don't have a clue what I'm doing! :laugh:  O:)  :P
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Diego Andrés

I think @vbgamer45 already did something similar in the latest update of his mod  8)

SMF Tricks - Free & Premium Responsive Themes for SMF.

vbgamer45

Haven't just yet.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

DJ Omnimaga

Hello, I'm getting the following error when installing:

QuoteParse error: syntax error, unexpected ')' in /var/www/codewalr.us/Packages/temp/install.php on line 291

Kindred

that's not a problem with this mod....   you have broken something on your site.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

live627

I see that the code uses syntax introduced in PHP 7.3. You need to update PHP.

darkmoon2010

Hi Diego,
very nice mod  :D

How can I implement a german language file ?

Only copying .english.php to .german.php in the language folder seems not to work.



Best regards
Thomas

Advertisement: