Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Pre Formatted Thread
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Pre Formatted Thread
This is useful if we want our member to provide some info when they create a thread in a specified forum.
In this simple example, we will set a forum so when a member create a new thread in that forum, they need to fill a field with their Website URL, which is required, and optionally, they can fill a field with they Forum URL, which is not required.

Here is the simple setting for our XThreads:

1. XThreads Options in Forum settings:
  • Template Prefix: intro_
  • Show first post on every showthread page: Yes
2. Create a Custom Thread Fields with this settings:
  • Title: Your Website URL
  • Key: wwwurl
  • Description: Fill the field with your full site URL (required).
  • Applicable Forums: 'select a forum that we want the fields to be applied'
  • Input Field Type: Textbox
  • Editable by / Required Field?: Everyone (Required)
  • Display Format:

    HTML Code
    <strong>Website URL: {VALUE}</strong><br />

3. Create another Custom Thread Fields with this settings:
  • Title: Your Forum URL
  • Key: forumurl
  • Description: Fill the field with your full forum url (not required).
  • Applicable Forums: 'select the same as the forum in point 2'
  • Input Field Type: Textbox
  • Editable by / Required Field?: Everyone
  • Display Order: 2
  • Blank Replacement Value:

    HTML Code
    <strong>Forum URL: None</strong><br />

  • Display Format:

    HTML Code
    <strong>Forum URL: {VALUE}</strong><br />

4. Create a new template in Global Template:
  • Template Name: intro_postbit_first
  • Template Content:

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    {$ignore_bit}
    <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
    	<tbody>
    		<tr>
    			<td class="tcat">
    				<div class="float_left smalltext">
    					{$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
    				</div>
    				{$post['posturl']}
    			</td>
    		</tr>
    
    		<tr>
    			<td class="trow1 {$unapproved_shade}">
    				<table cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
    					<tr>
    						<td class="post_avatar" width="1" style="{$post['avatar_padding']}">
    							{$post['useravatar']}
    						</td>
    						<td class="post_author">
    							<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
    							<span class="smalltext">
    								{$post['usertitle']}<br />
    								{$post['userstars']}
    								{$post['groupimage']}
    							</span>
    						</td>
    						<td class="smalltext post_author_info" width="165">
    							{$post['user_details']}
    						</td>
    					</tr>
    				</table>
    			</td>
    		</tr>
    
    		<tr>
    			<td class="trow2 post_content {$unapproved_shade}">
    				<span class="smalltext"><strong>{$post['icon']}{$post['subject']} {$post['subject_extra']}</strong></span>
    
    				<div class="post_body" id="pid_{$post['pid']}">
    					{$GLOBALS['threadfields']['wwwurl']}{$GLOBALS['threadfields']['forumurl']}{$post['message']}
    				</div>
    				{$post['attachments']}
    				{$post['signature']}
    
    				<div class="post_meta" id="post_meta_{$post['pid']}">
    				{$post['iplogged']}
    				</div>
    			</td>
    		</tr>
    
    		<tr>
    			<td class="trow1 post_buttons {$unapproved_shade}">
    				<div class="author_buttons float_left">
    					{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}
    				</div>
    				<div class="post_management_buttons float_right">{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
    				</div>
    			</td>
    		</tr>
    	</tbody>
    </table>

    The template above based on the default postbit template. If we have a custom postbit template, copy paste the template content into intro_postbit_first template. Then add {$GLOBALS['threadfields']['wwwurl']} and {$GLOBALS['threadfields']['forumurl']} variables into the template.

  • Template Name: intro_postbit_first_classic
  • Template Content:

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    {$ignore_bit}
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
    	<tr>
    		<td class="{$altbg}" width="15%" valign="top" style="white-space: nowrap; text-align: center;"><a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
    		<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
    		<span class="smalltext">
    			{$post['usertitle']}<br />
    			{$post['userstars']}
    			{$post['groupimage']}
    			{$post['useravatar']}<br />
    			{$post['user_details']}
    		</span>
    	</td>
    	<td class="{$altbg}" valign="top">
    		<table width="100%">
    			<tr><td>{$post['posturl']}<span class="smalltext"><strong>{$post['icon']}{$post['subject']} {$post['subject_extra']}</strong></span>
    			<br />
    			<div id="pid_{$post['pid']}" style="padding: 5px 0 5px 0;">
    				{$GLOBALS['threadfields']['wwwurl']}{$GLOBALS['threadfields']['forumurl']}{$post['message']}
    			</div>
    			{$post['attachments']}
    			{$post['signature']}
    			<div style="text-align: right; vertical-align: bottom;" id="post_meta_{$post['pid']}">
    				<div id="edited_by_{$post['pid']}">{$post['editedmsg']}</div>
    				{$post['iplogged']}
    			</div>
    		</td></tr>
    	</table>
    </td>
    </tr>
    <tr>
    	<td class="{$altbg}" style="white-space: nowrap; text-align: center; vertical-align: middle;"><span class="smalltext">{$post['postdate']} {$post['posttime']}</span></td>
    	<td class="{$altbg}" style="vertical-align: middle;">
    		<table width="100%" border="0" cellpadding="0" cellspacing="0">
    			<tr valign="bottom">
    				<td align="left" ><span class="smalltext">{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}</span></td>
    				<td align="right">{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}</td>
    			</tr>
    		</table>
    	</td>
    </tr>
    </table>

    Again, the template above based on the default postbit_classic template. If we have a custom postbit_classic template, copy paste the template content into intro_postbit_first_classic template. Then add {$GLOBALS['threadfields']['wwwurl']} and {$GLOBALS['threadfields']['forumurl']} variables into the template.

    Please remember that the key for this is, adding {$GLOBALS['threadfields']['wwwurl']} and {$GLOBALS['threadfields']['forumurl']} variables into the intro_postbit_first and/or intro_postbit_first_classic template.


Screenshots:

1. A member create a new thread in a specified forum:

[Image: xc7x8m.jpg]

2. Result (Horizontal postbit layout):

[Image: 2v2igq8.jpg]

3. Result (Classic postbit layout):

[Image: 10xeovp.jpg]

4. Error message will be displayed when they didn't fill the "Website URL" field (required field):

[Image: 33w8go1.jpg]

(This post was last modified: 04-27-2010 07:48 AM by RateU.)
04-26-2010 07:26 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Pre Formatted Thread
Erk, damn permissions.  Hopefully that's fixed now - you should be able to post in this forum.

Thanks a lot for the guide RateU Smile  Nice and easy to follow!

My Blog
04-26-2010 08:38 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #3
RE: Pre Formatted Thread
Biggrin
Thanks, Yumi Smile

04-27-2010 07:47 AM
Find all posts by this user Quote this message in a reply
Skiilz Offline
Member
***
Posts: 198
Joined: Nov 2010
Post: #4
RE: Pre Formatted Thread
How can I add the format to thread box instead of adding new fields to the thread? Like.. Instead of the "This is my Introduction" we will add some info like:

"Site:
Name:
E-Mail:"

Then  the user complete the info and submit.

Is this possible?
- Sorry for bumping this thread.

[Image: 468x602b.png]
(This post was last modified: 11-16-2010 07:20 AM by Skiilz.)
11-16-2010 07:19 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #5
RE: Pre Formatted Thread
That's a bit different to what this thread is about.

Just set a template prefix for the forum, then copy your newthread template as prefix_newthread and then edit the <textarea> tag to stick in whatever default you want.

My Blog
11-16-2010 08:13 AM
Find all posts by this user Quote this message in a reply
Skiilz Offline
Member
***
Posts: 198
Joined: Nov 2010
Post: #6
RE: Pre Formatted Thread
That worked Smile Thanks.

[Image: 468x602b.png]
11-16-2010 09:01 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #7
RE: Pre Formatted Thread
Actually, sorry, thinking about it, that may be a bad idea because text may stuff up in Preview Post / post errors.
Probably better off with using Template Conditionals, replace {$message} with:

Code:
<if $message || $message === '0' then>{$message}<else> stick your stuff in here </if>


My Blog
(This post was last modified: 11-16-2010 09:16 AM by ZiNgA BuRgA.)
11-16-2010 09:14 AM
Find all posts by this user Quote this message in a reply
Skiilz Offline
Member
***
Posts: 198
Joined: Nov 2010
Post: #8
RE: Pre Formatted Thread
Thank you for the heads up. Changed the {$message}.

[Image: 468x602b.png]
11-17-2010 02:08 AM
Find all posts by this user Quote this message in a reply
ATNwebdesign Offline
Junior Member
**
Posts: 4
Joined: Mar 2011
Post: #9
RE: Pre Formatted Thread
Hey ZiNgA BuRgA

I love this plugin! I want users to be able to upload an image which will be included with the reformatted thread.

How can I do this? I tried to set my plugin settings to:
name:imgone
input type:file
valid file extensions:blank
capture tab key: yes
only accept image files: yes
Display Format:<img src="{URL}" alt="{FILENAME}">

and my intro_firstbit_first and classic templates have this:
<div class="post_body" id="pid_{$post['pid']}">
  {$GLOBALS['threadfields']['imgone']}{$post['message']}

Any ideas?

Thanks Biggrin
(This post was last modified: 03-06-2011 08:33 AM by ATNwebdesign.)
03-06-2011 08:30 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #10
RE: Pre Formatted Thread
There is an explanation about how adding image upload field:
http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=286&pid=14

03-06-2011 08:46 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: