Mod: Quick Switch

Discussions of any technical geektastic discussion-type thingies related to the administration of these forums that the rest of us nontechnical non-geektastic discussion-type people would find utterly uninteresting.

Y'all have been computer-geek ghettoized.

Mod: Quick Switch

Postby Delphinan » Mon Mar 15, 2010 7:25 pm

A new modification has been hacked into the forum software.

(Note: compile notes and artifact files of changes for documentation is the next task)

The modification introduces a new custom profile user field (pf_allowedswitch, field width 100, column width 250). This field is identified as a colon ( : ) separated list of forum account names allowed to switch user-context to the profile's owner. Names are strict, case-sensitive and must be exact to existing username values.

Once complete, upon login to the main board, a new set of links appears (only if the profile field is non-empty) to the left of Logout on the overall header subpage. This set has the logout/login icon, followed the word 'Switch' and then in brackets the list of user accounts allowed to be switched into between brackets and separated by hard spaces. Each name therein is a link to the current page ($_SERVER['REQUEST_URI']), with the additional urI attribute of 'autoswap=<target user id>'. This attribute triggers the check for valid swap action and updates the internal session information to become the new user id before refreshing the page to the user. Any authorization for admin (not moderator) privleges will be cancelled in the session and the user will be forced to reverify when accessing the ACP next.

Note that autoswap attribute can be used anywhere within the board URI structure for users.

So, for the breakdown of how to set this up, connecting UserA and UserB:

    Log in as UserA
    Go to User Control Panel link
    Go to Profile Tab
    In the field Allowed to Switch To This User:, enter (without quotes) UserB
    Click Submit
    Log in as UserB
    Go to User Control Panel link (Note: the Switch option is now available as a link to UserA, but do not use this yet)
    Go to Profile Tab
    In the field Allowed to Switch To This User:, enter (without quotes) UserA
    Click Submit


You can change the two field values to UserB:UserC and UserA:UserC respectively to add a third user (UserC) which would have a profile field value of UserA:UserB.

Please post here if any problems with this new functionality.
User avatar
Delphinan
Site Admin
 
Posts: 1587
Joined: Tue Jun 17, 2008 7:32 pm

Re: Quick Switch

Postby Renee » Mon Mar 15, 2010 7:36 pm

I simply
User avatar
Renee
Changeling
 
Posts: 593
Joined: Sun Jun 14, 2009 11:04 am

Re: Quick Switch

Postby Beth Tygart » Mon Mar 15, 2010 7:37 pm

LOVE this
User avatar
Beth Tygart
Changeling
 
Posts: 221
Joined: Tue Aug 26, 2008 10:30 am

Re: Quick Switch

Postby Anastasia » Mon Mar 15, 2010 7:37 pm

Fraggin HACK!!!
User avatar
Anastasia
 
Posts: 91
Joined: Thu Feb 18, 2010 8:45 pm

Re: Quick Switch

Postby Dante » Mon Mar 15, 2010 7:39 pm

Bahahahaha!


This is super nice.
User avatar
Dante
Changeling
 
Posts: 127
Joined: Wed Jul 16, 2008 10:11 am

Re: Mod: Quick Switch

Postby Delphinan » Mon May 10, 2010 9:04 am

Addition to this Quick Switch mod:

The display of users the current user can switch to now shows the switchable username in bold type if the switchable user has unread private messages (as of the page refresh time). The display also now includes the count of those unread private messages. The switchable user displays in plain text with no unread count if there are no unread private messages for that user as before.

Please let me know of any issues or problems with this extended feature.
User avatar
Delphinan
Site Admin
 
Posts: 1587
Joined: Tue Jun 17, 2008 7:32 pm

Re: Mod: Quick Switch

Postby Delphinan » Tue Mar 26, 2013 7:34 pm

Addition to this mod:

The Switch display options now includes the initial login regardless of the switch profile field, allowing a user to always switch to this user while the session is valid.

In addition, the switchable users are now sorted.

To accomplish this, A new field SESSIONS_TABLE.session_first_user_id(mediumint,8,unsigned,not null,default:0) is added to the sessions table and the sessions php code is augmented to store the user id when an initial autoswap is requested, and to accept this value for autoswap validation.

Please alert me if any issues arise from this extended feature.
User avatar
Delphinan
Site Admin
 
Posts: 1587
Joined: Tue Jun 17, 2008 7:32 pm

Re: Mod: Quick Switch

Postby Fetch » Tue Mar 26, 2013 8:58 pm

Wow, thank you. I have tested and it works. No bugs yet.
User avatar
Fetch
Ring Member
 
Posts: 3922
Joined: Wed Jun 11, 2008 10:01 pm

Re: Mod: Quick Switch

Postby Delphinan » Tue Mar 26, 2013 9:10 pm

What can I say, Bryce told me he missed being able to logout and autologin again from the Staff account to his own account. That was a bug, fixed in the last upgrade by phpBB itself.

So I put in something better, I think. Now that I know how staff uses the forum a bit more.
User avatar
Delphinan
Site Admin
 
Posts: 1587
Joined: Tue Jun 17, 2008 7:32 pm


Return to Board Technical Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron