Jump to content

v8 "Login As Owner" link - open in new tab/window hook


Recommended Posts

in v7 and earlier, you could right-click on the "Login As Client" link and open it in a new tab - useful if you need to see both admin and client areas at the same time.

in v8, "Login As Owner" now uses a form and you can't right-click on it to open a new tab... *sighs* 🙄

so the simple hook below will open that link in a new tab by default...

<?php

# Login As Owner Open In New Tab Hook
# Written by brian!

function admin_login_as_owner_hook($vars) {

	if ($vars['filename'] == 'clientssummary' && isset($_GET["userid"])) {
		return '<script>$("#frmLoginAsOwner").prop("target","_blank");</script>';
	}
}
add_hook("AdminAreaFooterOutput", 1, "admin_login_as_owner_hook");

you could edit the clientssummary.tpl template too and just add the target link to the form code.

Link to comment
Share on other sites

Hi,

After updating to 8.0 from 7.10 I can not longer login into customer´s backend because it causes the next error:

 

Oops!

Access Denied - Forbidden

You do not have the required permission to perform the selected operation!

 

Please try navigating using the options below.

 Regresar  Homepage
 
 

 

Can anybody help me?

Regards,

Oscar.

Link to comment
Share on other sites

(Updating myself)

Hi,

I have seen that I can login as owner only for customers created directly with WHMCS.

The error is located only with customers imported from Resellerclub with resellerclub-mods tool to mass import customers.

Any idea of where can I solve this problem?

 

Regards,

Oscar.

Link to comment
Share on other sites

  • 2 weeks later...
18 hours ago, Manchester Web Hosting said:

@brian! this seems to be adjusted in the recent v8.0.2 and now you can click the login as owner in admin client summary screen and right click. Or am I looking at the wrong one??

I suspect you're looking at the right one - but what I see occurring is..

  • if I click on the link, it opens the client area and logs in in the same tab (useless if I need to see the admin area at the same time).
  • if I right-click on the link and open in new tab, then it opens the dashboard again in the new tab and not the logged in client area.

hence why I wrote the hook so that when I click the link, it opens the client area in a new tab.

Link to comment
Share on other sites

3 hours ago, brian! said:

I suspect you're looking at the right one - but what I see occurring is..

  • if I click on the link, it opens the client area and logs in in the same tab (useless if I need to see the admin area at the same time).
  • if I right-click on the link and open in new tab, then it opens the dashboard again in the new tab and not the logged in client area.

hence why I wrote the hook so that when I click the link, it opens the client area in a new tab.

Aha, you are indeed correct! i right clicked and opened in new tab yesterday BUt never actually checked the tab. I did just now and you are right it just shows the same page again.

Someone needs to give those guys a bafta OR grammy. The work they do is fantastic... maybe someday they should be nominated for a nobel prize?

Link to comment
Share on other sites

  • 1 month later...

Apologies for necrobumping this issue but in 8.0.4 (and since 8.0) I can't "Login as Owner" for some users and can't figure out any pattern and I don't use Reseller club. There is something about how some of my users have been added that must be different and I suspect a direct database twiddle would fix it... but what might that twiddle be?

Link to comment
Share on other sites

5 hours ago, markc said:

There is something about how some of my users have been added that must be different and I suspect a direct database twiddle would fix it... but what might that twiddle be?

I take it that these users are "owners" ? e.g they're not previous subaccounts that have just been converted to users ?

Link to comment
Share on other sites

"subaccounts converted to users?" Not that I am aware of. I might be missing some conceptual change regarding users vs owners in the v8 update. I have triple checked that my Full Administrator user has everything checked in the Roles section. A difference is that clicking on Login as Owner for the users with an error goes to https://xxxxx/admin/client/548/login whereas the ones that work go to https://xxxxx/clientarea.php as I would expect. Hmm, perhaps a session  error.

Link to comment
Share on other sites

3 hours ago, markc said:

"subaccounts converted to users?" Not that I am aware of. I might be missing some conceptual change regarding users vs owners in the v8 update.

what should happen when upgrading to v8 I believe (happy to be corrected if wrong) is that...

  • clients are converted to users and assigned as owner of that client.
  • sub-accounts (contacts who can login) should be converted to users and assigned to the client.
  • contacts remain contacts.
4 hours ago, markc said:

A difference is that clicking on Login as Owner for the users with an error goes to https://xxxxx/admin/client/548/login whereas the ones that work go to https://xxxxx/clientarea.php as I would expect. Hmm, perhaps a session  error.

might be worth looking in the tblusers_clients database table and seeing if there is anything different about these users (tblusers).

another question to ask is what happens when the hook is disabled? e.g is the hook causing the issue or is WHMCS causing it ??

Link to comment
Share on other sites

  • 1 month later...
On 11/17/2020 at 3:34 AM, brian! said:

what should happen when upgrading to v8 I believe (happy to be corrected if wrong) is that...

  • clients are converted to users and assigned as owner of that client.
  • sub-accounts (contacts who can login) should be converted to users and assigned to the client.
  • contacts remain contacts.

might be worth looking in the tblusers_clients database table and seeing if there is anything different about these users (tblusers).

another question to ask is what happens when the hook is disabled? e.g is the hook causing the issue or is WHMCS causing it ??

Hi

 

I am having the same issue with clients I imported from Blesta.  Did any one find a solution?

Link to comment
Share on other sites

I think I found out what the issue is I also had noticed the difference is that clicking on Login as Owner for the users with an error goes to https://xxxxx/admin/client/548/login for imported users from Blesta and the ones created via WHMCS work go to https://xxxxx/clientarea.php.

I looked at the dot.gifTable: tblusers and noticed the password are empty. I created a password for that user then tried to Login as Owner and it worked!

Looks like passwords will need to be set manually for the ones migrated from a different platform. Hope this helps others with this issue.

Link to comment
Share on other sites

  • 2 weeks later...
On 10/2/2020 at 5:57 PM, brian! said:

in v7 and earlier, you could right-click on the "Login As Client" link and open it in a new tab - useful if you need to see both admin and client areas at the same time.

in v8, "Login As Owner" now uses a form and you can't right-click on it to open a new tab... *sighs* 🙄

so the simple hook below will open that link in a new tab by default...


<?php

# Login As Owner Open In New Tab Hook
# Written by brian!

function admin_login_as_owner_hook($vars) {

	if ($vars['filename'] == 'clientssummary' && isset($_GET["userid"])) {
		return '<script>$("#frmLoginAsOwner").prop("target","_blank");</script>';
	}
}
add_hook("AdminAreaFooterOutput", 1, "admin_login_as_owner_hook");

you could edit the clientssummary.tpl template too and just add the target link to the form code.

Thanks @brian! as always, me and my team really need this feature back and you done it 👍🏻

Link to comment
Share on other sites

  • 1 month later...

Many Thanks @brian!

Maybe you also have an idea how to deactivate it that it is in the activity logs that you have logged in as admin as a client.  That was not the case in the past. And it is irritating that you don't know whether the admin or the customer was logged in.

Link to comment
Share on other sites

8 hours ago, J-B said:

Maybe you also have an idea how to deactivate it that it is in the activity logs that you have logged in as admin as a client.  That was not the case in the past. And it is irritating that you don't know whether the admin or the customer was logged in.

what version of WHMCS are you using ? my recollection is that v8.0 had a bug that logged admins masquerading as clients, but that this was more or less fixed in v8.1 ??

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated