Legend Repositioning

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
Extensions Robot
Extensions Robot
Extensions Robot
Posts: 29216
Joined: Sat Aug 16, 2003 7:36 am

Legend Repositioning

Post by Extensions Robot »

Modification name: Legend Repositioning
Author: Tom
Modification description: This MOD provides an easy and convenient method for administrators who have permission to manage groups to reorder (or, reposition) the groups that are displayed in the board's legend, both on the index.php and viewonline.php pages.
  • Groups can be easily repositioned by clicking up and down arrows in the ACP.
  • Each time a group's position is moved, the action is logged in the administrator log.
  • When a new group is added, it is automatically positioned at the end (or bottom) of the group list on the legend.
  • When a group is deleted, all other groups below it have their positions modified accordingly.
* This MOD is compatible with phpBB 3.0.12 *

You may safely ignore any "target phpBB version for this MOD is 3.0.6" messages from AutoMOD.
Modification version: 1.0.3
Tested on phpBB version: 3.0.6

Download file: Legend Repositioning 1.0.3.zip
File size: 162.65 KiB

Modification overview page: View

The phpBB Team is not responsible nor required to provide support for this modification. By installing this MOD, you acknowledge that the phpBB Support Team or phpBB Extension Customisations Team may not be able to provide support.

-->Modification support<--
Last edited by Extensions Robot on Mon Sep 19, 2022 7:33 pm, edited 32 times in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 18282
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Legend Repositioning

Post by DavidIQ »

Modification validated/released

Notes:
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom
Contact:

Legend Repositioning

Post by Tom »

Image

For known issues, screenshots, language translations, and other extended information, view the Legend Repositioning FAQ.
Tom C. - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
User avatar
RMcGirr83
Former Team Member
Posts: 22011
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Legend Repositioning

Post by RMcGirr83 »

[EDIT]Fixed in latest version[/EDIT]
Last edited by RMcGirr83 on Sat Oct 31, 2009 10:04 pm, edited 1 time in total.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom
Contact:

Re: Legend Repositioning

Post by Tom »

RMcGirr83 wrote:Congrats on the validation Tom!!

I ran across an issue recently after installing this and updating the board to 3.0.6-RC2. As you may be aware 3.0.6 adds a new group ("Newly Registered Users"). This new group did not present itself in your new panel to be "moved" even though I selected the group to display on the legend.
Thanks, Rich. :)

The reason that the "Newly Registered Users" group is not showing up on the repositioning panel after installing on 3.0.5 and updating to 3.0.6-RC2 is because, after the code edits are done for the MOD, you ran the install_legend_repositioning.php file and it gave an incrementing numeric value in the group_position field for each of your existing groups in the database. However, once you updated to 3.0.6-RC2 it added the "Newly Registered Users" group, but that group was not assigned a numeric value for the group_position field. Therefore, it didn't show up on the repositioning panel in the ACP on purpose because I designed the panel so that it would only list the groups that have a numeric value for the group_position field. This prevents some problems that may occur when you try to reposition a group that has a group_position value of "0". Your fix will work, but it will no longer show groups that are not shown on the legend in the repositioning panel, and that could be a problem. The reason it could be a problem is because I purposely wanted all groups listed in the repositioning panel (whether they're on the legend or not) so that you can see how each group would be positioned on the legend if it was to be shown there. That's why in the repositioning panel groups that are listed on the legend show up with a light-blue background, and groups that aren't listed on the legend have a white background. ;)

This wouldn't be a problem if the MOD was installed directly on a 3.0.6-RC2 installation, but if it is installed on a 3.0.5 installation and is then updated to 3.0.6-RC2, then that is where problems will arise. I'll need to create a quick fix script that can be run to give a value in the group_position field for the "Newly Registered Users" group - that should fix this problem. I'll get to posting the "fix script" for this issue later today.

Thank you for pointing this out. I submitted this MOD before 3.0.6-RC1 was released, so I never needed to think about an issue like this (because 3.0.5 was the "latest greatest" at the time). ;) I appreciate you checking it out.
Tom C. - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
User avatar
RMcGirr83
Former Team Member
Posts: 22011
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Legend Repositioning

Post by RMcGirr83 »

I see exactly. :)

FWIW, I use this code in my warning reasons mod to ensure the position is always set.

Code: Select all

		// By default, check that order is valid and fix it if necessary

		$result = $db->sql_query('SELECT reason_id, reason_order FROM ' . WARNING_REASONS_TABLE . ' ORDER BY reason_order');

		if ($row = $db->sql_fetchrow($result))
		{
			$order = 0;
			do
			{
				++$order;
				
				if ($row['reason_order'] != $order)
				{
					$db->sql_query('UPDATE ' . WARNING_REASONS_TABLE . " SET reason_order = $order WHERE reason_id = {$row['reason_id']}");
				}
			}
			while ($row = $db->sql_fetchrow($result));
		}
		$db->sql_freeresult($result);
which I modified from includes/acp/acp_reasons. Six of one half a dozen of another I suppose. ;)

Cheers!
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom
Contact:

Re: Legend Repositioning

Post by Tom »

Oh, I see what you've done there. Maybe that would be a better idea than creating a script that has to be run manually to fix the problem, whereas using a system such as the one you posted would take care of undefined positions automatically. Thank you for sharing that, and a fix/update should be coming soon. :)
Tom C. - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3542
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Re: Legend Repositioning

Post by bonelifer »

Nice mod. If the "Group Legend Positioning" mod I'm using doesn't work with 3.0.6, I'm going to use this one.
William Jacoby - Community Team
Knowledge Base | phpBB Board Rules | Search Customisation Database
Please don't contact me via PM or email for phpBB support .
User avatar
PinoyEngine™
Registered User
Posts: 244
Joined: Fri Apr 24, 2009 7:12 am

Re: Legend Repositioning

Post by PinoyEngine™ »

This is a very wonderful MOD.
Two Thumbs up for this. :D
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom
Contact:

Re: Legend Repositioning

Post by Tom »

Attention: The bug that Rich addressed earlier in this topic now has a fix available. Whether you are running this MOD on phpBB 3.0.6 or not, you should still preform this fix to ensure that there are no problems when updating to future versions.

Issue #001 - Fix Instructions

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
includes/acp/acp_groups.php
#
#-----[ FIND ]------------------------------------------
#
# The tabbing on this find may not be exactly correct, so look 
# at the bottom of the file for this find.
#
		// Get all the groups that show on the legend
		$sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_legend
			FROM ' . GROUPS_TABLE . ' g
			WHERE g.group_position > 0
			ORDER BY g.group_position ASC';
		$result = $db->sql_query($sql);

		$lookup = $cached_group_data_full = array();
		while ($row = $db->sql_fetchrow($result))
		{
			// used for easy access to the data within a group
			$cached_group_data_full[$type][$row['group_id']] = $row;
		}
		$db->sql_freeresult($result);
#
#-----[ REPLACE WITH ]------------------------------------------
#
		// Get all the groups to show in the repositioning panel
		$sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_legend, g.group_position
			FROM ' . GROUPS_TABLE . ' g
			ORDER BY g.group_position ASC';
		$result = $db->sql_query($sql);

		$lookup = $cached_group_data_full = array();
		if ($row = $db->sql_fetchrow($result))
		{
			$position = 0;
			do
			{
				++$position;
				if ($row['group_position'] != $position)
				{
					$sql = 'UPDATE ' . GROUPS_TABLE . "
						SET group_position = $position
						WHERE group_id = {$row['group_id']}";
					$db->sql_query($sql);
				}
				$cached_group_data_full[$type][$row['group_id']] = $row;
			}
			while ($row = $db->sql_fetchrow($result));
		}
		$db->sql_freeresult($result);
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
This will fix Issue #001 on the Known Issues list for this MOD. Special thanks to Rich for reporting this bug and suggesting a useful means of fixing it. As I've said before, be sure to preform this fix no matter what version of phpBB you are running.

Also, if anyone tried using the fix posted by Rich here, you may want to put that line back to the way it was previously. Since I have released a fix for this issue, using the fix Rich described there may now cause problems with the MOD. ;)

Thanks, everyone, and if you are noticing any bugs with this new fix please report them. I am going to be submitting this revision to the MODDB very soon for validation.
Tom C. - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 18282
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Legend Repositioning

Post by DavidIQ »

MOD Updated to version 1.0.1
See first post for Download Link
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
CrudeR
Registered User
Posts: 2
Joined: Wed Sep 09, 2009 8:20 am

Re: Legend Repositioning

Post by CrudeR »

Nice MOD just what I needed! Had to make a few edits to some other files to make it work on our portal but works perfect with it now. Thanks Tom. 8-)
anthies
Registered User
Posts: 162
Joined: Sun May 17, 2009 10:40 am
Location: Finland, Klaukkala
Name: Janne
Contact:

Re: Legend Repositioning

Post by anthies »

Thanks for the mod! Now we can actually re-organize the legend line alphabetically.
ziscross
Registered User
Posts: 2
Joined: Tue Sep 01, 2009 7:36 pm

Re: Legend Repositioning

Post by ziscross »

I recommended to repositioning in online list above the legend

I can't find out in /include/function.php

sincerely

from Thailand
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom
Contact:

Re: Legend Repositioning

Post by Tom »

ziscross wrote:I recommended to repositioning in online list above the legend
This MOD is only for repositioning the usergroups listed on the legend. The Who is Online list shows all of the users who are currently online and sorts them alphabetically. Repositioning the legend and the Who is Online area are two very different things. I'm not sure if I understand your suggestion correctly, but it seems as though you want to be able to select a specific order for how each user on your forum will be listed in the Who is Online area? I'm not sure why you would want to do that (unless you have a small forum), but this MOD does not relate to that idea, sorry.
ziscross wrote:I can't find out in /include/function.php
What exactly can't you find? Are you looking for a line in that file and you can't find it? Sorry, but I can't understand your question. By the way, the file /include/function.php does not exist, but there is a file called /include/functions.php with an "s" in "functions". Maybe you were looking for the wrong file. ;)
Tom C. - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
Locked

Return to “[3.0.x] MOD Database Releases”