Use the following function to clear the Drupal cache programmatically.
drupal_flush_all_caches();
Done =)
Reference: Drupal API – drupal_flush_all_caches
Use the following function to clear the Drupal cache programmatically.
drupal_flush_all_caches();
Done =)
Reference: Drupal API – drupal_flush_all_caches
Today i would like share another module about Drupal access permission. It is called Path Access.
With the help of the Empty Page module, i could create any blank templates with different blocks. But unlike Views page, these empty pages do not have access permission settings. Luckily the Path Access module could fill the gap.
If you have enabled the Path Access module, you can configure the forbidden paths for different roles @ admin/config/people/pathaccess.
Continue reading Drupal 7 – Restrict Access by Role (403 Access Denied) for specific paths
If you try to access a Drupal page without proper permission, you will be redirected to default 403 access denied page. But if you have enabled the Redirect 403 to User Login module, you will be redirected to the user login page with destination set to the path which you wanna access.
Continue reading Drupal 7 – Redirect anonymous user to login page on 403 access denied
Privatemsg allows Drupal users sending message to each other. It is a must-have feature of community oriented websites. The module includes all necessary features including inbox, outbox, user block list etc. In my case, i want to render the send message form on the user profile page. So i created a block which generate the send message form by PHP code and attached it to the user profile page. Here you are.
Continue reading Drupal 7 – Render the Privatemsg send message form programmatically
The default path of taxonomy term is taxonomy/term/[term-id]. Although we can now use term alias in Drupal 7, we may still want to change the internal path with a specific pattern. For example, i want to replace all the term page by a view which has term id as input parameter. In that case, i want to set the path of all terms to my-term-view/[term-id] instead of taxonomy/term/[term-id]. This could be done by using the Entity Path module.
Continue reading Drupal 7 – Modify the internal/system path of Taxonomy Terms
Assume we have a Views page which does not have a contextual filter setting and the view path is /eureka. If you provide an argument in the url such as /eureka/abc, the argument is ignored and the Views page will return all view rows. But sometimes we may want to show the user a page not found instead of return all rows. This can be done by adding a Global: Null argument in the contextual filter.
Continue reading Drupal 7 – Show page not found if view argument exists
Yesterday we have talked about 2 normal ways to render the user profile picture in Drupal 7.
Drupal 7 – Render user profile picture programmatically @ 1
Unfortunately you can only get the user profile picture with default size if you have enabled the Gravatar integration moddule. i.e Continue reading Drupal 7 – Render user profile picture programmatically @ 2
Normally, there are 2 ways render the user profile picture programmatically in Drupal 7. But before i show you the code, i would like to introduce the profile picture setting @ admin/config/people/accounts/settings. Continue reading Drupal 7 – Render user profile picture programmatically @ 1
If you have no idea about BeansTag, please refer to BeansTag – The SEO tool for Drupal 7
Although BeansTag is not going to be approved as a Drupal 7 module, i still added some features to it as requested by the BeansTag users. But before i talk about the new features, i want to clarify a BeansTag concept
BeansTag depends directly on the url path.
For example, a node with nid = 1 has an url alias articles/abc, you can create 2 different BeansTags with the following paths.
Sometimes we may need to run some complex and time consuming tasks in Drupal cron but this may result in request timeout. It’s better to setup cron queues and run them in parallel requests.
Yesterday we have setup a hook_cron() task for batch updating nodes.
Drupal 7 – Batch update nodes by cron
Actually we can convert the tasks in the cron queues using hook_cron_queue_info() as follow.
Continue reading Drupal 7 – Use queues for long running tasks in cron