Sub Menu
Links Menu
Online Users

In total there are 318 users online :: 2 registered, 0 hidden and 316 guests

Most users ever online was 1091 on Wed Aug 16, 2023 5:27 pm

Registered users: Bing [Bot], Google [Bot] based on users active over the past 60 minutes

Need help with IM141 and mod Add extra field to post

Support for IntegraMOD 141

Moderator: Integra Moderator

Need help with IM141 and mod Add extra field to post

PostAuthor: arutha » Sun May 15, 2011 12:52 pm

Good day.

I have IM 141.

I want to use Mod "New field to posting part". I`ve done everything just as written in text below, but extra text appears only in preview mode, not in viewtopic and viewforum.

Please, could anyone help and tell why?

Code: Select all
#########################################################################################
##
## MOD Title:     New field to posting part
## MOD Version:   1.4.2 (phpBB 2.0.5 - 2.0.10)
## Author:        Acid
##
## Description:   Just a simple way to add a new field to the posting area. "extra" can
##        be changed to "whatever" of course but be aware of the spelling (e.g.
##        "EXTRA", "extra", "topic_extra").
##        If you want to add more than one field duplicate the following steps
##        and change "extra" to "whatever" (be aware of the spelling).
##        The field "extra" is just an example.
##        The new field will be displayed above the post (post view) and below
##        topic title (topic view).
##
## Files to edit: 11
##                language/lang_english/lang_main.php
##                includes/functions_post.php
##                includes/topicreview.php
##                posting.php
##                viewtopic.php
##                viewforum.php
##                templates/xxx/posting_body.tpl
##                templates/xxx/posting_preview.tpl
##                templates/xxx/posting_topic_review.tpl
##                templates/xxx/viewtopic_body.tpl
##                templates/xxx/viewforum_body.tpl
##
#########################################################################################
##
## Note:
## First always make a backup from the files/database that you're going to edit.
##
## This MOD adds one new column to the tables "posts" and "topics".
##
#########################################################################################
##
## Versions:
##
## 1.4.2 - optional part ("forums and users", "info is mandatory", "search for info" and
##      "dropdown instead input") altered
##    - "an_option" removed again (it?s a separate MOD now)
## 1.4.1 - optional part "search for info" updated (missed some code and code was wrong)
##    - an_option.zip added (simple explanation how to add an option)
## 1.4.0 - guides rewritten
##    - optional part added ("info in notification", "forums and users", "info is
##      mandatory")
## 1.2.1 - missed a sql query for optional part ("search for info")
## 1.2.0 - optional part added ("dropdown instead input", "info in modcp", "info in
##      search", "search for info"),
##    - template alteration changed, preview code altered
## 1.0.2 - fixed a typo in posting.php (edit display)
## 1.0.1 - fixed some language/template bugs
## 1.0   - Release
##
#########################################################################################
#
#-----[ SQL ]-------------------------------------------

# You have to execute the following queries via phpmyadmin (change prefix)..

ALTER TABLE phpbb_topics ADD topic_extra CHAR(60) NOT NULL AFTER topic_title;
ALTER TABLE phpbb_posts_text ADD post_extra VARCHAR(60) DEFAULT NULL AFTER post_subject;

# ..if you?re going to add/change several fields duplicate the above queries and
# change the column name "topic_extra"/"post_extra".
#
#########################################################################################
#
#-----[ OPEN ]--------------------------------------------------
#
# language/lang_english/lang_main.php
#
#-----[ FIND ]--------------------------------------------------
#
//
// Posting/Replying (Not private messaging!)
//

#
#-----[ BELOW ADD ]--------------------------------------------------
#
$lang['Extra_information'] = 'Extra Information';


#
#-----[ OPEN ]--------------------------------------------------
#
# includes/functions_post.php
#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
function prepare_post(&$mode, &$post_data

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
&$subject

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, &$extra

#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
function submit_post($mode, &$post_data

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
&$post_subject

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, &$post_extra

#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
   $sql  = ( $mode != "editpost" ) ? "INSERT INTO " . TOPICS_TABLE . "

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
topic_title

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, topic_extra

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
'$post_subject'

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, '$post_extra'

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
topic_title = '$post_subject'

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, topic_extra = '$post_extra'

#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
   $sql = ( $mode != 'editpost' ) ? "INSERT INTO " . POSTS_TEXT_TABLE . "

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
post_subject

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, post_extra

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
'$post_subject'

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, '$post_extra'

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
post_subject = '$post_subject'

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, post_extra = '$post_extra'



#
#-----[ OPEN ]--------------------------------------------------
#
# includes/topicreview.php
#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
   $sql = "SELECT u.username, u.user_id, p.*

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
pt.post_subject

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, pt.post_extra

#
#-----[ FIND ]--------------------------------------------------
#
         $post_subject = ( $row['post_subject'] != '' ) ? $row['post_subject'] : '';

#
#-----[ BELOW ADD ]--------------------------------------------------
#
         $post_extra = ( $row['post_extra'] != '' ) ? '<b>'. $lang['Extra_information'] .': </b> '. $row['post_extra'] : '';

#
#-----[ FIND ]--------------------------------------------------
#
            $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);

#
#-----[ BELOW ADD ]--------------------------------------------------
#
            $post_extra = preg_replace($orig_word, $replacement_word, $post_extra);

#
#-----[ FIND ]--------------------------------------------------
#
            'POST_SUBJECT' => $post_subject,

#
#-----[ BELOW ADD ]--------------------------------------------------
#
            'POST_EXTRA' => $post_extra,


#
#-----[ OPEN ]--------------------------------------------------
#
# posting.php
#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
      $select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
pt.post_subject

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, pt.post_extra

#
#-----[ FIND ]--------------------------------------------------
#
         $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : '';

#
#-----[ BELOW ]--------------------------------------------------
#
         $extra = ( !empty($HTTP_POST_VARS['extra']) ) ? trim($HTTP_POST_VARS['extra']) : '';

#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
         prepare_post($mode, $post_data

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
$subject

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, $extra

#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
            submit_post($mode, $post_data

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
str_replace("'", "''", $subject)

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, str_replace("'", "''", $extra)

#
#-----[ FIND ]--------------------------------------------------
#
   $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['subject']))) : '';

#
#-----[ BELOW ADD ]--------------------------------------------------
#
   $extra = ( !empty($HTTP_POST_VARS['extra']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['extra']))) : '';

#
#-----[ FIND ]--------------------------------------------------
#
      $preview_subject = $subject;

#
#-----[ BELOW ADD ]--------------------------------------------------
#
      $preview_extra = ( !empty($HTTP_POST_VARS['extra']) ) ? '<b>'. $lang['Extra_information'] .':</b> '. $extra : '';

#
#-----[ FIND ]--------------------------------------------------
#
         $preview_subject = ( !empty($subject) ) ? preg_replace($orig_word, $replacement_word, $preview_subject) : '';

#
#-----[ BELOW ADD ]--------------------------------------------------
#
         $preview_extra = ( !empty($extra) ) ? preg_replace($orig_word, $replacement_word, $preview_extra) : '';

#
#-----[ FIND ]--------------------------------------------------
#
         'TOPIC_TITLE' => $preview_subject,
         'POST_SUBJECT' => $preview_subject,

#
#-----[ BELOW ADD ]--------------------------------------------------
#
         'TOPIC_EXTRA' => $preview_extra,
         'POST_EXTRA' => $preview_extra,

#
#-----[ FIND (2x) ]--------------------------------------------------
#
      $subject = '';

#
#-----[ always BELOW ADD ]--------------------------------------------------
#
      $extra = '';

#
#-----[ FIND ]--------------------------------------------------
#
      $subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject'];

#
#-----[ BELOW ADD ]--------------------------------------------------
#
      $extra = $post_info['post_extra'];

#
#-----[ FIND ]--------------------------------------------------
#
            $subject = ( !empty($subject) ) ? preg_replace($orig_word, $replace_word, $subject) : '';

#
#-----[ BELOW ADD ]--------------------------------------------------
#
            $extra = ( !empty($extra) ) ? preg_replace($orig_word, $replace_word, $extra) : '';

#
#-----[ FIND ]--------------------------------------------------
#
   'SUBJECT' => $subject,

#
#-----[ BELOW ADD ]--------------------------------------------------
#
   'EXTRA' => $extra,
   'L_EXTRA' => $lang['Extra_information'],


#
#-----[ OPEN ]--------------------------------------------------
#
# viewtopic.php
#
#-----[ FIND (just a quote) ]--------------------------------------------------
#
$sql = "SELECT u.username, u.user_id

#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
pt.post_subject

#
#-----[ IN-LINE ADD ]--------------------------------------------------
#
, pt.post_extra

#
#-----[ FIND ]--------------------------------------------------
#
   $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : '';

#
#-----[ BELOW ADD ]--------------------------------------------------
#
   $post_extra = ( $postrow[$i]['post_extra'] != '' ) ? '<b>'. $lang['Extra_information'] .': </b> '. $postrow[$i]['post_extra'] : '';

#
#-----[ FIND ]--------------------------------------------------
#
      $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);

#
#-----[ BELOW ADD ]--------------------------------------------------
#
      $post_extra = preg_replace($orig_word, $replacement_word, $post_extra);

#
#-----[ FIND ]--------------------------------------------------
#
      'POST_SUBJECT' => $post_subject,

#
#-----[ BELOW ADD ]--------------------------------------------------
#
      'POST_EXTRA' => $post_extra,


#
#-----[ OPEN ]--------------------------------------------------
#
# viewforum.php
#
#-----[ FIND ]--------------------------------------------------
#
      $topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];

#
#-----[ BELOW ADD ]--------------------------------------------------
#
      $topic_extra = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_extra']) : $topic_rowset[$i]['topic_extra'];

#
#-----[ FIND ]--------------------------------------------------
#
         'TOPIC_TITLE' => $topic_title,

#
#-----[ BELOW ADD ]--------------------------------------------------
#
         'TOPIC_EXTRA' => ( !empty($topic_rowset[$i]['topic_extra']) ) ? '<br>'. $topic_extra : '',


#
#-----[ OPEN ]--------------------------------------------------
#
# templates/xxx/posting_body.tpl
#
#-----[ FIND ]--------------------------------------------------
#
   <tr>
     <td><span><b>{L_SUBJECT}</b></span></td>
     <td> <span>
      <input>
      </span> </td>
   </tr>

#
#-----[ BELOW ADD ]--------------------------------------------------
#
   <BEGIN>
   <tr>
     <td><span><b>{L_EXTRA}</b></span></td>
     <td> <input></td>
   </tr>
   <END>


#
#-----[ OPEN ]--------------------------------------------------
#
# templates/xxx/posting_preview.tpl
#
#-----[ FIND ]--------------------------------------------------
#
      <td><table>

#
#-----[ BELOW ADD ]--------------------------------------------------
#
         <tr>
            <td><span>{POST_EXTRA}</span></td>
         </tr>


#
#-----[ OPEN ]--------------------------------------------------
#
# templates/xxx/posting_topic_review.tpl
#
#-----[ FIND ]--------------------------------------------------
#
         <tr>
            <td><hr></td>
         </tr>

#
#-----[ BELOW ADD ]--------------------------------------------------
#
         <tr>
            <td><span>{postrow.POST_EXTRA}</span></td>
         </tr>


#
#-----[ OPEN ]--------------------------------------------------
#
# templates/xxx/viewtopic_body.tpl
#
#-----[ FIND ]--------------------------------------------------
#
         <tr>
            <td><hr></td>
         </tr>

#
#-----[ BELOW ADD ]--------------------------------------------------
#
         <tr>
            <td><span>{postrow.POST_EXTRA}</span></td>
         </tr>


#
#-----[ OPEN ]--------------------------------------------------
#
# templates/xxx/viewforum_body.tpl
#
#-----[ FIND ]--------------------------------------------------
#
{topicrow.TOPIC_TITLE}</a></span><span>

#
#-----[ AFTER ADD (before <br>) ]--------------------------------------------------
#
{topicrow.TOPIC_EXTRA}

#########################################################################################
#########################################################################################
#########################################################################################

arutha
Newbie
Newbie
 
Posts: 7
Likes: 0 post
Liked in: 0 post
Joined: Wed Mar 31, 2010 4:38 am
Cash on hand: 0.00

Re: Need help with IM141 and mod Add extra field to post

PostAuthor: Helter » Sun May 15, 2011 6:10 pm

I edited it for use with IM141
Always use Protection
Image


Please do not PM for support
User avatar
Helter
Administrator
Administrator
 
Posts: 4167
Likes: 0 post
Liked in: 0 post
Images: 0
Joined: Sat Mar 11, 2006 3:46 pm
Cash on hand: 172.60
Location: Seattle Wa
IntegraMOD version: IM 3


Return to IntegraMOD 141

Who is online

Registered users: Bing [Bot], Google [Bot]

cron