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

Jade Elizabeth

Hey so I dunno if I am the only one with this problem...but EVERY time I add a membergroup I have to alter the database to include it in the prefixes...

Can I just turn the membergroup requirement off? There's hundreds of prefixes and I can't manage them one by one that's not intuitive. There's no "bulk add" a membergroup or board option and there's no listing of prefixes on the boards or membergroups (which could be nice but again I probably have 200 by now lol).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Diego Andrés

Yeah I have found that annoying too as an admin.
I haven't really looked into it but I'm thinking the best way to add some sort of option for it.

Regards

SMF Tricks - Free & Premium Responsive Themes for SMF.

Jade Elizabeth

Turns out I have 50 prefixes ha ha...sure felt like 200 though!

If you want someone to help test it I'd be happy to help :D. It might be easier to just add bulk actions to the screen - "apply to all prefixes" or "apply to selected"...displaying 50 prefixes would be taxing.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Coyote Keith

Just installed this mod on my site 2.0.11 with no errors or issues. The mod works fine but I noticed I'm now getting a logged error every time a search is made. The error is in the attach pic

The line of code in question is

'prefix' => PostPrefix::formatPrefix($message['id_prefix']),

Appreciate any help.




Diego Andrés

Quote from: Coyote Keith on May 27, 2016, 07:21:42 PM
Just installed this mod on my site 2.0.11 with no errors or issues. The mod works fine but I noticed I'm now getting a logged error every time a search is made. The error is in the attach pic

The line of code in question is

'prefix' => PostPrefix::formatPrefix($message['id_prefix']),

Appreciate any help.

I will take a look

SMF Tricks - Free & Premium Responsive Themes for SMF.

Jade Elizabeth

I'd love to suggest a "remove prefix" option....if you move a topic to a board without prefixes, or the prefix it has is not enabled there it would be great if it would be stripped....and if not if there was a remove prefix option shown it would be super helpful too :D.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

MarkieNKV

#106
Hi Diego,

First of all, what a great modification you've created. Really like it. But i am missing something about it, i want to set the permission to view a topic based on the used prefix.

For example, i got 3 usergroups named:

- Patient
- Parents
- Partners

I got 7 prefixes named:

- [Patient]
- [Parents]
- [Partners]
- [Patient, Parents]
- [Patient, Partners]
- [Patient, Parents, Partners]
- [Parents, Partners]


All those usergroups can create a topic and they use the prefix to set the visibility of the topic. So if a member of the usergroup "Patient" creates a topic with the prefix [Patient, Parents, Partners] then the usergroups Patient, Parents and Partners can view (and reply on) the topic.

But if a member of the usergroup "Patient" creates a topic with the prefix [Patient, Partners], then only the usergroups Patient and Partners can view (and reply on) the topic. The usergroup Parents shouldn't see the topic at all.

Is this possible to add this function?

Kindred

This mod adds text...   adding permissions based on that text would be a huge change....  basically a completely new mod.
Сл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."

MarkieNKV

Then i must look for another solution.

Really can't understand why you only would like to add text and do nothing further with that. But that's my opinion ofcourse. Or i must find someone who could make it for us.

Diego Andrés

Quote from: MarkieNKV on June 27, 2016, 03:49:14 AM
Then i must look for another solution.

Really can't understand why you only would like to add text and do nothing further with that. But that's my opinion ofcourse. Or i must find someone who could make it for us.

Pure organization and esthetic and can save you from adding useless forums/categories, you can just use prefixes instead

SMF Tricks - Free & Premium Responsive Themes for SMF.

MarkieNKV

Oke, i can understand that. Same thing is what i want to do with our forum.

Currently we got a seperate board for Patients, a seperate board for Parents and a seperate board for Partners.

I want to get rid of that, but the wish from our members is that they can ask questions directly to some usergroups. Therefor i came at your mod, because it fits most of the things that i was looking for except that it doesn't got the extra permission settings i was looking for.

I've created a Mod Request here. It would be wonderfull if you would make a Paid Pro version of your currect mod that does support the permission settings i'm looking for.

Diego Andrés

Sorry but as @Kindred said, this mod is just a prefix mod  :P
btw, you may want to search for "private topics", that could possibly fit your needs

SMF Tricks - Free & Premium Responsive Themes for SMF.

ndmccain

First, thank you for this great mod!

I'm using the SMF4Mobile theme and the latest release of SMF. I was hoping you could point me in the right direction on how to enable prefixes on the forum view (page that shows all the topics)? The MessageIndex.template is below.

<?php
// Version: 2.0 RC2; MessageIndex

function template_main()
{
global $context$settings$options$scripturl$modSettings$txt$board_info$user_info;

if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0))
{
echo '
<ul data-role="listview" style="margin-bottom: 0;" class="ui-base-link ui-page-theme-b">
<li>
<h3>'
$txt['parent_boards'], '</h3>
</li>'
;

foreach ($context['boards'] as $board)
{
echo '
<li'
, !$board['new'] ? ' class="ui-link-read"' '''>
<a href="'
$board['href'], '" name="b'$board['id'], '"'$board['is_redirect'] ? ' rel="external"' '''>
<h3>'
$board['name'], '</h3>';

if (!empty($board['description']))
echo '
<p>
<strong>'
strip_tags($board['description']), '</strong>
</p>'
;

if (!empty($board['last_post']['id']))
echo '
<p class="last_post">
'
$txt['last_post'], ': '$board['last_post']['subject'], ' '$txt['by'], ' '$board['last_post']['member']['name'], ' '$txt['on'], ' '$board['last_post']['time'], '
</p>'
;

echo '
</a>
</li>'
;

if (!empty($board['children']))
foreach ($board['children'] as $child)
echo '
<li class="child_board'
, !$child['new'] ? ' ui-li-fade' '''">
<a href="'
$child['href'], '">
'
$child['name'], '
</a>
</li>'
;
}

echo '
</ul>'
;
}

if (!empty($modSettings['topbottomEnable']))
{
echo '
'
, empty($context['boards']) ? '' '<br />''
<a data-role="button" class="goDown" data-icon="arrow-d" data-inline="true" style="margin-top: '
, empty($context['boards']) ? '-0.3em' '-0.5em'';">Go Down</a><br />',
(empty($context['boards']) ? '<br />' '');
}
echo '
<ul data-role="listview"'
, !empty($context['boards']) && $context['start'] == ' style="margin-top: 0;"' ''' class="ui-base-link">
<li>
<h3>'
$board_info['name'], '</h3>
</li>
<li><p>'
$context['description'], '</p></li>';

// No topics.... just say, "sorry bub".
if (empty($context['topics']))
echo '
<li><p class="ui-li-desc">'
$txt['msg_alert_none'], '</p><li>';

$sticky_title_shown false;
$normal_title_shown false;
foreach ($context['topics'] as $topic)
{
// Is the topic sticky and no title has been shown yet?
if ($topic['is_sticky'] && !$sticky_title_shown)
{
$sticky_title_shown true;
echo '
<li>'
$txt['sticky_topics'], '</li>';
}
elseif (!$topic['is_sticky'] && $sticky_title_shown && !$normal_title_shown)
{
$normal_title_shown true;
echo '
<li>'
$txt['topics'], '</li>';
}

echo '
<li class="ui-page-theme-b'
, !$topic['new'] || $user_info['is_guest'] ? ' ui-link-read' '''"">
<a href="'
$topic['first_post']['href'], '">
<p style="word-wrap: break-word; width: 50%; margin-top: 0;">
<strong>'
$topic['first_post']['member']['name'], '</strong> '$txt['on'], ' '$topic['first_post']['time'], '
</p>
<p class="ui-li-aside" style="width: 45%;">
'
$txt['views'], ': '$topic['views'], ', '$txt['replies'], ': '$topic['replies'], '
</p>
<h3>'
$topic['first_post']['subject'], empty($topic['approved']) ? ' (' $txt['awaiting_approval'] . ')' '''</h3>';

if (!empty($topic['last_post']['id']) && $topic['last_post']['id'] != $topic['first_post']['id'])
echo '
<p class="ui-li-desc last_post">'
$txt['last_post'], ' '$txt['by'], ' '$topic['last_post']['member']['name'], ' '$txt['on'], ' '$topic['last_post']['time'], '</p>';

echo '
</a>'
;
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="'
strip_hash($topic['new_href']), '" data-scrollto="'get_hash($topic['new_href']), '" id="newicon' $topic['first_post']['id'] . '"></a>';

echo '
</li>'
;
}

echo '
</ul><br />'
;

if (!empty($modSettings['topbottomEnable']))
{
echo '
<a data-role="button" class="goUp" data-icon="arrow-u" data-inline="true">Go Up</a>'
;
}

// Create the button set...
$normal_buttons = array(
'new_topic' => array('test' => 'can_post_new''text' => 'new_topic''icon' => 'plus''url' => $scripturl '?action=post;board=' $context['current_board'] . '.0'),
'post_poll' => array('test' => 'can_post_poll''text' => 'new_poll''icon' => 'plus''url' => $scripturl '?action=post;board=' $context['current_board'] . '.0;poll'),
'notify' => array('test' => 'can_mark_notify''text' => $context['is_marked_notify'] ? 'unnotify' 'notify''icon' => ($context['is_marked_notify'] ? 'minus' 'star'), 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_board'] : $txt['notification_enable_board']) . '\');"''url' => $scripturl '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' 'on') . ';board=' $context['current_board'] . '.' $context['start'] . ';' $context['session_var'] . '=' $context['session_id']),
'markread' => array('text' => 'mark_read_short''icon' => 'check''url' => $scripturl '?action=markasread;sa=board;board=' $context['current_board'] . '.0;' $context['session_var'] . '=' $context['session_id']),
);

// They can only mark read if they are logged in and it's enabled!
if (!$context['user']['is_logged'] || !$settings['show_mark_read'])
unset($normal_buttons['markread']);

template_button_strip($normal_buttons);
}

function 
template_filterPrefix()
{
global $context$modSettings$scripturl$txt;

// Prefix
if (!empty($modSettings['PostPrefix_enable_filter']) && !empty($context['prefix']['post']))
{

echo'
<ul class="ui-base-link ui-page-theme-b">
<li class="ui-boardindex-whos"> <h4>
'
$txt['PostPrefix_filter'],'
</h4>'
;



// Show all the prefixes for this board.
foreach ($context['prefix']['post'] as $prefix)
echo'
<a href="' 
$scripturl '?board=' $context['current_board'] . '.0;prefix=' $prefix['id'] . '">' PostPrefix::formatPrefix($prefix['id']) . '</a>, ';

echo'
<a href="'
$scripturl'?board='$context['current_board'], '.0;prefix=0">'$txt['PostPrefix_filter_noprefix'], '</a>, 
<a href="'
$scripturl'?board='$context['current_board'], '.0">'$txt['PostPrefix_filter_all'], '</a>
</li></ul>
<br class="clear" />'
;
}
}

?>


I've added the prefixes to every other template but can't figure that one out!

Any help is great! Thanks!

MarkieNKV

Quote from: Diego Andrés on June 27, 2016, 12:45:40 PM
Sorry but as @Kindred said, this mod is just a prefix mod  :P
btw, you may want to search for "private topics", that could possibly fit your needs
Sorry for the late reply, but private topics ain't it either.

RDXing - VC-MP

Hello i got an error here


DenDen60

I would like to see a forum that uses this MOD. Can anyone share a link? Thanks

Jade Elizabeth

I use it and I LOVE it.

http://www.colormeforum.com/f/coloring-toolbox/ <Lots of colors
http://www.colormeforum.com/f/other-crafts/ <Two colors
http://www.colormeforum.com/f/other-relaxation/ <One color

Keep in mind my forum has its own styling so yours and mine may look different, but mine shouldn't change it that much. You may wish to fiddle with yours.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Black Tiger

I would like to use this mod on a forum, but have a couple of questions.

1.) Is this mod working flawlesly now without any issues and without errors in logs?
2.) Would it work on most styles (on a 2.012 forum)
3.) The forum is from a friend of mine. He has several subforums from which he wants to move all threads to 1 other subforum.
Before the moving threads to the single subforum he wants to give a prefix to all posts in all subforums via an sql command.

For example, these are subforums:
- rainy
- misty
- snow
- wind

Say he wants to make 1 subforum called "wheather conditions" and move all posts of the above subforums in there.
But before doing that, he want's to make 4 prefixes, so all threads in the above subforums will get
[rainy]
[misty]
[snow]
[wind]
as prefix. Since these subforums contain a lot of posts, he wants to do this via a mysql command.

He has daily backups. Is this possible and if yes, what is the correct sql command to do this without breaking things (like other forums or subforums or threads).
Greetings, Black Tiger

Adz.

how do i make the prefix box smaller? It's quite big for a prefix lol

Dreadaxe

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?

Advertisement: