Integrating Forum into Django CMS - django-cms

I want to integrate my existing app, say a forum into Django CMS.
The problem is I don't want users to have any Django CMS capabilites.
They should not be able to see the edit bar or anything Django CMS related.
I only want them to have access to other Django apps. No Django CMS specific things like pages, plugins etc.
Is it possible? How?

The simplest way would be to restrict the CMS toolbar to super users;
{% if request.user.is_authenticated and request.user.is_superuser %}
{% cms_toolbar %}
{% endif %}
The toolbar is also part of the request object so in your app views you could disable it by doing something like request.toolbar.show_toolbar = False (docs)

Related

Symfony2 Sylius e-commerce check for routes

I am working with Sylius e-commerce (Symfony 2), and I want to know is it possible to check is my route accessed.
For example if I have 3 kind of routes :
../aboutus.. /home.. /contact
and how I could check if my /home is accessed so I can do some actions about that.
Thanks,
Cheers
I think that I've found solution to this, in a twig.template you can do this:
{{ app.request.get('_route') }}
that returns path of accessed route

Can Django-CMS custom plugins be restricted to a specific template?

I have a very simple plugin in my cms_plugins.py file
I want the editors of the site, to only be able to select this plugin form a specific template.
Is that possible?
Yes have a look at the CMS_PLACEHOLDER_CONF setting
Yes you have a lot of amazing choices in Django CMS please listen to the amazing tutorial with source code and video tutorial in Django-CMS here in this link here
it is illustrate Django CMS Plugin step by step and placeholder in django cms

Symfony2 FOSUserBundle Global template

How can I force FOSUserBundle to render all its pages as a part of my global template.
i tried to insert layout.html.twig from FOS UB to {% block login %} in my ::base.html.twig file which is above my default content in {% block body %}. when user enters page and logs in its ok but if he make for example password error he see only login form not the whole page.
I have also overriden layout of FOS UB to extend ::base.html.twig but how to make next steps?
Check Override template section of the doc.
Edit
Login action redirection is done by Symfony's internal Authentication/firewall system. If you enter wrong password the Symfony automatically redirects to login action you defined in firewall. For more info you can check Security section of the book. In this case you have to modify login.html.twig of FOSUserBundle to use your base template.

Symfony2 security functions in Twig? How to check the user's role?

I have Symfony 2.0.9 standard edition installed with JMSSecurityBundle. Just wondering what functions are available to me in a Twig template to deal with users?
Specifically I want check to see if a user has the role ROLE_ADMIN.
Any help?
Thanks
{% if is_granted('ROLE_ADMIN') %} ... {% endif %}

Multiple user profile templates based on url in Drupal 7, theming user profile

Used user-profile.tpl.php to customize user profile page.
Need to use a custom template when accessing urls like 'user/3/photo' or 'user/5/photo'.
How to use multiple user profile templates based on path / url in Drupal 7? What name should I use for the template?
I'm not sure what module you're using to generate the 'user/X/photo' pages, so it's difficult to tell you exactly what template file to use. However, when in doubt about how to theme something in Drupal, install the Theme Developer module. It will allow you to see what theme file or function is currently outputting a specific page or area of the page, as well as what files or functions can be used to override it. See the screencast for more detailed information.

Resources