[BETA]Flavor text mod[updated to version 1.0.1]

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.
Cyberpunk
Registered User
Posts: 42
Joined: Sat Jun 26, 2004 12:25 pm
Location: Desert of the Real
Contact:

[BETA]Flavor text mod[updated to version 1.0.1]

Post by Cyberpunk »

Hello.This mod adds a personal(i call it flavor) text under poster's avatar.Like in YaBB for examle..
##############################################################
## MOD Title: Flavor text MOD
## MOD Author: Cyberpunk, http://www.phoenixrpg.com, cyberpunk@matrixmail.net
## MOD Description: This mod adds a flavor text for each user under their avatar
##
##
## MOD Version: 1.0.1
##
## Installation Level: Easy
## Installation Time: 10-15 Minutes
## Files To Edit: : admin/admin_board.php
## templates/subSilver/admin/board_config_body.tpl
## language/lang_english/lang_admin.php
## admin/admin_users.php
## templates/subSilver/admin/user_edit_body.tpl
## language/lang_english/lang_main.php
## includes/usercp_register.php
## includes/usercp_viewprofile.php
## includes/usercp_avatar.php
## templates/subSilver/profile_add_body.tpl
## templates/subSilver/profile_view_body.tpl
## viewtopic.php
## templates/subSilver/viewtopic_body.tpl
##
##
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes:
##
##############################################################
## MOD History:
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[SQL_QUERY]----------------------------------------
#
ALTER TABLE `phpbb_users` ADD `user_flavor_text` varchar(255) NULL;
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flavor_text_maxl', '255');

#where 'phpbb_' is your $table_prefix
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------
#
"L_ENABLE_GZIP" => $lang['Enable_gzip'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_FLAVOR_TEXT_SETTINGS" => $lang['Flavor_text_settings'],
"L_FLAVOR_TEXT_MAXL" => $lang['Flavor_text_maxl'],
"L_FLAVOR_TEXT_MAXL_EXPLAIN" => $lang['Flavor_text_maxl_explain'],
#
#-----[ FIND ]------------------------------------------
#
"GZIP_NO" => $gzip_no,
#
#-----[ AFTER, ADD ]------------------------------------------
#
"FLAVOR_TEXT_MAXL" => $new['flavor_text_maxl'],
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_ENABLE_PRUNE}</td>
<td class="row2"><input type="radio" name="prune_enable" value="1" {PRUNE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="prune_enable" value="0" {PRUNE_NO} /> {L_NO}</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<th class="thHead" colspan="2">{L_FLAVOR_TEXT_SETTINGS}</th>
</tr>
<tr>
<td class="row1">{L_FLAVOR_TEXT_MAXL}<br /><span class="gensmall">{L_FLAVOR_TEXT_MAXL_EXPLAIN}</span></td>
<td class="row2"><input type="text" name="flavor_text_maxl" value="{FLAVOR_TEXT_MAXL}" /></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
//
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// Flavor Text MOD
//
$lang['Flavor_text_settings'] = 'Flavor text settings';
$lang['Flavor_text_maxl'] = 'Maximum length';
$lang['Flavor_text_maxl_explain'] = 'How long the flavor text may be?Enter a number from 0 to 255';

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
$interests = ( !empty($HTTP_POST_VARS['interests']) ) ? trim(strip_tags( $HTTP_POST_VARS['interests'] ) ) : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = ( !empty($HTTP_POST_VARS['flavor_text']) ) ? trim(strip_tags( $HTTP_POST_VARS['flavor_text'] ) ) : '';
#
#-----[ FIND ]------------------------------------------
#
$interests = htmlspecialchars(stripslashes($interests));
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = htmlspecialchars(stripslashes($flavor_text));
#
#-----[ FIND ]------------------------------------------
#
# Find this in general
#
$sql = "UPDATE " . USERS
SET
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_interests = '" . str_replace("\'", "''", $interests) . "',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_flavor_text = '" . str_replace("\'", "''", $flavor_text) . "',
#
#-----[ FIND ]------------------------------------------
#
#Again!
#
$interests = htmlspecialchars(stripslashes($interests));
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = htmlspecialchars(stripslashes($flavor_text));
#
#-----[ FIND ]------------------------------------------
#
$interests = htmlspecialchars($this_userdata['user_interests']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = htmlspecialchars($this_userdata['user_flavor_text']);
#
#-----[ FIND ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="interests" value="' . str_replace("\"", """, $interests) . '" />';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="flavor_text" value="' . str_replace("\"", """, $flavor_text) . '" />';
#
#-----[ FIND ]------------------------------------------
#
'INTERESTS' => $interests,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'FLAVOR_TEXT' => $flavor_text,
#
#-----[ FIND ]------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_FLAVOR_TEXT' => $lang['Flavor_text'],
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_INTERESTS}</span></td>
<td class="row2">
<input class="post" type="text" name="interests" size="35" maxlength="150" value="{INTERESTS}" />
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_FLAVOR_TEXT}</span></td>
<td class="row2">
<input class="post" type="text" name="flavor_text" size="35" maxlength="255" value="{FLAVOR_TEXT}" />
</td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
//
#
#-----[ AFTER, ADD ]------------------------------------------
#

//
// Flavor Text Mod
//
$lang['Flavor_text'] = 'Flavor Text';
$lang['Flavor_text_long'] = 'Flavor text you entered was too long.';
$lang['Flavor_text_explain'] = 'Adds a flavor text to your posts under avatar. There is a %s character limit.';

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$strip_var_list = array(
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'interests' => 'interests'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, 'flavor_text' => 'flavor_text'
#
#-----[ FIND ]------------------------------------------
#
$signature = str_replace('<br />', "\n", $signature);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Check the length of the flavor text.
if (strlen($flavor_text) > $board_config['flavor_text_maxl'])
{
if ($flavor_text != addslashes($userdata['user_flavor_text'])) {
$flavor_text = addslashes($userdata['user_flavor_text']);
$error = TRUE;
if (isset($error_msg)) $error_msg .= '<br />';
$error_msg .= $lang['Flavor_text_long'];
}
}
#
#-----[ FIND ]------------------------------------------
#
$interests = stripslashes($interests);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = stripslashes($flavor_text);
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE
SET
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_interests = '" . str_replace("\'", "''", $interests) . "',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_flavor_text = '" . str_replace("\'", "''", $flavor_text) . "',
#
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . USERS
VALUES
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_interests,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_flavor_text,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
str_replace("\'", "''", $interests) . "', '" .
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
str_replace("\'", "''", $flavor_text) . "','" .
#
#-----[ FIND ]------------------------------------------
#
$interests = stripslashes($interests);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = stripslashes($flavor_text);
#
#-----[ FIND ]------------------------------------------
#
$interests = $userdata['user_interests'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = $userdata['user_flavor_text'];
#
#
#-----[ FIND ]------------------------------------------
#
display_avatar_gallery($
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$interests,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
$flavor_text,
#
#
#-----[ FIND ]------------------------------------------
#
'INTERESTS' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
'FLAVOR_TEXT' => $flavor_text,
'FLAVOR_TEXT_MAXL' => $board_config['flavor_text_maxl'],
#
#-----[ FIND ]------------------------------------------
#
'L_INTERESTS' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_FLAVOR_TEXT' => $lang['Flavor_text'],
'L_FLAVOR_TEXT_EXPLAIN' => sprintf($lang['Flavor_text_explain'], $board_config['flavor_text_maxl']),
#
#-----[ FIND ]------------------------------------------
#Yes, find it again
#
'INTERESTS' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
'FLAVOR_TEXT' => $flavor_text,
#
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
$rank_image = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = $profiledata['user_flavor_text'];
#
#
#-----[ FIND ]------------------------------------------
#
'RANK_IMAGE' => $rank_image,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'FLAVOR_TEXT' => $flavor_text,
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_avatar.phpl
#
#-----[ FIND ]------------------------------------------
#
function display_avatar_gallery($mode
#
#-----[ IN-LINE FIND ]------------------------------------------
#
&$interests,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
&$flavor_text,
#
#
#-----[ FIND ]------------------------------------------
#
$params = array('
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'interests',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'flavor_text',
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_INTERESTS}:</span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="interests" size="35" maxlength="150" value="{INTERESTS}" />
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#

<tr>
<td class="row1"><span class="gen">{L_FLAVOR_TEXT}:</span><br /><span class="gensmall">{L_FLAVOR_TEXT_EXPLAIN}</span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="flavor_text" size="45" maxlength="{FLAVOR_TEXT_MAXL}" value="{FLAVOR_TEXT}" />
</td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#
#-----[ IN-LINE FIND ]------------------------------------------
#
<span class="postdetails">{POSTER_RANK}
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<br /><i>"{FLAVOR_TEXT}"</i>
#
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
//
$sql = "SELECT u.
#
#-----[ IN-LINE FIND ]------------------------------------------
#
u.user_posts,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
u.user_flavor_text,
#
#-----[ FIND ]------------------------------------------
#
//
$poster_rank = '';
$rank_image = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$flavor_text = $postrow[$i]['user_flavor_text'];
#
#
#-----[ FIND ]------------------------------------------
#
'POSTER_NAME' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
'FLAVOR_TEXT' => $flavor_text,
#
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN postrow -->
<tr>
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}">
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_AVATAR}<br />
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<center><i>"{postrow.FLAVOR_TEXT}"</i></center>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


Tip:
In the last line of the mod
<center><i>"{postrow.FLAVOR_TEXT}"</i></center>

If a user has no flavor text it will display "" in the post.To avoid this just remove "" from the line.
It should be like this
<center><i>{postrow.FLAVOR_TEXT}</i></center>
Last edited by Cyberpunk on Mon Dec 13, 2004 7:34 pm, edited 3 times in total.

MaddoxX
Registered User
Posts: 450
Joined: Sat May 15, 2004 4:43 pm
Location: Russia

Post by MaddoxX »

Oh well do you have a demo board or screenshots?
:D

ayusuf
I've Been Banned!
Posts: 917
Joined: Fri Feb 06, 2004 11:00 pm
Location: Orlando,Fl
Contact:

Post by ayusuf »

Yes i would really like to see a demo or scrnshot.

Cyberpunk
Registered User
Posts: 42
Joined: Sat Jun 26, 2004 12:25 pm
Location: Desert of the Real
Contact:

Post by Cyberpunk »

Ok, here it is..
The flavor text in that case is:
"fear me mages, 'cause i'm coming to kill you" =))(RPG board :wink: )
In post:
http://www.phoenixrpg.com/forum/files/screenshot1.jpg
In profile:
http://www.phoenixrpg.com/forum/files/screenshot2.jpg

ayusuf
I've Been Banned!
Posts: 917
Joined: Fri Feb 06, 2004 11:00 pm
Location: Orlando,Fl
Contact:

Post by ayusuf »

oh this is nice. Did you find n e bugs yet?

Cyberpunk
Registered User
Posts: 42
Joined: Sat Jun 26, 2004 12:25 pm
Location: Desert of the Real
Contact:

Post by Cyberpunk »

Nope, i didn't...And as i tested it-it works just fine..

MaddoxX
Registered User
Posts: 450
Joined: Sat May 15, 2004 4:43 pm
Location: Russia

Post by MaddoxX »

This is gonna be a "WANTED" mod ... i'm going to install it !!!
btw you should check if it allows "ALL" characters..
:D

User avatar
Rookie7
Registered User
Posts: 189
Joined: Mon Mar 10, 2003 3:32 pm
Contact:

Post by Rookie7 »

Very good mod.

MaddoxX
Registered User
Posts: 450
Joined: Sat May 15, 2004 4:43 pm
Location: Russia

Post by MaddoxX »

If possible add this

When nobody enters a message there will be a "" make it so it won't show anything! Would be better for the layout ;x
:D

Cyberpunk
Registered User
Posts: 42
Joined: Sat Jun 26, 2004 12:25 pm
Location: Desert of the Real
Contact:

Post by Cyberpunk »

MaddoxX, done=).See second update..
And i belive there is a reason, why it is not allowed to use all characters:)..for example, we can get a way too long line that won't split up=(

MaddoxX
Registered User
Posts: 450
Joined: Sat May 15, 2004 4:43 pm
Location: Russia

Post by MaddoxX »

thanks!
:D

MaddoxX
Registered User
Posts: 450
Joined: Sat May 15, 2004 4:43 pm
Location: Russia

Post by MaddoxX »

Cyberpunk.. could you fix it if there is no flavor that there wouldn't be a open space? Removing the "" solves only that it won't display "" but there will be a open space? Could you code it so there will be no open space?
:D

Cyberpunk
Registered User
Posts: 42
Joined: Sat Jun 26, 2004 12:25 pm
Location: Desert of the Real
Contact:

Post by Cyberpunk »

Yeah, i'll take a look later...

User avatar
Smokeydogg
Registered User
Posts: 240
Joined: Sat Dec 06, 2003 8:02 am
Contact:

Post by Smokeydogg »

ok when they add there text it works

but if you go back to edit profile the text is gone

could you make it so it saves it and dont get rid of it

niksa
Registered User
Posts: 612
Joined: Mon Sep 08, 2003 7:20 pm
Location: Future birthplace of James T. Kirk
Contact:

Post by niksa »

I don't have the problem Smokeydogg described, it appears that my version is running smoothly. :twisted:

I love this mod, it's definately a cool addition! :D

The only thing I changed was the part in edit profile, where it said "Adds a flavor text to your posts under avatar. There is a 255 character limit." Mine now also says "No BBcode or HTML allowed." Because some users were trying to stick in bold tags and such, which doesn't work (probably a good thing) for this field. ;)

Post Reply

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