Version 5.0.0 beta 7
This commit is contained in:
1 parent
fa2a720105
commit
54d5dcd0a0
156 files changed
+4337
-2995
No files matched your search
@@ -67,6 +67,33 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class ajax extends Controller
|
||||
{
|
||||
/**
|
||||
* Load the mini profile on demand
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function miniProfile(): void
|
||||
{
|
||||
/* Load the item */
|
||||
try
|
||||
{
|
||||
$author = Member::load( Request::i()->authorId );
|
||||
$anonymous = (bool) Request::i()->anonymous ?? false;
|
||||
$solvedCount = is_numeric( Request::i()->solvedCount ) ? (int) Request::i()->solvedCount : null;
|
||||
if ( $author->member_id and Request::i()->solvedCount === 'load' )
|
||||
{
|
||||
$solvedCount = Db::i()->select( "COUNT(*)", "core_solved_index", ["member_id=?", $author->member_id] )->first() ?: null;
|
||||
}
|
||||
|
||||
/* return the json */
|
||||
Output::i()->json( [ 'html' => \IPS\Theme::i()->getTemplate( "global", "core" )->miniProfile( $author, $anonymous, $solvedCount ) ] );
|
||||
}
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
Output::i()->json( [ 'error' => 'not_found', 'errorMessage' => Member::loggedIn()->language()->addToStack( 'author_stats_cannot_load' ) ], 404 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Member
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user