The GoAway module allows you to ban visitor of your Drupal website by IP address. Just download and enable the module and then browse admin/user/goaway where you can manage the ban list by IP address.
Continue reading
那些年,我們一起追的女孩。
Drupal – Show exposed filter value in Views header/footer
I want to show the submitted exposed filter data in the Views header/footer. This can be done by retrieving the $view object in PHP. The following code will printed the exposed filter data. Apply it to the Views header/footer with PHP enabled.
Continue reading
jQuery – Simple Dropdown Menu
I found a excellent article about creating a drop down menu using jQuery written by Abhishek Bhardwaj. For simplicity, i merge the .js file and the .html into one file.
Continue reading
Drupal – Get taxonomy term by term ID
In Drupal 6, you can get the term object using the following function
taxonomy_get_term($tid);
Continue reading
Drupal 7 – Get number of nodes of Taxonomy Term in Views
About 2 months ago i published a post on how to get the number of nodes of a specific taxonomy term by term ID.
Drupal – Get number of nodes of Taxonomy Term by Term ID
Unfortunately, the taxonomy_term_count_nodes() no longer works in Drupal 7 but you can get the count by Views in D7.
Continue reading
PHP – Convert URL into clickable link with UrlLinker
Yesterday we have talked about converting URL into clickable link by Regular Expression.
PHP – Convert URL into clickable link by Regular Expression
If you want a more complete and robust solution, you can try the UrlLinker written by Søren Løvborg.
Continue reading
PHP – Convert URL into clickable link by Regular Expression
I want to convert the all URLs in a string into clickable links. I found a solution in StackOverflow but probably it only works in PHP 5.2 since it uses eregi_replace() which is deprecated in PHP 5.3. So use it with cares.
Continue reading
Ubercart – Get the product picture
You can get the product picture by the product node id using the following function
print uc_product_get_picture(<product node id>, 'cart');
you can use any other ImageCache settings by replacing the ‘cart’ parameter.
Done =)
Drupal – Check if user has logged in
The following piece of codes check if the Drupal visitor is logged in or not.
...
if (user_is_logged_in()) {
// user is logged in
} else {
// anonymous user
{
...
Done =)
Reference: Drupal API – user_is_logged_in
