Advertisement:

Author Topic: SMF Post Prefix  (Read 48254 times)

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,091
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
SMF Post Prefix
« on: May 11, 2015, 10:37:35 PM »
Link to Mod



SMF Post Prefix

Developed by Diego Andrés



Introduction
SMF Post Prefix mod allows you to set prefixes for your topics and easily customize them with colors.



Features
  • Add/Edit prefixes
    • Enable/Disable prefix
    • Select a color for the prefix
      • Text color
      • Background color
      • Use an icon instead of text
    • Select allowed users to use specific prefix
      • Includes support for post count based group
      • Includes support for deny groups permissions setting
    • Select boards where the prefix will be usable
  • Select boards where the prefix will be required (forced)
  • Permissions
    • Manage prefixes
    • Use prefixes (Global permission)
  • Filter Topics by prefix
  • Search Topics by prefix

*This mod requires at least PHP 5.0



Changelog



License
Code: [Select]
This Source Code Form is subject to the terms of the Mozilla Public License, v. 1.1.
If a copy of the MPL was not distributed with this file,
You can obtain one at http://mozilla.org/MPL/

The contents of this package are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this package except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
 *
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
« Last Edit: July 15, 2015, 02:41:15 PM by Diego Andrés »

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline br360

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 2,220
    • GenXcommunity
Re: SMF Post Prefix
« Reply #1 on: May 12, 2015, 02:40:24 AM »
Thanks for submitting this- it's nice to finally see a topic prefix mod on the smf site.

Works great, but am getting a "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/xxxxx/public_html/mysite/Sources/Recent.php on line 342" when I press either the "Show unread posts since last visit." and "Show new replies to your posts." links.

I got the same parse error on two different test sites (same line 342) with different mods on each site.

Here is my recent.php-




Code: [Select]
),
'topic' => $row['id_topic'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
'link' => ($row['id_msg'] == $row['id_first_msg'] ? PostPrefix::formatPrefix($row['id_prefix']) : ''). ' <a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>'
 (line 342----->>>)   'start' => $row['num_replies'],
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: SMF Post Prefix
« Reply #2 on: May 12, 2015, 04:06:10 AM »
Try to add a comma "," at the end of the previous line ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,091
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SMF Post Prefix
« Reply #3 on: May 12, 2015, 07:54:39 AM »
LOL I have fixed that like three times, I need to pay more attention :P
Updated and fixed

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline br360

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 2,220
    • GenXcommunity
Re: SMF Post Prefix
« Reply #4 on: May 12, 2015, 12:06:37 PM »
Works great now. Thank you both. :)


Offline Suriya-DsR

  • Semi-Newbie
  • *
  • Posts: 23
  • Gender: Female
    • Dragon's Rise Weyr
Re: SMF Post Prefix
« Reply #5 on: May 12, 2015, 03:00:55 PM »
I am very excited about this mod, but there seems to be an issue with the install?

    1.    Replace    ./Sources/ManagePermissions.php    Test failed
Quote
Code: (Find) [Select]
'send_mail',
      'approve_posts',


Code: (Replace) [Select]

'send_mail',
      'approve_posts',
      'manage_prefixes',
      'set_prefix',


   4.    Execute Modification    ./Sources/Subs-Post.php    Test failed
Quote

Code: (Find) [Select]

$topicOptions['sticky_mode'] = isset($topicOptions['sticky_mode']) ? $topicOptions['sticky_mode'] : null;

   // This is longer than it has to be, but makes it so we only set/change what we have to.

Code: (Replace) [Select]
$topicOptions['sticky_mode'] = isset($topicOptions['sticky_mode']) ? $topicOptions['sticky_mode'] : null;
   $topicOptions['id_prefix'] = isset($topicOptions['id_prefix']) ? $topicOptions['id_prefix'] : null;

   // This is longer than it has to be, but makes it so we only set/change what we have to.



   5.    Execute Modification    ./Sources/Display.php    Test failed
Quote

Code: (Find) [Select]

t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.id_poll,

Code: (Replace) [Select]

t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.id_poll, t.id_prefix,


I am running the correct version of the forum for the mod, I was wondering if there was a way to fix this?

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,091
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SMF Post Prefix
« Reply #6 on: May 12, 2015, 04:25:43 PM »
Try manual parsing, on a clean install shouldn't be any problems.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline Bigguy

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,568
  • Gender: Male
  • Be nice, or else....
    • smfbigguy on GitHub
    • Whats Ur Beef
Re: SMF Post Prefix
« Reply #7 on: May 12, 2015, 07:16:17 PM »
Nice mod, very good work. Thanks. :)

Offline Alanar

  • Semi-Newbie
  • *
  • Posts: 34
Re: SMF Post Prefix
« Reply #8 on: May 25, 2015, 11:07:37 AM »
Hey there and thanks for a mod I've been waiting a long time for!

Just a note that it is not compatible with this Like Posts mod: http://custom.simplemachines.org/mods/index.php?mod=3708

The color selection doesn't work when both are installed. However, I ditched that mod for this one because it's just perfect. :)

Offline Alanar

  • Semi-Newbie
  • *
  • Posts: 34
Re: SMF Post Prefix
« Reply #9 on: May 25, 2015, 12:30:12 PM »
Could this mod be changed to work with inherited permissions? Right now it only works if you have the user's primary member group set to one of the member groups with a unique permission set.

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,091
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SMF Post Prefix
« Reply #10 on: May 25, 2015, 12:58:17 PM »
Hey there and thanks for a mod I've been waiting a long time for!

Just a note that it is not compatible with this Like Posts mod: http://custom.simplemachines.org/mods/index.php?mod=3708

The color selection doesn't work when both are installed. However, I ditched that mod for this one because it's just perfect. :)

I'll take a look to see if there's something I can do. Thank you

Could this mod be changed to work with inherited permissions? Right now it only works if you have the user's primary member group set to one of the member groups with a unique permission set.

Could you leave an example of this problem, e.g
User 1 is on primary group 1, and additional group 1
And prefixes and be used by additional group but the user cannot because primary can't, is hat what you meant?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline Alanar

  • Semi-Newbie
  • *
  • Posts: 34
Re: SMF Post Prefix
« Reply #11 on: May 25, 2015, 01:46:38 PM »
Could you leave an example of this problem, e.g
User 1 is on primary group 1, and additional group 1
And prefixes and be used by additional group but the user cannot because primary can't, is hat what you meant?
Member groups that have a unique permission set that show up in permissions are able to use prefixes if that member group is set as their primary.

If I make a member group that inherits the permissions of that group and set it as primary, then it doesn't work, even if I still have the working group as an additional group.

Only member groups with a unique set of permissions are shown in the options so only they work with the prefixes.

Offline Alanar

  • Semi-Newbie
  • *
  • Posts: 34
Re: SMF Post Prefix
« Reply #12 on: May 26, 2015, 02:23:13 PM »
Never mind and sorry for the trouble.

Enabling post count membergroup permissions let me use these. However, it just shows a blank box to check which allows anyone to use that prefix regardless of their membergroup.
« Last Edit: May 26, 2015, 02:45:34 PM by Alanar »

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,091
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SMF Post Prefix
« Reply #13 on: May 26, 2015, 04:38:42 PM »
Just read this morning that you enabled post group permission and it worked, is that okay then?
If not, did you try with Allow/Deny permissions?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline Alanar

  • Semi-Newbie
  • *
  • Posts: 34
Re: SMF Post Prefix
« Reply #14 on: May 26, 2015, 04:42:58 PM »
Yeah, sorry I deleted that as it still isn't working correctly. The allow/deny wasn't what made it work, it was enabling post count group permissions. That just let everyone use the prefixes regardless of their other groups.

Everything else inherits fine except for permissions for this mod.

Only membergroups that do not inherit permissions from another group are showing up in the options for the mod and only they work with it correctly and only if they're set as the primary membergroup for a user.

Edit: And allow/deny permissions still don't make it work correctly.

Offline Alanar

  • Semi-Newbie
  • *
  • Posts: 34
Re: SMF Post Prefix
« Reply #15 on: May 26, 2015, 06:32:14 PM »
What I guess I was asking for is a way to manage all membergroups to use or not use prefixes like how the modify board page is done. This way, I can set basic permissions for a certain group and then divy them up into a more specific subset like the forums is set up. On that page, every membergroup is listed even if it's based off another, less-specific one.

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,091
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SMF Post Prefix
« Reply #16 on: May 27, 2015, 01:15:36 AM »
Sorry I forgot about this, will try to check it tomorrow.
The thing is about showing all the groups right?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline Alanar

  • Semi-Newbie
  • *
  • Posts: 34
Re: SMF Post Prefix
« Reply #17 on: May 27, 2015, 01:17:25 AM »
Well, if they work, yes. If you can't do that, no worries. It's still an amazing free mod. :)

Offline FireDitto

  • Full Member
  • ***
  • Posts: 617
  • Gender: Female
  • Shadow In The Flame
    • @SPWeyr on Twitter
    • Second Pass Weyr RPG
Re: SMF Post Prefix
« Reply #18 on: May 31, 2015, 04:02:11 AM »
Hi! I have two quick questions,

1. Would it be possible to add the ability to choose a font colour as well as a background colour? Maybe check boxes for bold and italic as well?
2. Would it be possible to add the ability to call images instead of using font?

Thank you for your time!
Second Pass Weyr
An AU Pernse RPG

SMF 2.0.6 with SP 2.3.5

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,091
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SMF Post Prefix
« Reply #19 on: May 31, 2015, 10:41:22 PM »
Well, if they work, yes. If you can't do that, no worries. It's still an amazing free mod. :)

Hi, I just checked this today, I'm going to work on it tomorrow as I found another small bug on the mod. Not related to this one though.

Thanks.

Hi! I have two quick questions,

1. Would it be possible to add the ability to choose a font colour as well as a background colour? Maybe check boxes for bold and italic as well?
2. Would it be possible to add the ability to call images instead of using font?

Thank you for your time!

1- Sure
2- For sure

But I'm not going to work on that features for now, maybe for next month  ;D

Thank you for the suggestions.

SMF Tricks - Free & Premium Responsive Themes for SMF.