News:

Wondering if this will always be free?  See why free is better.

Main Menu

Use SMF Users in a Symfony website

Started by klespios, March 05, 2018, 05:16:00 AM

Previous topic - Next topic

klespios

Hello !

I am currently working on a website composed in two parts : One with Symfony (the biggest part of the website) and an other one with SMF.

Because users are already handled with SMF I wanted to use them in the Symfony part. I used this to try : https://wiki.simplemachines.org/smf/How_to_use_the_SMF_user_system_outside_of_SMF

When I add the good require I have an error message :
"Connection Problems
Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later."

But when I open the Forum itself it works while it's not the case when I do from my Symfony website.

Here is my test to use "SSI.php" :

<?php



namespace BackOfficeBundle\Controller;



use 
BoutiqueBundle\Entity\Produit;
use 
BoutiqueBundle\Form\ProduitType;
use 
Symfony\Bundle\FrameworkBundle\Controller\Controller;
use 
Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use 
Symfony\Component\Form\Extension\Core\Type\SubmitType;

require_once 
__DIR__."/../../../../../forum/SSI.php";

class 
DefaultController extends Controller
{
    
/**
     * @Route("/back_office")
     */
    
public function indexAction()
    {

     if ($context['user']['is_guest'])
{
return $this->render(ssi_login());
}
else
{
            
            
$em $this->getDoctrine()->getEntityManager();
            
$p = new Produit();
            
$form $this->createForm(ProduitType::class, $p);

            echo 
"dede";
            if (
$form->isSubmitted()) {
                echo 
"coucou";
                
$em->persist($p);
                
$em->flush();
            }
            return 
$this->render('BackOfficeBundle:Default:index.html.twig', array(
                
'form'=> $form->CreateView()));
            }
    }
}


It'd be very nice if you have any idea,

Thank you in advance,

Klespios


Kindred

Have you turned OFF local cookies and turned ON sub-domain independent cookies?

Instead of the relative path to SSI with all the ../../.. I recommend using the absolute path.


you didn't globalize $context

I am not certain how the SSI functions will respond to being used within another parser (you call SSI by using a separate function, render
return $this->render(ssi_login());

I am unsure how this will work, if at all...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: