Unpublish blog content after a certain time in drupal 8 - drupal-8

Hello i want to unpublish blog content after a certain time in drupal
8 how i can do it please help me

Easy peasy, there's a module called Scheduler https://www.drupal.org/project/scheduler
Upon creation you can set any time you want when the content should be unpublished note that this works on CRON execution.
If you don't want to schedule unpublishing time every time you create a blog and you just want to unpublish blog lets say 1 year after publication you can do a form alter and set the default date for a scheduler today's date + 1 year.
Another option is to create a function get_blog_posts where you put a condition to exclude blog posts older than 1 year - if your page is created programmatically.
If you are using views to display you blog post it's even easier - just add filter by authoring date - authored date is less than 1 year.
Let me know which option suits you more and I can give you more details if needed.

Related

Dynamic filters with power bi reports

I have a very big database with a lot of tables. Let’s imagine this is Amazon customer database.
I have several users which want to make queries on this database. For example : « give me all customers which live in this area, are between 20 and 30 years old, have spent between 200 ans 300$ in 2017 and which did not made any order last 6 month and which visited product pages talking about video games last 3 days ».
Queries can concern every table and every field. I do not Know at development step which criteria will be needed by users. It can change every day.
What i need is to provide an universal query tool.
I have deployed power bi and i need to add dynamic filters inside the report but i do not know how...
My problem is i want to embed filters INSIDE the report
Thanks

Scheduling/Queueing Tasks Django/Celery

I'd like to add a scheduling option to allow user to manually input a date and time that would delay their post to be published to that specific date/time. So if the user uploads five posts in one day but only wants to publish one per day, then they could input a specific date and time for each post to be published (i.e. Post #1 publish on 1/8/18 3:30pm, Post #2 publish on 1/13/18 4:00pm, etc.)
Thinking about using Celery to approach this problem. Having trouble visualizing how to connect Celery Tasks to the Post Form (or Model) so user can have the option to adjust the timing according to their scheduling needs. If you could explain with visual examples and where the examples are taking place (i.e. views.py, etc.) that would be greatly appreciated. Thanks!

Testing Firebase Funnels

I wanted to know a simple question regarding setting up my first funnel in Firebase. If we wanted to know which unique users (on a specific day) first opened the app and removed it, would the below simple funnel be sufficient ? Note: On the filter date, I selected "Yesterday".
Question:
Would this selection enable me then to view only those users that did "First Open" (my base) AND "App removal" on the same day (on D0) ? or is this an open funnel of a wider base: i.e. users that somewhere in the past did first_open and did a app_remove yesterday ?
I read that Firebase is only considering open funnels by default, and if we want to make funnels more "closed", we would have to log separate custom properties and filter to form closed funnels (Source: How do you create a closed funnel?). So, there is a bit confusion of how open this funnel really is.
Thanks!
As you mentioned, Firebase Analytics funnels are open; meaning that completion of the first step is not strictly a prerequisite of the second step. In this case, your sequence of events is a strict sequence (i.e. you can't log an app_remove without first having logged a first_open), but still, the query for each step is independent for "Yesterday". In other words, the funnel is effectively as you suspect : step 1 shows users who have logged first_open yesterday and step 2 shows users who have logged app_remove yesterday (regardless of when they first opened the app).
Your options are :
Use the "Last 7 days" date range instead of Yesterday and filter the funnel by the built-in "New users" user property.
Create an audience of users who log app_remove whose First Open Time user property = [some future day] and then after that day passes, use this audience as a filter on your funnel.
Perform this analysis in BigQuery instead.

Partially apply a CreditMemo on NetSuite API

im working on an integration between our company systems and NetSuite using PHP. Before the newest release of the NetSuite platform we were able to partially apply an existing credit memo to an specific pending invoice, but since their last release a couple of weeks ago every time we try to apply the credit to an specific invoice through our middle PHP system, it also applies all the other pending invoices in the account.
Let me specify a little more:
We have customer accounts, every account can have any number of open invoices. Lets say we have 3 invoices in the account 1. The first is for $20, the second for $30 and the last for $25. Then we create a credit memo associated to the account 1 for $75.
Then a week later we want to kill the first invoice of the account 1, the one with the $20 value. Then we command the credit memo to kill that invoice through our system. That would mean the first invoice is cancelled, we used $20 from the $75 we had in the credit and we still have $55 without use. Right?
Well, now for some reason the credit kills all the 3 invoices the account 1 had pending, even though we specify that only the first one should be applied. That consumes all the $75 of the credit memo, which of course messes up our accounting and prevents us from using it later in other invoices as we need it.
Just a few more points:
We are uploading our credit memos with property "autoapply" set on false.
When we want to apply an invoice we set its "apply" property as true and the ones from the other invoices as false, then we make an update request for the credit memo with that info. Thats how we always did it but now for some reason it doesnt works.
Sorry if its a little long, but i wanted to be really specific. If you have had a similar problem or have any insight on the matter i would greatly appreciate any help you can give. Thanks.
One suggestion you can try as I have experienced this as well. I had an issue where the user whose log in I was using for the integration entered a new credit memo, checked the box to auto apply and from then on every CM I imported through web services auto applied and did not respect the Auto Apply setting I submitted.
Log in as the user that you are authenticating with for the integration. Open a new credit memo and see if the Auto Apply check box is checked by default. This is a "sticky" setting in NetSuite. Enter a new CM As the user with the box unchecked and then delete it if you like. When I did this it stopped checking the box automatically and my CM import worked as expected again.

Sitecore - how to preview an unpublishable item

I have a simple requirement to be able to setup and preview pages in advance. The pages are for publication on a particular day and are one-off publications. They must not be visible prior to publication.
How can I preview the item prior to publication without making anything public?
If I restrict the version (i.e. version 1) from being published, I still get a published page showing standard values i.e. version 0 of the item.
If I restrict the item from being published, I can no longer preview it. It seems that the preview function has a dependancy on the item being publishable.
Am I missing a trick here?
Update : I'm particularly interested in why I can't preview the item when the item is restricted, as this is possibly the most intuitive restriction a user can use.
You can set a date restriction on the version or the item.
Then go to the preview mode and use the date selector to select a different date.
When you select a date that falls within the publication date range, your item will be visible in the preview.
Update:
As you're particularly interested in previewing restricted items; it can be done if you setup a new site and point it to the master database instead of the usual web database.
This is explained in a blogpost by Mark Ursino.
As Rudd mentioned, my blog post explains how to do this. However, you can also setup a new workflow provider by Alex Shyba that allows for semi-final workflow states and thus allows publishing to them: Publish to pre-production web database. Part 2.