view contrib/Upgrade-1.2.4.xml @ 15:a3694cc11d69

* Add first two update changes to 1.2.4 upgrade instructions no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Mon, 15 Jun 2009 19:58:35 +0000
parents 7f85fc163738
children f78621bde952
line wrap: on
line source

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="modx.prosilver.en.xsl"?>
<!--For security purposes, please check: http://www.phpbb.com/mods/ for the
      latest version of this MOD. Although MODs are checked before being
      allowed in the MODs Database there is no guarantee that there are no
      security problems within the MOD. No support will be given for MODs not
      found within the MODs Database which can be found at
      http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.2.xsd">
	<header>
		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
		<title lang="en-gb">Multi-Race Rank Themes - Upgrade Instructions</title>
		<description lang="en-gb">This MOD will allow you to add, modify and remove rank themes.

Rank themes are selectable collections of ranks that normal users can choose to use, allowing RPG forums to have different 'races' or allowing 'normal' forums to provide an set of alternative icon images for their users.

Note that users with "special ranks" (normally Administrators etc.) will not get a theme selection in the UCP as the special rank is their rank theme. If users with special ranks want a themed rank image then you need to also install my "Special and Normal Rank Images" MOD.</description>
		<author-notes lang="en-gb">These changes should upgrade a working v1.2.4 install of the Multi-Race Rank Themes MOD to v1.3.2, however re-installing the MOD from scratch on a clean forum is encouraged where possible to reduce the potential for problems.</author-notes>
		<author-group>
			<author>
				<realname>IBBoard</realname>
				<email>phpbb@ibboard.co.uk</email>
				<username>IBBoard</username>
				<homepage>http://www.ibboard.co.uk</homepage>
			</author>
		</author-group>
		<link-group>
			<link type="parent" href="../Install.xml" lang="en-gb">Main instructions</link>
		</link-group>
		<mod-version>1.3.2</mod-version>
		<installation>
			<level>intermediate</level>
			<time>300</time>
			<target-version>3.0.5</target-version>
		</installation>
		<history>
			<entry>
				<date>2009-06-15</date>
				<rev-version>1.3.2</rev-version>
				<changelog lang="en-gb">
					<change>Change: Update instructions to upgrade from v1.2.4 to v1.3.2</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-05-17</date>
				<rev-version>1.3.1</rev-version>
				<changelog lang="en-gb">
					<change>Change: Hide rank theme if user has a special rank (as per v1.2)</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-05-17</date>
				<rev-version>1.3.0</rev-version>
				<changelog lang="en-gb">
					<change>Initial release of update instructions</change>
				</changelog>
			</entry>
		</history>
	</header>
	<action-group>		<copy>
			<file from="../root/install/install_MultiRaceRankThemes.php" to="install/install_MultiRaceRankThemes.php" />
			<file from="../root/language/en/mods/permissions_MultiRaceRankThemes.php" to="language/en/mods/permissions_MultiRaceRankThemes.php" />
		</copy>
		<open src="adm/style/acp_users.html">
			<edit>
				<find><![CDATA[		<dt><label for="user_rank">{L_USER_RANK}:</label></dt>
		<dd><select name="user_rank" id="user_rank">{S_RANK_OPTIONS}</select></dd>]]></find>
				<action type="after-add"><![CDATA[		<dt><label for="user_rank_theme">{L_USER_RANK_THEME}:</label></dt>
		<dd><select name="user_rank_theme" id="user_rank_theme">{S_RANK_THEME_OPTIONS}</select></dd>]]>
				</action>
			</edit>
		</open>
		<open src="includes/acp/acp_ranks.php">
			<edit>
				<find><![CDATA[				if ($rank_theme < DEFAULT_RANK_THEME_ID)
				{
					$special_rank = 1;]]></find>
				<action type="replace-with"><![CDATA[				if ($rank_theme < 0)
				{
					$special_rank = 1; //Stick with the phpBB convention and use magic numbers for the "special rank" value]]></action>
			</edit>
			<edit>
				<find><![CDATA[				$theme_public = request_var('theme_public', 1);]]></find>
				<action type="replace-with"><![CDATA[				$theme_public = request_var('theme_public', RANK_THEME_PUBLIC);]]></action>
			</edit>
		</open>
		<open src="includes/acp/acp_users.php">
			<edit>
				<find><![CDATA[					$rank_id = request_var('user_rank', 0);]]></find>
				<action type="after-add"><![CDATA[					$rank_theme = request_var('user_rank_theme', DEFAULT_RANK_THEME_ID);]]></action>
			</edit>
			<edit>
				<find><![CDATA[						SET user_rank = $rank_id]]></find>
				<action type="after-add"><![CDATA[						, user_rank_theme = $rank_theme]]></action>
			</edit>
			<edit>
				<find><![CDATA[					$s_rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
				}
				$db->sql_freeresult($result);]]></find>
				<action type="after-add"><![CDATA[				$sql = $db->sql_build_query('SELECT', array(
					'SELECT'	=> 'rtheme_id, rtheme_title',

					'FROM'		=> array(
						RANK_THEMES_TABLE		=> 'r'
					),

					'WHERE'		=> 'rtheme_public = 1 AND rtheme_id > '.DEFAULT_RANK_THEME_ID,

					'ORDER_BY'	=> 'rtheme_title ASC',
				));

				$result = $db->sql_query($sql);
				$valid_selection = false;

				while ($row = $db->sql_fetchrow($result))
				{
					if ($row['rtheme_id'] == $user_row['user_rank_theme'])
					{
						$selected = ' selected="selected"';
						$valid_selection = true;
					}
					else
					{
						$selected = '';
					}

					$s_rank_theme_options .= "<option value=\"{$row['rtheme_id']}\"$selected>{$row['rtheme_title']}</option>";
				}
				$db->sql_freeresult($result);

				$selected = (!$valid_selection) ? ' selected="selected"' : '';
				$s_rank_theme_options = "<option value=\"".DEFAULT_RANK_THEME_ID."\"$selected>{$user->lang['DEFAULT_RANK_THEME']}</option>$s_rank_theme_options";]]></action>
			</edit>
			<edit>
				<find><![CDATA[					'S_RANK_OPTIONS'	=> $s_rank_options)]]></find>
				<inline-edit>
            		<inline-find>)</inline-find>
					<inline-action type="before-add"><![CDATA[, 'S_RANK_THEME_OPTIONS'	=> $s_rank_theme_options]]></inline-action>
				</inline-edit>
			</edit>
		</open>
		<open src="includes/constants.php">
			<edit>
				<find><![CDATA[define('DEFAULT_RANK_THEME_ID', 1);]]></find>
				<action type="after-add"><![CDATA[define('ALLOW_RANK_THEME_AT_REGISTRATION', true);]]></action>
			</edit>
		</open>
		<open src="includes/ucp/ucp_profile.php">
			<edit>
				<find><![CDATA[ 				if ($config['allow_birthdays'])
  				{
					$data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0;]]></find>
				<action type="before-add"><![CDATA[				if (!$auth->acl_get('u_change_rank_theme'))
				{
					//Enforce "cannot change rank theme"
					$data['rank_theme'] = $user->data['user_rank_theme'];
				}]]></action>
			</edit>
			<edit>
				<find><![CDATA[				if ($user->data['user_rank'] == 0)]]></find>
				<action type="replace-with"><![CDATA[				if ($user->data['user_rank'] == 0 && $auth->acl_get('u_change_rank_theme'))]]></action>
			</edit>
			<edit>
				<find><![CDATA[	'RANK_THEME'	=> $data['rank_theme'],
					'S_RANK_THEME_OPTIONS'	=> $s_rank_theme_options,]]></find>
				<action type="replace-with"><![CDATA[					'S_RANK_THEME_OPTIONS'	=> $s_rank_theme_options,]]></action>
			</edit>
		</open>
		<open src="includes/ucp/ucp_register.php">
			<edit>
				<find><![CDATA[		// Check and initialize some variables if needed
		if ($submit)
		{]]></find>
				<action type="before-add"><![CDATA[		if (!defined('ALLOW_RANK_THEME_AT_REGISTRATION') || !ALLOW_RANK_THEME_AT_REGISTRATION)
		{
			//Enforce "cannot select rank theme"
			$data['rank_theme'] = DEFAULT_RANK_THEME_ID;
		}]]></action>
			</edit>
			<edit>
				<find><![CDATA[			$sql = $db->sql_build_query('SELECT', array(
				'SELECT'	=> 'rtheme_id, rtheme_title',]]></find>
				<action type="before-add"><![CDATA[		if (defined('ALLOW_RANK_THEME_AT_REGISTRATION') && ALLOW_RANK_THEME_AT_REGISTRATION)
		{]]></action>
			</edit>
			<edit>
				<find><![CDATA[		$s_rank_theme_options = '<option value="' . DEFAULT_RANK_THEME_ID . '"' . $selected . '>' . $user->lang['DEFAULT_RANK_THEME'] . '</option>' . $s_rank_theme_options;]]></find>
				<action type="after-add"><![CDATA[		}]]></action>
			</edit>
		</open>
		<open src="language/en/acp/users.php">
			<edit>
				<find><![CDATA[));

?>]]></find>
				<action type="before-add"><![CDATA[	//Multi-rank theme: Add langs for editing user
	'USER_RANK_THEME'				=> 'User rank theme',]]></action>
			</edit>
		</open>
		<open src="language/en/common.php">
			<edit>
				<find><![CDATA[	'RANKS'                 => 'Rank Themes',]]></find>
				<action type="after-add"><![CDATA[	//Multi-rank theme: Add install message
	'MULTI_RACE_ADDED_PERMISSIONS'	=> 'Added permissions for Multi-Race Rank Themes MOD',]]></action>
			</edit>
		</open>
		<open src="styles/prosilver/template/ucp_profile_profile_info.html">
			<edit>
				<find><![CDATA[	<!-- ELSE -->
	<input type="hidden" name="rank_theme" value="{RANK_THEME}" />
	<!-- ENDIF -->]]></find>
				<action type="replace-with"><![CDATA[	<!-- ENDIF -->]]></action>
			</edit>
		</open>
		<diy-instructions lang="en">Clear the template cache. Either log in to your server via FTP/SSH and delete cache/tpl_* or log in to the ACP, go to the "Styles" tab then the "Templates" style component, then click "Refresh" for each template and confirm the cache clearing.

Clear the rank theme cache. Either create a new rank, which should rebuild the cache, or delete cache/data_ranks.php.

Add the additional permissions by pointing your browser to http://example.com/forums/install/install_MultiRaceRankThemesPermissions.php (where "example.com/forums/" is the location of your forums), then delete the install_MultiRaceRankThemesPermissions.php file.

Add the "can change rank theme" permission to groups who should be able to change their rank theme. The default is to not allow rank theme changing. With a default forum the easiest way to add the permission to all users is to change the "Standard Features" User Role permission to "Yes" value under the Profile tab.</diy-instructions>
</mod>