[RC] Advanced Topic Type

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Xoduz
Registered User
Posts: 12
Joined: Sun May 23, 2004 3:35 am

Post by Xoduz » Fri Jan 12, 2007 6:59 am

After updating my forum to 2.0.22, the forum is suddenly treating my custom topic types as "announce/stickies" and moves them to the top of the forum whether I want them to or not :|

The mod itself seems to work fine, it's only this "move every topic with advanced type to the top of the forum" I don't like.

Any ideas?

rewardstupid
Registered User
Posts: 34
Joined: Thu Jan 11, 2007 3:54 pm

Post by rewardstupid » Sun Jan 14, 2007 3:41 am

I've given up on this mod. I managed to get one of my topic types to display its icon but the other two wouldn't.

martin_uy
Registered User
Posts: 46
Joined: Sun Oct 16, 2005 5:52 pm
Contact:

Post by martin_uy » Wed Jan 17, 2007 2:45 pm

KE5EHI wrote: Cusrious to see if anyone has updated this mod yet with all of the fixes?
Yes, I've got this mod working on my old forum.

Unfortunately I didn't wrote file changes so they are there but I can't tell you which they were :(

If I decide to install it on my new forum I will take care and write a newer/working version :P

User avatar
PCGUY112887
Registered User
Posts: 499
Joined: Thu Apr 01, 2004 12:39 am
Location: Illinois
Contact:

Post by PCGUY112887 » Fri Jan 19, 2007 4:17 pm

Does anyone know of a way to FORCE users to pick a topic type? By default it's blank, and I want users to HAVE to pick one before it allows them to post.

bbnewbie
Registered User
Posts: 36
Joined: Sun Aug 20, 2006 5:02 pm

Post by bbnewbie » Fri Mar 02, 2007 9:20 am

noone have a working code for 2.0.22 ?

murnauvsbuñuel
Registered User
Posts: 177
Joined: Mon Jun 20, 2005 9:49 am

Post by murnauvsbuñuel » Fri Mar 02, 2007 7:51 pm

working to phpBB 2.0.22? any similar mod more lite? thanks
sorry for my bad english i am spanish.
ImagemxBB Portal the best portal to phpBB2

User avatar
bamavamp
Registered User
Posts: 62
Joined: Wed Jan 24, 2007 5:13 am
Location: sweet home alabama

Re: [RC] Advanced Topic Type

Post by bamavamp » Fri Aug 17, 2007 2:29 pm

This mod needs to be removed as no one is providing help for it anymore. I have had this mod installed, and everything shows correctly in acp--no error messages--however when I try to pick one of my new topic types when posting a message, it posts as a normal post instead of TIPS or whatever type I had chosen.


gfonseca
Registered User
Posts: 29
Joined: Mon Oct 01, 2007 3:30 am

Re: [RC] Advanced Topic Type

Post by gfonseca » Mon Oct 01, 2007 7:12 am

bamavamp wrote:This mod needs to be removed as no one is providing help for it anymore. I have had this mod installed, and everything shows correctly in acp--no error messages--however when I try to pick one of my new topic types when posting a message, it posts as a normal post instead of TIPS or whatever type I had chosen.

I second this. It seems we are all having the same problem with this MOD. It appears to be working fine but the topic names don't show up next to the posts.

Unless someone can figure out a way to fix this (which doesn't seem likely) it should be removed.

lugsciath
Registered User
Posts: 316
Joined: Tue Oct 02, 2007 11:12 am

Re: [RC] Advanced Topic Type

Post by lugsciath » Tue Oct 02, 2007 11:20 pm

Okay Folks,

I´ve added the Mod to my 2.022 heavy modded board and i´ve found it useful, but dont working :-) ... After hours i got first results and now i keep em work, but with one thing only ... the last added topic would not be shown, because empty fields. I think i get this bug in the next days, but if someone catch that bug faster i´ve would be pretty happy :-)

Here are the changes (sorry for my bod english and this kind of coding, but it is the best i´m able to).


viewtopic.php

find

Code: Select all

		$replies = $topic_rowset[$i]['topic_replies'];
		$topic_type = $topic_rowset[$i]['topic_type'];
after add

Code: Select all

    // BEGIN Advanced Topic Type MOD
    //////////////////////////////////////////////////////////////////////////////////////
    // little bugfix by lugsciath - without any warranty                                //
    // the bug is very easy: only sticky and announce will be counted - that´s the bug. //
    // just do it without any borders and see: it works.                                //
    //////////////////////////////////////////////////////////////////////////////////////

    $sql = "SELECT * FROM ". TOPIC_ADD_TYPE_TABLE ."";

    if ( !($result = $db->sql_query($sql)) )
    {
      message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
    }

    if( $topic_type == POST_ANNOUNCE )
    {
      $topic_type = '<span style="color:'. $announce_color .'">'. $lang['Topic_Announcement'] . ' </span>';
    }
    else if( $topic_type == POST_STICKY )
    {
      $topic_type = '<span style="color:'. $sticky_color .'">'. $lang['Topic_Sticky'] . ' </span>';
    }
    else if( $topic_type == POST_TITLE_LINK )
    {
	   $topic_type = '<span style="color:'. $weblink_color .'">'. $lang['Topic_Weblink'] . ' </span>';
    }

    else if( $topic_type > POST_GLOBAL_ANNOUNCE)
    {
     while ($tt_row = $db->sql_fetchrow($result))
     {
     $row[] = $tt_row;
     $topic_type_color = '#'.$tt_row['topic_type_color'];
     $topic_type_name = '#'.$tt_row['topic_type_name'];
     }
     ///////////////////// End Lugsciath
      for($j = 0; $j < count($row); $j++ )
      {
        if( intval($topic_rowset[$i]['topic_type'] - POST_ADD_TYPE) == $row[$j]['topic_type_order'])
        {
        $topic_type ='<span style="color:#'. $row[$j]['topic_type_color'] .'">'. $row[$j]['topic_type_name'] .':</span>';
        }
      }
    }
    // END Advanced Topic Type MOD
find

Code: Select all

else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
			{
				$folder = $images['folder_locked'];
				$folder_new = $images['folder_locked_new'];
			}
after, add

Code: Select all

            // BEGIN Advanced Topic Type MOD
            else if( $topic_rowset[$i]['topic_type'] >= POST_ADD_TYPE)
            {
              if( $row[$i]['topic_type_image'] != '' )
                {
                $folder = $row[$i]['topic_type_image'];
                $folder_new = $row[$i]['topic_type_image_new'];
                }
              else
                {
              $folder = $images['folder_topic_type'];
	          $folder_new = $images['folder_topic_type_new'];
                }
            }
            // END Advanced Topic Type MOD
See above that only a = (equal) was added.
okay, here is part II

posting.php

find

Code: Select all

if ( $mode == 'editpost' && ( ( $is_auth['auth_delete'] && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $is_auth['auth_mod'] ) )
{
	$template->assign_block_vars('switch_delete_checkbox', array());
}
after add

Code: Select all

// BEGIN Advanced Topic Type MOD

//
// Topic type selection
//
$topic_type_toggle = '';
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
{
  $template->assign_block_vars('switch_type_toggle', array());

   $topic_type_toggle .= '<select name="topictype">';
   $topic_type_toggle .= '<option value="'. POST_NORMAL .'"' . ( ( $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL ) ? ' selected' : '' ) . '>'. $lang['Post_Normal'] .'</option>';


	if( ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD ) && $is_auth['auth_post'] )
	{
        $topic_type_toggle .= '<option value="' . POST_TITLE_LINK . '"';
		if ( $post_data['topic_type'] == POST_TITLE_LINK || $topic_type == POST_TITLE_LINK )
		{
            $topic_type_toggle .= ' selected';
		}
        $topic_type_toggle .= '>'. $lang['Post_Weblink'] . '</option>';
	}
//eingefügt von Mod , eigentlich nur radios gegen liste

  if( $is_auth['auth_sticky'] )
  {
    $topic_type_toggle .= '<option value="' . POST_STICKY . '"';
    if ( $post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY )
    {
      $topic_type_toggle .= ' selected';
    }
    $topic_type_toggle .= '>'. $lang['Post_Sticky'] . '</option>';
  }

  if( $is_auth['auth_announce'] )
  {
    $topic_type_toggle .= '<option value="' . POST_ANNOUNCE . '"';
    if ( $post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE )
    {
      $topic_type_toggle .= ' selected';
    }
    $topic_type_toggle .= '>'. $lang['Post_Announcement'] . '</option>';
  }
Please remember: I got a really lot of mods, you have to search for the right place - and maybe it doesnt work.

One Thing: The Announcement and sticky´s are untouched, the mod doesnt work very well - but it is really nice and i hope and think, it will be modded further.

lugsciath
Registered User
Posts: 316
Joined: Tue Oct 02, 2007 11:12 am

Re: [RC] Advanced Topic Type

Post by lugsciath » Wed Oct 03, 2007 10:47 am

okay Folks,

Time for a update. Now i got a little problem with the images, but it is solved. All Changes are well if you take my modifikation , otherwise you have to change the similiar passages ;-)

Step 1: Please save your original files! I dont know your system and i dont make any warranty for function of these hacks on your system ! My board is a phpBB2 subSilver 2.022 with a lot of mods, so it will be some different to yours (but never mind: try it or change it in a similiar way if you have a backup!).

open viewforum.php

find:

Code: Select all

        $topic_type ='<span style="color:#'. $row[$j]['topic_type_color'] .'">'. $row[$j]['topic_type_name'] .':</span>';
add after

Code: Select all

              if( $row[$j]['topic_type_image'] != '' )
                {
                $folder = $row[$j]['topic_type_image'];
                $folder_new = $row[$j]['topic_type_image_new'];
                }
              else
                {
              $folder = $images['folder_topic_type'];
	          $folder_new = $images['folder_topic_type_new'];
                }
(i put this part in the part above, the var $row[$i] doesnt work, so i take the var [$j] above ... ;-) )

find

Code: Select all

// BEGIN Advanced Topic Type MOD
            else if( $topic_rowset[$i]['topic_type'] >= POST_ADD_TYPE)
            {
              if( $row[$i]['topic_type_image'] != '' )
                {
                $folder = $row[$i]['topic_type_image'];
                $folder_new = $row[$i]['topic_type_image_new'];
                }
              else
                {
              $folder = $images['folder_topic_type'];
             $folder_new = $images['folder_topic_type_new'];
                }
replace it with:

nothing.

find (beneath this part directly)

Code: Select all

			else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
			{
				$folder = $images['folder_locked'];
				$folder_new = $images['folder_locked_new'];
			}
else
find in line

Code: Select all

else
replace it with

Code: Select all

			else if( $topic_rowset[$i]['topic_type'] < POST_ADD_TYPE )

open admin/admin_topic_type.php

find

Code: Select all

 if( $row['topic_type_image'] != '' )
  {
    $tt_image = $phpbb_root_path . $row['topic_type_image'] ;
  }
[code]

replace it with

[code]
  if( $row['topic_type_image'] != '' )
  {
    $tt_image = $row['topic_type_image'] ;
  }
Thats all.

All you have to do now is to put in the real full path (with url) to your topic image into the admin panel

e.g.

WRONG: /templates/subSilver/phpBB/images/whateveryouwant.gif
RIGHT: http://www.yourdomainrighthere.com/phpB ... ouwant.gif

;-)

Have fun. The other bug with the last topic isn´t really solved, but personally i´ve solved tomporarely in this way:

Make a Topic with title "END OF LIST - DO NOT ENTER THIS!" and sign it in the Admin panel as "Top". Than you only have to change the sorting that this topic is last (on bottom of the list) with use for all (importend!)
. So it wont be really available and your users have to choose something above it. See: All functions are keep going ;-) ... but if i found this little bug, i will report it as soon as possible.

More Questions? Please feel free to mail me (as content: phpBB2, my spamprotection is sometimes strong).

Greetings

Uwe

Edit: Sorry, i forgot the upper part of code, i add it :-) for function

lugsciath
Registered User
Posts: 316
Joined: Tue Oct 02, 2007 11:12 am

Re: [RC] Advanced Topic Type

Post by lugsciath » Wed Oct 03, 2007 5:02 pm

hi Folks,

update #2

in viewtopic.php

a little correction for weblink mod

find:

Code: Select all

// BEGIN Advanced Topic Type MOD
    //////////////////////////////////////////////////////////////////////////////////////
    // little bugfix by lugsciath - without any warranty                                //
    // the bug is very easy: only sticky and announce will be counted - that´s the bug. //
    // just do it without any borders and see: it works.                                //
    //////////////////////////////////////////////////////////////////////////////////////

    $sql = "SELECT * FROM ". TOPIC_ADD_TYPE_TABLE ."";

    if ( !($result = $db->sql_query($sql)) )
    {
      message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
    }

    if( $topic_type == POST_ANNOUNCE )
    {
      $topic_type = '<span style="color:'. $announce_color .'">'. $lang['Topic_Announcement'] . ' </span>';
    }
    else if( $topic_type == POST_STICKY )
    {
      $topic_type = '<span style="color:'. $sticky_color .'">'. $lang['Topic_Sticky'] . ' </span>';
    }
    else if( $topic_type == POST_TITLE_LINK )
    {
      $topic_type = '<span style="color:'. $weblink_color .'">'. $lang['Topic_Weblink'] . ' </span>';
    }

    else if( $topic_type > POST_GLOBAL_ANNOUNCE)
    {
     while ($tt_row = $db->sql_fetchrow($result))
     {
     $row[] = $tt_row;
     $topic_type_color = '#'.$tt_row['topic_type_color'];
     $topic_type_name = '#'.$tt_row['topic_type_name'];
     }
     ///////////////////// End Lugsciath
      for($j = 0; $j < count($row); $j++ )
      {
        if( intval($topic_rowset[$i]['topic_type'] - POST_ADD_TYPE) == $row[$j]['topic_type_order'])
        {
        $topic_type ='<span style="color:#'. $row[$j]['topic_type_color'] .'">'. $row[$j]['topic_type_name'] .':</span>';
        }
      }
    }
    // END Advanced Topic Type MOD



replace it through

Code: Select all

    if( $topic_type == POST_ANNOUNCE )
    {
      $topic_type = '<span style="color:'. $announce_color .'">'. $lang['Topic_Announcement'] . ' </span>';
    }
    else if( $topic_type == POST_STICKY )
    {
      $topic_type = '<span style="color:'. $sticky_color .'">'. $lang['Topic_Sticky'] . ' </span>';
    }
    else if( $topic_type == POST_TITLE_LINK )
    {
	   $topic_type = '<span style="color:'. $weblink_color .'">'. $lang['Topic_Weblink'] . ' </span>';
    }

    // BEGIN Advanced Topic Type MOD
    //////////////////////////////////////////////////////////////////////////////////////
    // little bugfix by lugsciath - without any warranty                                //
    // the bug is very easy: only sticky and announce will be counted - that´s the bug. //
    // just do it without any borders and see: it works.                                //
    //////////////////////////////////////////////////////////////////////////////////////
//    $sql = "SELECT * FROM ". TOPIC_ADD_TYPE_TABLE ." WHERE `topic_type_id` > '0';";
    $sql = "SELECT * FROM ". TOPIC_ADD_TYPE_TABLE ."";
    if ( !($result = $db->sql_query($sql)) )
    {
      message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
    }

//    else if( $topic_type > POST_GLOBAL_ANNOUNCE)
    else if( $topic_type > POST_TITLE_LINK)
    {
     while ($tt_row = $db->sql_fetchrow($result))
     {
     $row[] = $tt_row;
     $topic_type_color = '#'.$tt_row['topic_type_color'];
     $topic_type_name = '#'.$tt_row['topic_type_name'];
     }
     ///////////////////// End Lugsciath
      for($j = 0; $j < count($row); $j++ )
      {
        if( intval($topic_rowset[$i]['topic_type'] - POST_ADD_TYPE) == $row[$j]['topic_type_order'])
        {
        $topic_type ='<span style="color:#'. $row[$j]['topic_type_color'] .'">'. $row[$j]['topic_type_name'] .':</span>';
/*            // BEGIN Advanced Topic Type MOD
            else if( $topic_rowset[$i]['topic_type'] >= POST_ADD_TYPE)
            {
              if( $row[$i]['topic_type_image'] != '' )
                {
                $folder = $row[$i]['topic_type_image'];
                $folder_new = $row[$i]['topic_type_image_new'];
                }
              else
                {
              $folder = $images['folder_topic_type'];
	          $folder_new = $images['folder_topic_type_new'];
                }
            }
            // END Advanced Topic Type MOD
*/
              if( $row[$j]['topic_type_image'] != '' )
                {
                $folder = $row[$j]['topic_type_image'];
                $folder_new = $row[$j]['topic_type_image_new'];
                }
              else
                {
              $folder = $images['folder_topic_type'];
	          $folder_new = $images['folder_topic_type_new'];
                }
        }
      }
    }
    // END Advanced Topic Type MOD

find

Code: Select all

  	else
	{
		$topic_type = '';
	}
Replace with nothing. This is importend for Weblink mod.

If you have the weblink

in constants.php

find

Code: Select all

define('POST_TITLE_LINK', 99);
replace with

Code: Select all

define('POST_TITLE_LINK', 4);
You have to set the given topic_types for weblinks in your sql database Topics_table from set 99 set it to 4 and change all topics with 99 (or less upt to 95) in topics_table to topic_type 4.

In postings.php

find

Code: Select all

$all_topic_types = array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE);
replace it with

Code: Select all

$all_topic_types = array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE, POST_TITLE_LINK, POST_GLOBAL_ANNOUNCE);
[code]

lugsciath
Registered User
Posts: 316
Joined: Tue Oct 02, 2007 11:12 am

Re: [RC] Advanced Topic Type

Post by lugsciath » Thu Oct 04, 2007 7:52 pm

Hi Folks,

update #4

just fixes a bug that made a leading "0" for topics, belonging on a empty topic_type with this number (simple Topics got the type 0):

viewtopic.php

find

Code: Select all

		$replies = $topic_rowset[$i]['topic_replies'];
		$topic_type = $topic_rowset[$i]['topic_type'];
add, after

if( $topic_type == '0')$topic_type = '';
above should be single quotes at end of the line with no space between - shown in that way: ' '

Thats it - all works fine for me - and i hope, for you too, now i have more than a handful of new topics in different colors ;-) ... and all seams fine, greetings to poupone: You did a great job, i think the bug where only structure change newer modifications and some kind of not participiating softwareroutines. So Folks: Please try and do someting programming at your self... now it should work in similiar systems.

Feel free to ask me in english - or in german as a second possibility. The mod is working well.

Fragt mich in englisch oder in deutsch als zweite Möglichkeit ;-). Das Tool funktioniert.

User avatar
bamavamp
Registered User
Posts: 62
Joined: Wed Jan 24, 2007 5:13 am
Location: sweet home alabama

Re: [RC] Advanced Topic Type

Post by bamavamp » Sat Dec 08, 2007 5:49 am

Well I thought it was gonna work until I got this error

Parse error: syntax error, unexpected $end in /home/andreapk/public_html/posting.php on line 1160

Apparently something in the posting.php isn't working with my setup.

Something you need to fix in your above notes...everywhere you have to edit viewtopic it should be viewforum no?

I guess I will wait til a full updated version comes out or until someone else publishes one, thanks for trying.

lugsciath
Registered User
Posts: 316
Joined: Tue Oct 02, 2007 11:12 am

Re: [RC] Advanced Topic Type

Post by lugsciath » Sun Dec 09, 2007 4:51 pm

Hi bamavamp,

you´ve right: "$replies = $topic_rowset[$i]['topic_replies']" and so on is to edit in VIEWFORUM.PHP, my fault - i´m sorry.

This error:

unexpected $end in /home/andreapk/public_html/posting.php on line 1160

expired sometimes, if you uploading a file at the same time you log into the board/work into the board. This file may just "halfready" loaded until this Position ;) ... it´s NOT a failure, it´s a natural "undone" thing. ;)

Otherwise you could eventually forget a closing semicolon, or slash oder something else on the end of a row - or the position may different (a loop?), through modding. Just send me via pm the source :) ... i take a look on it and try to search the matching position for you, ok? :)

Post Reply

Return to “[2.0.x] MODs in Development”