[DEV] admin configurable User Namestyle

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.
Post Reply
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52001
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

[DEV] admin configurable User Namestyle

Post by Brf »

This MOD adds an admin configurable field that is used as the HTML Style for displaying the user's name in viewtopic. I am posting this as a prerequisite to the Change Your Namestyle addon item for the wGEric store Mod.

Code: Select all

############################################################## 
## MOD Title: User Namestyle
## MOD Author: Brf < b.fermanich@insightbb.com  > (Brad Fermanich) http://castledoom.com/forum 
## MOD Description: This MOD adds an Admin configurable namestyle for the user name as shown in viewtopic
## MOD Version: 0.1.0
## 
## Installation Level: Easy 
## Installation Time: 5 Minutes 
## Files To Edit: admin/admin_users.php
##		  templates/subSilver/admin/user_edit_body.tpl
##		  viewtopic.php
##		  templates/subSilver/viewtopic_body.tpl
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/ 
############################################################## 
## Author Notes: 
##
##	This MOD is required for the User Namestyle Addon Item for wGEric Store
##	This MOD assumes the admin has some knowledge of HTML style tags. It adds an admin
##	editable field that is the html style-tag used for displaying the user's name in viewtopic 
############################################################## 
## MOD History: 
##
##   2006-08-24 - Version 0.1.0
##	- Release
#-----[ SQL ]------------------------------------------ 
# 

ALTER TABLE `phpbb_users` ADD `user_namestyle` TEXT NULL ;

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/admin_users.php

# 
#-----[ FIND ]------------------------------------------ 
# 
		$user_rank = ( !empty($HTTP_POST_VARS['user_rank']) ) ? intval( $HTTP_POST_VARS['user_rank'] ) : 0;
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		$user_namestyle=( !empty($HTTP_POST_VARS['user_namestyle']) ) ? $HTTP_POST_VARS['user_namestyle']  : '';

# 
#-----[ FIND ]------------------------------------------ 
# 
#Note: This is the beginning of a longer line:
$sql = "UPDATE " . USERS_TABLE . "
				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar,

#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
$user_allowavatar,

#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
user_namestyle = '$user_namestyle',

# 
#-----[ FIND ]------------------------------------------ 
#
		$html_status =  ($this_userdata['user_allowhtml'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
		$namestyle= $this_userdata['user_namestyle'];

# 
#-----[ FIND ]------------------------------------------ 
#
			$s_hidden_fields .= '<input type="hidden" name="user_allowavatar" value="' . $user_allowavatar . '" />';

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
			$s_hidden_fields .= '<input type="hidden" name="user_namestyle" value="' . $user_namestyle . '" />';			

# 
#-----[ FIND ]------------------------------------------ 
#
			'L_USERNAME' => $lang['Username'],

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
			'NAMESTYLE' => $namestyle,


#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/admin/user_edit_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_DELETE_USER}?</span></td>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
	<tr>
		<td class="row1"><span class="gen">Name DisplayStyle</span></td>
		<td class="row2"><input class="post" type="text" name="user_namestyle" size="50" class="post" style="width: 200px" value="{NAMESTYLE}"  /></td>
	</tr>
#
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, 

#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
 u.user_sig,
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
 u.user_namestyle,

#
#-----[ FIND ]------------------------------------------------
#
	$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

#
#-----[ AFTER, ADD ]---------------------------------- 
#
	$namestyle=(isset($postrow[$i]['user_namestyle']))?$postrow[$i]['user_namestyle'] : "";
	$namestyle=($namestyle == "")?"" : 'style="'.$namestyle.'"';

#
#-----[ FIND ]------------------------------------------------
#
		'POSTER_RANK' => $poster_rank,

#
#-----[ AFTER, ADD ]---------------------------------- 
#

		'NAMESTYLE' => $namestyle,

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
# Note: This is the beginning of a longer line

		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><table><tr><td><span class="name" 
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
<span class="name" 

#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
 {postrow.NAMESTYLE}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
Last edited by Brf on Sat Sep 16, 2006 10:23 pm, edited 2 times in total.
User avatar
Elias
Registered User
Posts: 5015
Joined: Sat Feb 25, 2006 4:31 pm
Location: In the Water!
Name: Elias

Post by Elias »

Any demo for this?
"Mystery creates wonder, and wonder is the basis of man's desire to understand." - Neil Armstrong
|Installing Extensions|Writing Extensions|Extension Validation Policy|
Offering private web hosting. Contact me for details.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52001
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf »

Well... it is only admin configurable, so no there is no demo... but there is a picture in the wGEric Store mod.... This mod was designed to be use with the Change Your Name Style item for that store...
Post Reply

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