In Drupal 6, we can configure the 404 Page not found and 403 Access denied urls @ admin/settings/error-reporting. Everything seems works fine except the 403 Access denied page will use the Administration theme. If you want to apply the site theme on it, the following patch could help.
theme403fix-759836.patch
Continue reading Drupal 6 – Wrong theme on 403 page
Tag Archives: Drupal
Drupal 7 – Add PHP field to view
Starting from Drupal 7, the Views Custom Field module is replaced by Views PHP.
Continue reading Drupal 7 – Add PHP field to view
Drupal – Limit the number of values of a content type field by role @ 2
Previous: Drupal – Limit the number of values of a content type field by role @ 1
Another way to limit the number of values of content type field is adding an extra validation on the node create/edit form. Assume we have a content type called center and a media field called field_center_video.
1. Create a custom module and add an extra validation. Continue reading Drupal – Limit the number of values of a content type field by role @ 2
Drupal – Limit the number of values of a content type field by role @ 1
Sometimes will be want to restrict the number of values of content type field by roles. In that case, we could create a custom module and alter the node create/edit form. The following example will unset any field values which are outside the limit.
Continue reading Drupal – Limit the number of values of a content type field by role @ 1
Drupal 7 – Autoload View rows when scrolling down like Twitter
The Views Infinite Scroll integrates the jquery-autopager with Drupal and makes any view page behaves like a Twitter page.
1. Download the module and extract it.
2. Download the jquery-autopager to the views_infinite_scroll/js. (Download)
3. Enable the module
Continue reading Drupal 7 – Autoload View rows when scrolling down like Twitter
Drupal – Clear Cache programmatically
Use the following function to clear the Drupal cache programmatically.
drupal_flush_all_caches();
Done =)
Reference: Drupal API – drupal_flush_all_caches
Drupal 7 – Restrict Access by Role (403 Access Denied) for specific paths
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
Drupal 7 – Redirect anonymous user to login page on 403 access denied
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
Drupal 7 – Render the Privatemsg send message form programmatically
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
Drupal 7 – Modify the internal/system path of Taxonomy Terms
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