Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 28, 20222 yr Hello everyone, I come to you because I have a question concerning my integration. I have User Control Panel made with Laravel (mydomain.com) And Invision Community as Forum (forum.mydomain.com). What I would like to accomplish : If the user is not logged in, he's redirected to the default Invision Community login handler. If the user is logged in, he's also logged in on Laravel (mydomain.com) and Forum (forum.mydomain.com) Have the ability to retrieve user informations (core_members) from the Laravel (username, avatar .. etc) How can I accomplish this? (and in a secure way) Thank you ! :)
April 28, 20222 yr You would need some sort of custom third party development work to facilitate this. There is not any sort of native integration with Laravel today.
April 28, 20222 yr As mentioned, you would require some SSO development in order to achieve this. You would need a 3rd party developer to do this, or we do offer this as a paid service on our creator pro and upward, which you can see on our packages page here https://invisioncommunity.com/buy
April 28, 20222 yr I for my project with Laravel 9 decided to use the user management of IP.Board, the user logs in from the forum and has full access also to the portal in Laravel, like commenting articles. To make Laravel communicate with IP.Board just call the file init.php in AppServiceProvider.php class AppServiceProvider extends ServiceProvider { public function register() { // } public function boot() { $path = base_path('../forum.***.ext/'); require_once $path . 'init.php'; view()->composer('*', function ($view) { \IPS\Session\Front::i(); }); To get user data on a laravel blade I use: {{\IPS\Member::loggedIn()->name}} I hope this can be a starting point to help you develop what you want.
April 29, 20222 yr Author 12 hours ago, Askancy said: I for my project with Laravel 9 decided to use the user management of IP.Board, the user logs in from the forum and has full access also to the portal in Laravel, like commenting articles. To make Laravel communicate with IP.Board just call the file init.php in AppServiceProvider.php class AppServiceProvider extends ServiceProvider { public function register() { // } public function boot() { $path = base_path('../forum.***.ext/'); require_once $path . 'init.php'; view()->composer('*', function ($view) { \IPS\Session\Front::i(); }); To get user data on a laravel blade I use: {{\IPS\Member::loggedIn()->name}} I hope this can be a starting point to help you develop what you want. Hi, thank you for your reply. I have already tested this solution : public function boot() { $path = base_path('../forum.vice/'); require_once $path . 'init.php'; view()->composer('*', function ($view) { \IPS\Session\Front::i(); }); } I'm logged in the forum but in Laravel blade I got token like "4d99edd69d5019629c6a37e13382fd0e" when I call : {{\IPS\Member::loggedIn()->name}} Do I have to do anything else ? About session or cookie domain ? Thank you 🙂
April 29, 20222 yr 1. Keep in mind that Laravel won't take care of the proper output, so language string keys will be returned as hashes. 4d99edd69d5019629c6a37e13382fd0e is probably the hash for "Guest".
April 29, 20222 yr Author 6 minutes ago, Daniel F said: 1. Keep in mind that Laravel won't take care of the proper output, so language string keys will be returned as hashes. 4d99edd69d5019629c6a37e13382fd0e is probably the hash for "Guest". Yeah but it's the same in the AppServiceProvider like : dd(\IPS\Member::loggedIn()->name);
April 29, 20222 yr I have moved this over to our developer forum, since its not general support this one. 🙂
April 29, 20222 yr Solution 2 hours ago, Salim Trouve said: I'm logged in the forum but in Laravel blade I got token like "4d99edd69d5019629c6a37e13382fd0e" when I call As Daniel said, that hash indicates that the user is not logged in. Check cookies if the cookie is saved correctly. I did the integration years ago so I don't remember precisely, but you will see on the IP.Board constants.php file you have to indicate the Cookie Domain and the path, here is my configuration: \define( 'COOKIE_DOMAIN', 'MainDomin.ext' ); \define( 'COOKIE_PATH', '/' ); Because otherwise IP.Board cookies will be only for the subdomain
February 28, 2024Feb 28 Just a quick note, all these years later. I've just tried the above on our servers with PHP 8.3 & Laravel 10 and it works perfectly, the only real difference is I used a Facade and also typed the $view variable passed to the view composer, not that it's used. <?php namespace App\Providers; use Illuminate\Support\Facades; use Illuminate\Support\ServiceProvider; use Illuminate\View\View; class AppServiceProvider extends ServiceProvider { /** * Register any application services. */ public function register(): void { // } /** * Bootstrap any application services. */ public function boot(): void { require_once(base_path('../') . '/init.php'); Facades\View::Composer('*', function (View $view) { \IPS\Session\Front::i(); }); } }