The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About Permissions , Login Redirect, & Invoice
#1
Hello,
I just installed UserSpice and I have a few questions. Thank you.

1. What should I do to enable users to be able to message the Admin? (Because currently, users are able to message fellow users only, when they click on the message button).

2. Is there a way to display the username, and redirect users onto the page they were on my website (eg. about-us.php) once they are successfully logged in?

(As in the attached picture below).

3. Is there a way for the Admin to create an invoice for users?


Attached Files Thumbnail(s)
   
  Reply
#2
1. the primary admin account is more than likely exempted from messages. Go to the appropriate User Management page for the admin (UID 1 more than likely) and click "Misc Settings", un check and save.

2. My recommended implementation of this is to track the users last page in the PHP Session using similar code to the reAuth and verifyAdmin functions in us_helpers and admin_verify.php to create the tracking and redirect upon login.

3. You would need to build this.

Thank you,
Brandin.
  Reply
#3
<?php
/**
* Redirecting users on login based on user role
*/
function my_login_redirect( $url, $request, $user ){
if( $user && is_object( $user ) && is_a( $user, 'User' ) ) {
if( $user->has_cap( 'administrator' ) ) {
$url = admin_url();
} else {
$url = home_url('/users-only/');
}
}
return $url;
}
add_filter('login_redirect', 'my_login_redirect', 10, 3 );

?>

Will that work for a redirect page?
  Reply
#4
None of that code looks UserSpice applicable. Look at the verifyAdmin and reAuth functions for some guidance.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)