51

Re: Move Post 1.3 + Merge Topics

Hello Fred,

There were some differences in the include/common.php file. (which I find strange anyway, as we updated the forum through the diff everytime there was a new version).
The one that stood out was the error reporting: We had it on "report all", including notices. (I guess that's why I got these messages)
I changed it to the way it is in the new version. I guess that should fix my "issues".

Thank you for your help!

Hendrik-Jan

Re: Move Post 1.3 + Merge Topics

Your are welcome !
smile

Re: Move Post 1.3 + Merge Topics

Hi,
I've only just found punbb and was surprised that 'move' a post wasn't a core admin function.

I had the same problems others did with 1.1 but 1.1.1 works great (with Firefox as well).

I just wanted to thank you for putting this essential mod together and ask the punbb dev team to ask themselves "why didn't 'they' include a 'move posts' function for admins to start with".

Great Job.  Well done.

Kev Polley

Re: Move Post 1.3 + Merge Topics

Thanks smile

I don't want to ask to punbb dev team anything : they have their own understanding of what they want to do with PunBB ans so far they do a really great job. Nevertheless I hope they are reading the forums wink and may be they will include something in the 1.3 (in my understanding is not planned) related to this function (probably something with better code than mine ...)

Cheers

Fred

55

Re: Move Post 1.3 + Merge Topics

Hi, it's quite perfect. I like this mod very much. I've installed it to my 1.2.11, it seems to work fine.

I translate in italian:

<?php

// Language definitions used in the mod "Move Post" 1.1.1

$lang_movepost = array(

'Mod move post'     =>  '[Move Post 1.1.1] - Sposta un messaggio',
'Intro'         =>  'Questo mod permette di spostare uno o più messaggi da un argomento ad un altro in qualsiasi forum. Consente in alternativa di creare un nuovo argomento dove spostare i messaggi.',

'Introduction'        =>  'Spiegazione',
'Create topic'        =>  'Crea un nuovo argomento',
'Move post'       =>  'Scegli l\'argomento di destinazione',

'Original topic'      =>  'Argomento originale:',
'Original forum'      =>  'Forum originale:',
'Select forum'        =>  'Scegli eventualmente un altro forum',
'Move all posts'      =>  'Sposta tutti i messaggi di questo argomento',

'Explain move all posts'    =>  'L\'argomento originale verrà cancellato.',
'Explain create topic'    =>  'Per creare un nuovo argomento, inserire un nuovo oggetto.',
'Explain move post'     =>  'Clicca sull\'argomento di destinazione.',

'Last'          =>  'Ultimo',
'Poster'          =>  'Inviato da',

'Bad topic'       =>  'Scelta errata',
'Bad new topic'     =>  'L\'oggetto non può essere vuoto',

'Mark move redirect'    =>  'Il messaggio è stato spostato nell\'argomento selezionato. Attendere prego …'

);

Just one thing: the mod doesn't update forum counts so in index.php you have wrong topics, posts and last posters. Some time ago i've modified admin_forum.php to include an update counts function so i use it but it will be a good idea to fix the mod.


my admin_forum.php (rownum is referred to my file, is only indicative)
approximately line 130, before

// Update forum positions
else if (isset($_POST['update_positions']))

i've added

// Update forum counts
else if (isset($_POST['update_counts']))
{
  $result = $db->query('select id from '.$db->prefix.'forums where redirect_url is null') or error('Unable to select forum', __FILE__, __LINE__, $db->error());
  while ($cur_forum = $db->fetch_assoc($result))
  {
    $counts = $db->query('select count(id) topics, sum(num_replies) replies from '.$db->prefix.'topics where forum_id='.$cur_forum['id']) or error('Unable to select forum', __FILE__, __LINE__, $db->error());
    $forum_counts = $db->fetch_assoc($counts);

    $db->query('update '.$db->prefix.'forums set num_topics='.$forum_counts['topics'].',num_posts='.($forum_counts['replies']+$forum_counts['topics']).' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error());

    $counts = $db->query('select last_post,last_post_id,last_poster from '.$db->prefix.'topics where forum_id='.$cur_forum['id'].' order by last_post desc limit 1') or error('Unable to select forum', __FILE__, __LINE__, $db->error());
    $forum_counts = $db->fetch_assoc($counts);

    $db->query('update '.$db->prefix.'forums set last_post='.$forum_counts['last_post'].',last_post_id='.$forum_counts['last_post_id'].',last_poster="'.$forum_counts['last_poster'].'" WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
  }

  redirect('admin_forums.php', 'Forum Counts Updated. Redirecting …');
}

and approximately line 469, before

</div>
  <div class="clearer"></div>
</div>
<?php

require PUN_ROOT.'footer.php';

i've added

<h2 class="block2"><span>Update Forum Counts</span></h2>
    <div class="box">
      <form id="upfcounts" method="post" action="admin_forums.php?action=updcounts">
        <p class="submittop"><input type="submit" name="update_counts" value="Update counters" tabindex="<?php echo ++$tabindex_count ?>" /></p>
      </form>
    </div>

Hope this help. Bye.

56

Re: Move Post 1.3 + Merge Topics

The mod doesn't update forum counts?  It would need to update the `_forums` table, `_topics` table, and `_posts` table, wouldn't it?

57

Re: Move Post 1.3 + Merge Topics

Is Move Post 1.1.1 stable now?  Are any revisions or updates planned for the near future?  Is it OK to go ahead and install it now (I'd prefer to install it once and leave it alone for a few months if possible)?

Re: Move Post 1.3 + Merge Topics

Yes this Mod is stable, yo can use it safely ! There is no pb with forum count so far.
The next release will be done when the 1.3 of PunBB will be released itself.

Good luck !

59

Re: Move Post 1.3 + Merge Topics

Thanks for writing this mod, fpouget.  You're my hero.

I used to merge topics manually in phpMyAdmin.  I had the 'split-topic' mod, but it didn't merge topics.

Re: Move Post 1.3 + Merge Topics

I like to be a hero ! smile

61

Re: Move Post 1.3 + Merge Topics

is it possible to move several posts at the same time?

Re: Move Post 1.3 + Merge Topics

Yes and no ...
Yes because you can move all the posts from the topic in one move.
No because you can not select between the differents posts the ones you want to move and the ones not. In this case you need to do as much "move" as post you need to move.

Hope this will be helpfull !

63

Re: Move Post 1.3 + Merge Topics

fpouget wrote:

Yes and no ...
Yes because you can move all the posts from the topic in one move.
No because you can not select between the differents posts the ones you want to move and the ones not. In this case you need to do as much "move" as post you need to move.

Hope this will be helpfull !

That what i was wondering. now it's clear smile

64

Re: Move Post 1.3 + Merge Topics

I think i need some help. I think i have done exactly like the instructions, but nothing happened. I dont see any differens at all.. anyone have any idea?

Re: Move Post 1.3 + Merge Topics

Can you tell more ? Difficult to help without details ...

66

Re: Move Post 1.3 + Merge Topics

I found the problem.... my fault, as usual...

67

Re: Move Post 1.3 + Merge Topics

Work pretty well in my forum, thanks!

but I just wonder what the difference between creating a new topic with "Move all posts belong to this topic" checked and editing the topic's subject directly is. tongue

Re: Move Post 1.3 + Merge Topics

There is no difference except if you want to change the topic's sujbect AND move it in an another forum in one step. With punbb, this action require 2 steps (editing subject, move topic). But I know this mod can have some overlap functions with the native PunBB (more is not better than less? tongue)

69

Re: Move Post 1.3 + Merge Topics

Here is my corect to code that update forum counts. Some condition must be additionaly check becouse when forum have no posts you could see "Update forum error".


// Update forum counts
else if (isset($_POST['update_counts']))
{
  $result = $db->query('select id from '.$db->prefix.'forums where redirect_url is null') or error('Unable to select forum', __FILE__, __LINE__, $db->error());
  while ($cur_forum = $db->fetch_assoc($result))
  {
    $counts = $db->query('select count(id) topics, sum(num_replies) replies from '.$db->prefix.'topics where forum_id='.$cur_forum['id']) or error('Unable to select forum', __FILE__, __LINE__, $db->error());
    $forum_counts = $db->fetch_assoc($counts);

    $db->query('update '.$db->prefix.'forums set num_topics='.$forum_counts['topics'].',num_posts='.($forum_counts['replies']+$forum_counts['topics']).' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error());

    $counts = $db->query('select last_post,last_post_id,last_poster from '.$db->prefix.'topics where forum_id='.$cur_forum['id'].' order by last_post desc limit 1') or error('Unable to select forum', __FILE__, __LINE__, $db->error());
    $forum_counts = $db->fetch_assoc($counts);

    if (($forum_counts['last_post']) && ($forum_counts['last_post_id']) && ($forum_counts['last_poster']))
        $db->query('update '.$db->prefix.'forums set last_post='.$forum_counts['last_post'].',last_post_id='.$forum_counts['last_post_id'].',last_poster="'.$forum_counts['last_poster'].'" WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
  }

  redirect('admin_forums.php', 'Forum Counts Updated. Redirecting …');
}

Re: Move Post 1.3 + Merge Topics

Why not just use the update_forum functionality?

Re: Move Post 1.3 + Merge Topics

Smartys, you are inside, do you know if the functionnality of this mod will be included in PunBB 1.3. I'm asking, because I 've still some to add but "I don't want to lose my time" if ever everything will be on original version ...

- Move a post in an empty forum (see above)
- Move a post using the topic id
- Move differents posts il the same topic in only one step

Re: Move Post 1.3 + Merge Topics

I don't think 1.3 will have splitting/merging functionality for posts, no

Re: Move Post 1.3 + Merge Topics

Such a shame sad Ok I will try to improve my mod so ...

74

Re: Move Post 1.3 + Merge Topics

Would you be willing to write this as a Plugin instead of a Mod?  Aren't plugins easier to install?  If I understand correctly, plugins are easier to install because all you do is upload them into the plugin directory.  With mods you install it by editing files, so every time the forum is upgraded to a new version you have to redo the mod again and it's more work.

Re: Move Post 1.3 + Merge Topics

Plugins can only be run by moderators/administrators and are their own individual files, they can't modify the behavior of PunBB smile
Extensions will be in 1.3. They are essentially "upload, click to install" modifications that require no editing of files. Ideally, there will be enough hooks in the code that EVERY mod can be an extension. tongue