Trigger page reload after changes to model instance in DjangoCMS' admin panel - django-cms

DjangoCMS has an admin panel which allows editing of model data without leaving the web page.
Some changes to models, however, require the current web page to be updated and re-retrieved from the server. DjangoCMS does this, for example, in the pages admin page. Certain changes trigger a page reload.
How can I trigger such a page reload in my apps's admin.py if certain changes are made? Specifically, I need to update the page after some bulk actions which change selected model instances in one go (like the standard Delete selected items action).
Example:
I have a blog app which uses a DjangoCMS apphook to show a page with a list of blogposts. I navigate to this page and use the admin panel of the post model to, say, publish 5 blog posts using an admin action.
Current behavior: The posts are marked published but do not appear on the blog list page until I manually request a page reload.
Desired behavior: The mark published action should trigger an automatic page reload after closing the admin panel (if at all possible only if a page is shown that belongs the blog app).
Potential solution: DjangoCMS itself has a hook where my ModelAdmin can register that the page will need to be reloaded after the admin panel closes.

Related

Wordpress Change Front page displays settings conditionally when user is online

Created two pages -> Feeds and Blog
If the user is online then
Front Page displays settings should point to A static page where Front page should be "Feeds" and Posts page should be "Blog".
When the user is offline then
Front page displays settings should point to Your latest posts, default.
For that particular users only.
You can use this function to check if user is logged in:
https://developer.wordpress.org/reference/functions/is_user_logged_in/
And this function to redirect to specific page for each user
https://developer.wordpress.org/reference/functions/wp_redirect/

How to create routes that loads up a new page

Newbie to this entire web development domain.
I have a main page and a registration page. Whenever I navigate to subscription page I find the contents of registration page appended at the bottom the main page. How can I create routes in a way where both pages are separate. So when I click home I only see my main page and when I click registration I only see the registration page.
Thanks in advance.
You can use routing on the server side to serve a separate html page. It can be useful for landing pages, etc.
Usually it's done in Meteor by passing a middleware to connect npm module which is accessible in WebApp.connectHandlers or you could use Iron-Router's server-side routing feature.

Page linking in the admin suite

I'm trying to develop a wordpress plugin but have become unstuck very quickly.
The plugin within the admin is to act as a way for users to set up various database fields so that the front end of the wordpress site can then use these. This is going to happen over several pages, one for each task.
I'd want to be able to load these pages in from links on a main page.
This I can do but these pages do not load into the wordpress admin site they just load on there own.
How can I load these pages in (using hook calls?) to the wordpress admin site, right of the menu?
I have got my plugin to appear in the menu with add_object_page and have called that using add_action. I have a page loading up fine but cannot link to any other pages.
Ok, I was very tired yesterday and failed to try using the slug.
The slug you give to menu items to fire off a function can be used again on other links. The slug will do the same as it does on the menu items!

Adding multiple facebook page tabs from single facebook application using php

I have created a facebook application.
Now i want that using this application i need to add multiple pagetabs in a page.
and all of this i want to do in php
I have completed following steps
1) Logged in to facebook using my php script and got authenticaticationc code for managing pages.
2) Retrieved the list of pages i have in loged in users profile.
Now i don't know how to add a page tab in facebook programmatically.
I know there is a manual option and that is in applications settings to add a page tab
but I want to add it Programmatic using php.
Any help will be very appreciated.
regards
Applications are allowed to have one Page Tab. So if you need to have multiple tabs for same app on single page where is no way to achieve this.
If you desire to add tabs for other applications you just need to issue POST with page access_token (from accounts connection of user who is admin of that page) request to:
https://graph.facebook.com/PAGE_ID/tabs?app_id=APPLICATION_ID&access_token=...
You need either repeat that step for every APPLICATION_ID you want to be added as tab or Batch requests. Read more on page tabs creation in documentation for page object

Google Analytics + Wordpress /dir/ and /dir/index.php appearing as separate items

The Google Analytics information for one of my Wordpress sites is showing /dir/ and /dir/index.php as separate items - is there a way to prevent this from happening?
Yes, in the profile settings set the default page to index.php. Google Analytics Index Page Tracked Separately
Even though www.example.com/ may be the same page as www.example.com/index.html, they show up as two separate entries in your reports. You can configure Google Analytics to treat them as the same page by defining the Default page for your profile:
Click the Analytics Settings link.
In the Website Profiles list, find the profile to modify and click Edit.
Click Edit next to Main Website Profile Information.
In the Default page text box, enter the default (or index) page for this domain. This is the page that loads when a visitor enters only the domain of your site into their address bar. For example, if www.example.com loads your index.html web page, enter index.html in this text box.
Click Save Changes to update your default page, or Cancel to exit without saving.

Resources