Auto Merge Double Post

Started by M-DVD, December 03, 2008, 10:18:25 AM

Previous topic - Next topic

jsx

Hi,

I use Auto Merge Double Post modification, this modification has been adapted to work correctly by @aegersz - this modification works fine but there is a issue in my forum with the [time] tag that appears next to the date. On the forum I use Polish as the main language of the forum and this is where the issue occurs.



I do not know why the [time] tag is displayed here next to the date. This tag is displayed only if I use Polish in the forum.

If I set English as the main forum language then this tag will not be displayed next to the date.



Even if I disable the [time] tag in Posts and Topics> Bulletin Board Code, this tag still appears next to the date when the Polish language is set.

When I set the Polish language again and added the test 8 post then this tag appeared next to all merged posts.



Anyone know what's going on?

jsx

This is not a issue with the language which I use, because I uploaded few languages and set each of these languages as the main language of the forum and the same [time] tag appears. So there is something wrong in the code of this modification that this tag is displayed when using a language other than English.


jsx

Can anyone fix this mistake?

Arantor

Since the original author left years ago...?

jsx

I understand that the author of this modification is not active on this support. But maybe some clever coder could help me solve this mistake.

Shambles

The only thing I spotted was in the language translations/inserts that accompany the mod.

For English there are 18 $txt declarations; for Polish there are only 5 $txt declarations.

No idea if this contributes to the fault... haven't time to dig further.

kilk

Just what I was looking for, thank you OP!
Elddem The MMORPG - https://www.elddem.com | Denarius (D) Cryptocurrrency - https://www.denarius.io | BlockForums - Cryptocurrency Community Forums - https://www.blockforums.org

shadav

as I've been asked :) I'll try to post here what all I had done (though that was a year ago, so comparing my package file with the latest downloaded one)
Here's what I did to get this mod to work for me

download the AutoMergeDoublePost_v1_3 and unzip it

in install_2.xml
find
<file name="$themedir/Display.template.php">
<operation>
<search position="after"><![CDATA[
$split_button = create_button('split.gif', 'split', 'split', 'align="middle"');]]></search>
<add><![CDATA[
$merge_button = create_button('merge.gif', 'merge_button', 'merge_button', 'align="middle"');]]></add>
</operation>

<operation>
<search position="after"><![CDATA[
// What about splitting it off the rest of the topic?
]]></search>
<add><![CDATA[
// Can the user merge the doble post?
if ($message['can_merge'])
echo '
<li><a href="', $scripturl, '?action=post2;merge=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', $merge_button, '</a></li>';
]]></add>
</operation>
</file>

replace
<file name="$themedir/Display.template.php">
<operation>
<search position="after"><![CDATA[
// What about splitting it off the rest of the topic?
]]></search>
<add><![CDATA[
// Can the user merge the double post?
if ($message['can_merge'])
echo '
<li class="split_button"><a href="', $scripturl, '?action=post2;merge=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['merge_button'], '</a></li>';
]]></add>
</operation>
</file>


find
<file name="$sourcedir/Admin.php">
<operation>
<search position="before"><![CDATA[
'topics' => array($txt['manageposts_topic_settings'], 'admin_forum'),]]></search>
<add><![CDATA[
'automerge' => array($txt['manageposts_automerge_settings'], 'admin_forum'),]]></add>
</operation>
</file>

replace
<file name="$sourcedir/Admin.php">
<operation>
<search position="before"><![CDATA[
'topics' => array($txt['manageposts_topic_settings']),]]></search>
<add><![CDATA[
'automerge' => array($txt['manageposts_automerge_settings']),]]></add>
</operation>
</file>


find
<file name="$sourcedir/ManagePosts.php">
<operation>
<search position="before"><![CDATA[
'topics' => array('ModifyTopicSettings', 'admin_forum'),]]></search>
<add><![CDATA[
'automerge' => array('ModifyAutoMergePostSettings', 'admin_forum'),]]></add>
</operation>

replace
<file name="$sourcedir/ManagePosts.php">
<operation>
<search position="before"><![CDATA[
'topics' => 'ModifyTopicSettings',]]></search>
<add><![CDATA[
'automerge' => 'ModifyAutoMergePostSettings',]]></add>
</operation>


find
<file name="$sourcedir/ManagePermissions.php">
<operation>
<search position="after"><![CDATA[
'report_any' => array(false, 'post', 'participate'),]]></search>
<add><![CDATA[
'doublePost' => array(false, 'post', 'participate'),
'doublePostmerge' => array(true, 'post', 'participate'),]]></add>
</operation>
</file>

replace
<file name="$sourcedir/ManagePermissions.php">
<operation>
<search position="after"><![CDATA[
'post_reply' => array(true, 'topic', 'make_posts', 'make_posts'),]]></search>
<add><![CDATA[
'doublePost' => array(false, 'topic', 'make_posts'),
'doublePostmerge' => array(true, 'topic', 'make_posts'),]]></add>
</operation>
</file>


find
<file name="$sourcedir/Post.php">
<operation>
<search position="after"><![CDATA[
// Replying to a topic?]]></search>
<add><![CDATA[
global $post_errors;

// Flooder?
$_GET['merge'] = empty($_GET['merge']) ? 0 : (int)$_GET['merge'];
if ((isset($topic) && !isset($_REQUEST['msg']) && !empty($modSettings['AutoMergePost_auto']))
|| (!empty($_GET['merge']) && !empty($modSettings['AutoMergePost_manual'])))
doublePostCheck($_GET['merge']);
]]></add>
</operation>

replace
<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA[
if (empty($_POST) && empty($topic))]]></search>
<add><![CDATA[
$_GET['merge'] = empty($_GET['merge']) ? 0 : (int)$_GET['merge'];
if (empty($_POST) && empty($topic) && (empty($_GET['merge']) && empty($modSettings['AutoMergePost_manual'])))]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
elseif (empty($_POST) && !empty($topic))]]></search>
<add><![CDATA[
elseif (empty($_POST) && !empty($topic) && (empty($_GET['merge']) && empty($modSettings['AutoMergePost_manual'])))]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
// Replying to a topic?]]></search>
<add><![CDATA[
global $post_errors;

// Flooder?
if ((isset($topic) && !isset($_REQUEST['msg']) && !empty($modSettings['AutoMergePost_auto']))
|| (!empty($_GET['merge']) && !empty($modSettings['AutoMergePost_manual'])))
doublePostCheck($_GET['merge']);
]]></add>
</operation>


find
<file name="$sourcedir/Display.php">
<operation>
<search position="before"><![CDATA[
$posters = array();]]></search>
<add><![CDATA[
$context['double_post_temp'] = array();]]></add>
</operation>

replace
<file name="$sourcedir/Display.php">
<operation>
<search position="before"><![CDATA[
$all_posters = array();]]></search>
<add><![CDATA[
$context['double_post_temp'] = array();]]></add>
</operation>


find
<operation>
<search position="before"><![CDATA[
'can_see_ip' => allowedTo('moderate_forum') || ($message['id_member'] == $user_info['id'] && !empty($user_info['id'])),]]></search>
<add><![CDATA[
'can_merge' => !empty($modSettings['AutoMergePost_manual']) && (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('doublePostmerge_any') || (allowedTo('doublePostmerge_own') && $message['id_member'] == $user_info['id'])) && $context['double_post'][$message['id_msg']],]]></add>
</operation>
</file>

</modification>

replace
<operation>
<search position="before"><![CDATA['can_see_ip' => allowedTo('moderate_forum') || ($message['id_member'] == $user_info['id'] && !empty($user_info['id'])),]]></search>
<add><![CDATA[
'can_merge' => !empty($modSettings['AutoMergePost_manual']) && (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('doublePostmerge_any') || (allowedTo('doublePostmerge_own') && $message['id_member'] == $user_info['id'])) && ($message['id_msg'] != $topicinfo['id_first_msg'] ? $context['double_post'][$message['id_msg']] : ''),]]></add>
</operation>
</file>

</modification>


===
in package-info.xml
find
<install for="2.0 - 2.99.99">
<readme type="file" parsebbc="true">readme.txt</readme>
<modification format="xml" type="file">install_2.xml</modification>
<modification format="xml" type="file">languages.xml</modification>
<modification format="xml" type="file">extra.xml</modification>
<database type="file">install_2.php</database>
</install>

replace
<install for="2.0 - 2.99.99">
<readme type="file" parsebbc="true">readme.txt</readme>
<modification format="xml" type="file">install_2.xml</modification>
<modification format="xml" type="file">languages.xml</modification>
<modification format="xml" type="file">extra.xml</modification>
<database type="file">install_2.php</database>
<redirect url="$scripturl?action=admin;area=postsettings;sa=automerge" timeout="5000" />
</install>


find
<uninstall for="2.0 - 2.99.99">
<modification format="xml" type="file" reverse="true">install_2.xml</modification>
<modification format="xml" type="file" reverse="true">languages.xml</modification>
<modification format="xml" type="file" reverse="true">extra.xml</modification>
</uninstall>

replace
<uninstall for="2.0 - 2.99.99">
<modification format="xml" type="file" reverse="true">install_2.xml</modification>
<modification format="xml" type="file" reverse="true">languages.xml</modification>
<modification format="xml" type="file" reverse="true">extra.xml</modification>
<redirect url="$scripturl?action=admin;area=packages;sa=browse" timeout="2000" />
</uninstall>


====
rezip the files and upload it to your package folder
good luck :)

hopefully it'll work or at least you'll have a bit less to figure out

jsx

shadav,

Thanks for sharing the codes, unfortunately this error with the time tag still occurs.



Is there anyone able to check this and fix this error? There is something wrong in the code of this modification that this tag is displayed when using a language other than English.

shadav

sorry I don't understand what the error is, my guess is to check the language file, the error is probably in there

jsx

The extra.xml file in the package of this modification contains the following code:

<!-- Fixing bug in Time BBCode -->
<file name="$sourcedir/Subs-Post.php">
<operation error="ignore">
<search position="replace"><![CDATA[
$parts[$i] = preg_replace('~\[time\](\d{0,10})\[/time\]~ie', '\'[time]\' . strftime(\'%c\', \'$1\') . \'[/time]\'', $parts[$i]);]]></search>
<add><![CDATA[
$parts[$i] = preg_replace('~\[time\](\d{0,10})\[/time\]~ie', '\'[time]\' . timeformat(\'$1\', false) . \'[/time]\'', $parts[$i]);]]></add>
</operation>
</file>


There may be some bug in this code. So this bug was known to the author of this modification because he entered this code in this file "Fixing bug in Time BBCode".

Advertisement: