Advertisement:

Author Topic: Auto Merge Double Post  (Read 272870 times)

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Auto Merge Double Post
« Reply #640 on: April 20, 2020, 05:59:22 AM »
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?
The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Auto Merge Double Post
« Reply #641 on: April 21, 2020, 02:56:39 PM »
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.

The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Auto Merge Double Post
« Reply #642 on: June 03, 2020, 07:05:18 AM »
Can anyone fix this mistake?
The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Auto Merge Double Post
« Reply #643 on: June 03, 2020, 07:26:44 AM »
Since the original author left years ago...?
No good deed goes unpunished
All helpful urges should be circumvented

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Auto Merge Double Post
« Reply #644 on: June 03, 2020, 07:43:55 AM »
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.
The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,629
  • Gender: Male
    • i30 Owners Club
Re: Auto Merge Double Post
« Reply #645 on: June 03, 2020, 08:52:57 AM »
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.

Offline kilk

  • Semi-Newbie
  • *
  • Posts: 25
    • Elddem The MMORPG
Re: Auto Merge Double Post
« Reply #646 on: June 09, 2020, 04:07:40 PM »
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

Offline shadav

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,436
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Auto Merge Double Post
« Reply #647 on: October 09, 2020, 08:58:49 PM »
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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<file name="$sourcedir/ManagePosts.php">
<operation>
<search position="before"><![CDATA[
'topics' => 'ModifyTopicSettings',]]></search>
<add><![CDATA[
'automerge' => 'ModifyAutoMergePostSettings',]]></add>
</operation>

find
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<file name="$sourcedir/Display.php">
<operation>
<search position="before"><![CDATA[
$posters = array();]]></search>
<add><![CDATA[
$context['double_post_temp'] = array();]]></add>
</operation>
replace
Code: [Select]
<file name="$sourcedir/Display.php">
<operation>
<search position="before"><![CDATA[
$all_posters = array();]]></search>
<add><![CDATA[
$context['double_post_temp'] = array();]]></add>
</operation>

find
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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
Code: [Select]
<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

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Auto Merge Double Post
« Reply #648 on: October 12, 2020, 07:28:23 AM »
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.
The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!

Offline shadav

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,436
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Auto Merge Double Post
« Reply #649 on: October 12, 2020, 10:03:45 AM »
sorry I don't understand what the error is, my guess is to check the language file, the error is probably in there

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Auto Merge Double Post
« Reply #650 on: October 12, 2020, 10:15:50 AM »
The extra.xml file in the package of this modification contains the following code:

Code: [Select]
<!-- 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".
The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!