Mercurial > repos > phpBB-MODs > Multi_Race_Rank_Themes
changeset 14:7f85fc163738
* Backport changes from v1.2.4
* Add code to show themed rank when viewing PMs
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 15 Jun 2009 19:51:29 +0000 |
parents | 7ef9cdf7b325 |
children | a3694cc11d69 |
files | Install.xml contrib/Upgrade-1.2.3.xml contrib/Upgrade-1.2.4.xml subsilver2.xml |
diffstat | 4 files changed, 270 insertions(+), 233 deletions(-) [+] |
line wrap: on
line diff
--- a/Install.xml Sun Jun 07 18:43:44 2009 +0000 +++ b/Install.xml Mon Jun 15 19:51:29 2009 +0000 @@ -12,7 +12,9 @@ <title lang="en-gb">Multi-race rank themes</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 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.</description> +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"><![CDATA[The following description is taken from digiTsai's phpBB2 'Rank themes' mod (with some minor modifications in the last paragraph), as I couldn't word it any better myself: Different ranking themes for your forum. Users are allowed to choose a ranking theme to their liking. For example, you can add two ranking themes named "Good" and "Evil" for your forum. The ranking then might look like this: @@ -41,14 +43,23 @@ <link type="template" href="subsilver2.xml" lang="en-gb">subsilver2</link> <link type="contrib" href="contrib/Upgrade-1.2.3.xml" lang="en-gb">Upgrade instructions from v1.2.3</link> </link-group> - <mod-version>1.3.1</mod-version> + <mod-version>1.3.2</mod-version> <installation> <level>intermediate</level> <time>3600</time> - <target-version>3.0.4</target-version> + <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>Add: Add missing multi-ranking to PM viewing</change> + <change>Fix: Backport changes from 1.2.4 to pass validation</change> + <change>Change: Change edits of get_user_rank() calls to find closing brackets and add before to ensure the optional parameters is at the end</change> + </changelog> + </entry> + <entry> <date>2009-05-17</date> <rev-version>1.3.1</rev-version> <changelog lang="en-gb"> @@ -379,9 +390,9 @@ //$special_rank = request_var('special_rank', 0); $rank_theme = request_var('rank_theme', DEFAULT_RANK_THEME_ID); - if ($rank_theme < DEFAULT_RANK_THEME_ID) + if ($rank_theme < 0) { - $special_rank = 1; + $special_rank = 1; //Stick with the phpBB convention and use magic numbers for the "special rank" value $rank_theme = SPECIAL_RANK_THEME_ID; } else @@ -435,14 +446,14 @@ case 'save_theme': $theme_title = utf8_normalize_nfc(request_var('title', '', true)); - $theme_public = request_var('theme_public', 1); + $theme_public = request_var('theme_public', RANK_THEME_PUBLIC); if (!$theme_title) { trigger_error($user->lang['NO_RANK_THEME_TITLE'] . adm_back_link($this->u_action), E_USER_WARNING); } - if ($rank_id <= DEFAULT_RANK_THEME_ID && $rank_id != 0) + if ($rank_id == DEFAULT_RANK_THEME_ID || $rank_id == SPECIAL_RANK_THEME_ID || $rank_id <= 0) { trigger_error($user->lang['MUST_SELECT_RANK_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -577,8 +588,8 @@ $template->assign_block_vars('themes', array( 'RANK_THEME_TITLE' => $theme['rtheme_title'], 'S_THEME_PUBLIC' => $theme['rtheme_public'], - 'U_EDIT_THEME' => ($theme['rtheme_id'] > 1 ? $this->u_action . '&action=edit_theme&id=' . $theme['rtheme_id'] : ''), - 'U_DELETE_THEME' => ($theme['rtheme_id'] > 1 ? $this->u_action . '&action=delete_theme&id=' . $theme['rtheme_id'] : ''))); + 'U_EDIT_THEME' => ($theme['rtheme_id'] != DEFAULT_RANK_THEME_ID && $theme['rtheme_id'] != SPECIAL_RANK_THEME_ID ? $this->u_action . '&action=edit_theme&id=' . $theme['rtheme_id'] : ''), + 'U_DELETE_THEME' => ($theme['rtheme_id'] != DEFAULT_RANK_THEME_ID && $theme['rtheme_id'] != SPECIAL_RANK_THEME_ID ? $this->u_action . '&action=delete_theme&id=' . $theme['rtheme_id'] : ''))); if (sizeof($ranks[$theme['rtheme_id']]) > 0) { @@ -607,7 +618,7 @@ global $db, $user; - $sql = 'SELECT * FROM ' . RANK_THEMES_TABLE. " WHERE rtheme_id > ".DEFAULT_RANK_THEME_ID." ORDER BY rtheme_title"; + $sql = 'SELECT * FROM ' . RANK_THEMES_TABLE. ' WHERE rtheme_id <> ' . DEFAULT_RANK_THEME_ID . ' AND rtheme_id <> ' . SPECIAL_RANK_THEME_ID . ' ORDER BY rtheme_title'; $result = $db->sql_query($sql); $this->rank_themes = array(SPECIAL_RANK_THEME_ID => array('rtheme_id' => SPECIAL_RANK_THEME_ID, 'rtheme_title' => $user->lang['SPECIAL_RANK_THEME'], 'rtheme_public' => false), @@ -678,7 +689,7 @@ </open> <open src="includes/cache.php"> <edit> - <find><![CDATA[$sql = 'SELECT * + <find><![CDATA[ $sql = 'SELECT * FROM ' . RANKS_TABLE . ' ORDER BY rank_min DESC';]]></find> <action type="replace-with"><![CDATA[ //Make sure we only pull data for public rank themes and the special theme @@ -696,7 +707,7 @@ ) ), - 'WHERE' => 't.rtheme_public OR t.rtheme_id = ' . SPECIAL_RANK_THEME_ID, + 'WHERE' => 't.rtheme_public = ' . RANK_THEME_PUBLIC . ' OR t.rtheme_id = ' . SPECIAL_RANK_THEME_ID, 'ORDER_BY' => 'r.rank_min DESC' ));]]></action> </edit> @@ -711,10 +722,13 @@ <action type="after-add"><![CDATA[ define('SPECIAL_RANK_THEME_ID', -1); define('DEFAULT_RANK_THEME_ID', 1); +define('DEFAULT_RANK_THEME_ID', 1); +define('RANK_THEME_PRIVATE', 0); +define('RANK_THEME_PUBLIC', 1); define('ALLOW_RANK_THEME_AT_REGISTRATION', true);]]></action> </edit> <edit> - <find><![CDATA[define('RANKS_TABLE', $table_prefix . 'ranks');]]></find> + <find><![CDATA[// Additional tables]]></find> <action type="after-add"><![CDATA[define('RANK_THEMES_TABLE', $table_prefix . 'rank_themes');]]></action> </edit> </open> @@ -732,12 +746,14 @@ <edit> <find><![CDATA[function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src)]]></find> <inline-edit> - <inline-find>, &$rank_img_src</inline-find> - <inline-action type="after-add">, $rank_theme = DEFAULT_RANK_THEME_ID</inline-action> + <inline-find>)</inline-find> + <inline-action type="before-add">, $rank_theme = DEFAULT_RANK_THEME_ID</inline-action> </inline-edit> </edit> <edit> - <find><![CDATA[ if (!empty($ranks['normal']))]]></find> + <find><![CDATA[ if (!empty($ranks['normal'])) + { + foreach ($ranks['normal'] as $rank)]]></find> <action type="replace-with"><![CDATA[ //Multi-rank theme: find our theme, defaulting to DEFAULT_RANK_THEME_ID if the user chose an invalid value if (!empty($ranks[$rank_theme])) { @@ -749,11 +765,18 @@ $theme = $ranks[DEFAULT_RANK_THEME_ID]; } - if (!empty($theme))]]></action> + if (!empty($theme)) + { + foreach ($theme as $rank)]]></action> </edit> + </open> + <open src="includes/ucp/ucp_pm_viewmessage.php"> <edit> - <find><![CDATA[ foreach ($ranks['normal'] as $rank)]]></find> - <action type="replace-with"><![CDATA[ foreach ($theme as $rank)]]></action> + <find><![CDATA[ get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']);]]></find> + <inline-edit> + <inline-find>);</inline-find> + <inline-action type="before-add"><![CDATA[, $user_row['user_rank_theme']]]></inline-action> + </inline-edit> </edit> </open> <open src="includes/ucp/ucp_profile.php"> @@ -803,7 +826,7 @@ RANK_THEMES_TABLE => 'r' ), - 'WHERE' => 'rtheme_public = 1 AND rtheme_id > ' . DEFAULT_RANK_THEME_ID, + 'WHERE' => 'rtheme_public = ' . RANK_THEME_PUBLIC . ' AND rtheme_id <> ' . DEFAULT_RANK_THEME_ID, 'ORDER_BY' => 'rtheme_title ASC', )); @@ -879,7 +902,7 @@ RANK_THEMES_TABLE => 'r' ), - 'WHERE' => 'rtheme_public = 1 AND rtheme_id > '.DEFAULT_RANK_THEME_ID, + 'WHERE' => 'rtheme_public = ' . RANK_THEME_PUBLIC . ' AND rtheme_id <> '.DEFAULT_RANK_THEME_ID, 'ORDER_BY' => 'rtheme_title ASC', )); @@ -943,7 +966,7 @@ <find><![CDATA[ 'RANK_UPDATED' => 'The rank was successfully updated.',]]></find> <action type="after-add"><![CDATA[ //Multi-rank theme: Rank theme specific language strings 'ADD_RANK_THEME' => 'Add new rank theme', - 'ACP_RANK_THEMES_EXPLAIN' => 'Using this form you can add, edit, view and delete rank themes. Rank themes can be made private so that they are not selectable by users.', + 'ACP_RANK_THEMES_EXPLAIN' => 'Using this page you can add, edit, view and delete rank themes. Rank themes can be made private so that they are not selectable by users. Deleting a rank theme will delete all ranks within it.', 'RANK_THEME_TITLE' => 'Rank theme title', 'RANK_THEME_PUBLIC' => 'Set as public rank theme', 'RANK_THEME' => 'Rank theme', @@ -956,8 +979,8 @@ </open> <open src="language/en/common.php"> <edit> - <find><![CDATA[ 'YOU_NO_NEW_PM' => 'No new private messages are waiting for you.',]]></find> - <action type="after-add"><![CDATA[ + <find><![CDATA[ 'datetime' => array(]]></find> + <action type="before-add"><![CDATA[ //Multi-rank theme: Add in new rank naming 'DEFAULT_RANK_THEME' => 'Default theme', 'SPECIAL_RANK_THEME' => 'Special theme', @@ -975,7 +998,7 @@ ?>]]></find> <action type="before-add"><![CDATA[// Multi-rank theme: Rank theme list information 'RANKTHEMES' => 'Rank Themes', - 'RANKTHEME_TEXT' => 'Rank themes allow you to customise the name and image of the rank that is displayed beside your post. For a full list of the ranks within a scheme click on the scheme name. For more detail on ranks please see the <a href="faq.php#f15">FAQ</a>.', + 'RANKTHEME_TEXT' => 'Rank themes allow you to customise the name and image of the rank that is displayed beside your post. For a full list of the ranks within a scheme click on the scheme name. For more detail on ranks please see the <a href="%1$s">FAQ</a>.', 'RANK_NAME' => 'Rank', 'RANK_IMG' => 'Rank image', 'RANK_POSTS' => 'Required post count', @@ -1006,10 +1029,10 @@ <action type="after-add"><![CDATA[ case 'ranks':]]></action> </edit> <edit> - <find><![CDATA[ get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src);]]></find> + <find><![CDATA[ get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src);]]></find> <inline-edit> - <inline-find>$rank_img_src</inline-find> - <inline-action type="after-add"><![CDATA[, $row['user_rank_theme']]]></inline-action> + <inline-find>);</inline-find> + <inline-action type="before-add"><![CDATA[, $row['user_rank_theme']]]></inline-action> </inline-edit> </edit> <edit> @@ -1026,11 +1049,15 @@ // Get list of rank themes $sql = 'SELECT rtheme_id, rtheme_title FROM ' . RANK_THEMES_TABLE . ' - WHERE rtheme_public = 1 - AND rtheme_id > ' . DEFAULT_RANK_THEME_ID . ' + WHERE rtheme_public = ' . RANK_THEME_PUBLIC . ' + AND rtheme_id <> ' . DEFAULT_RANK_THEME_ID . ' ORDER BY rtheme_title ASC'; $result = $db->sql_query($sql); + $template->assign_vars(array( + 'L_RANKSET_TEXT' => sprintf($user->lang['RANKSET_TEXT'], append_sid("{$phpbb_root_path}faq.{$phpExt}#f15")) + )); + $template->assign_block_vars('rankset', array( 'RANKSET_URL' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=ranks&r=' . DEFAULT_RANK_THEME_ID), 'RANKSET_NAME' => $user->lang['DEFAULT_RANK_THEME'] @@ -1050,7 +1077,7 @@ { $sql = 'SELECT rtheme_title FROM ' . RANK_THEMES_TABLE . ' - WHERE rtheme_public = 1 + WHERE rtheme_public = ' . RANK_THEME_PUBLIC . ' AND rtheme_id = ' . $rank_theme; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -1090,10 +1117,10 @@ break;]]></action> </edit> <edit> - <find><![CDATA[ get_user_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src);]]></find> + <find><![CDATA[ get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);]]></find> <inline-edit> - <inline-find>$rank_img_src</inline-find> - <inline-action type="after-add"><![CDATA[, $data['user_rank_theme']]]></inline-action> + <inline-find>);</inline-find> + <inline-action type="before-add"><![CDATA[, $data['user_rank_theme']]]></inline-action> </inline-edit> </edit> </open> @@ -1157,8 +1184,8 @@ <edit> <find><![CDATA[ get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);]]></find> <inline-edit> - <inline-find>$user_cache[$poster_id]['rank_image_src']</inline-find> - <inline-action type="after-add"><![CDATA[, $row['user_rank_theme']]]></inline-action> + <inline-find>);</inline-find> + <inline-action type="before-add"><![CDATA[, $row['user_rank_theme']]]></inline-action> </inline-edit> </edit> </open>
--- a/contrib/Upgrade-1.2.3.xml Sun Jun 07 18:43:44 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -<?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 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.</description> - <author-notes lang="en-gb">These changes should upgrade a working v1.2.3 install of the Multi-Race Rank Themes MOD to v1.3.0, 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.1</mod-version> - <installation> - <level>intermediate</level> - <time>300</time> - <target-version>3.0.4</target-version> - </installation> - <history> - <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_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">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> - </action-group> -</mod>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/Upgrade-1.2.4.xml Mon Jun 15 19:51:29 2009 +0000 @@ -0,0 +1,206 @@ +<?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 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.</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.0, 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_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>