Adding custom access condition to menu item.

As Drupal is hailed as good CMS if you want to alter any existing thing.
The hook architecture of drupal makes it possible to alter any thing.
 
You can also add custom acess callback for any menu item.
To add custom menu access callback you can user hook_menu_alter() function.
 
As per the documentation this hook Alter the data being saved to the {menu_router} table after hook_menu is invoked.
 
This hook is invoked by menu_router_build(). The menu definitions are passed in by reference.
Each element of the $items array is one item returned by a module from hook_menu.
Tags: 

Adding role to user programatically

 

Recently i had some task, in which i wanted to add the specific role during registration programatically.
After searching in Drupal API, i came across two function that can do the task for me.
 
function user_role_load_by_name($role_name) 
 
This function fetches the role from the role name, and it will return a fully-loaded role object if a role with the given name exists, or FALSE otherwise.
 
I used this function to load the role object which i passed as string in $role_name.
 
Now function  user_multiple_role_edit() will allow to add roles to the users.
 
function
Tags: 

Display user email on the user profile view page to administrator users

 

Recently working with administrator account i encountered a problem. When i visit the profile of other user, i was not able to see the email id of the registered user.
 
To view the user email id either i have to goto the user profile and then click "Edit" tab for that account that will show the account for the user.
 
Now i wanted to show the email id of the register user to be displayed when administrator views the profile.
 
After little bit googling  i found a hook that can alter the view of the user profile
As we can see the description of  hook_user_view() this hook is called
Tags: 

Cool trivia about chrome extension ids

Have you ever wondered that a Chrome Extension ID is basically something like "pjkljhegncpnkpknbcohdijeoejaedia", a 32 long alphabetic characters identifier that uniquely identify a Chrome Extension.

At the very beginning of Chrome though, this identifier could also contain some numbers. And in some certain cases, it could contain only numbers. Ok... what's the issue here?
As a matter of fact, it turned out that Chrome would consider the full-numeric Chrome Extension ID as an IP address.
Instead of tweaking the net stack, Google Chrome Team decided to use [a-p] encoding instead of [0-9a-f].

Pi's Lullaby

 

Lullaby of PI from the Movie Life of Pi

Oh my love
Oh the delight of my eyes


would you not sleep my love?


are you the peacock or the plumage of the peacock?
are you the cuckoo or the cry of the cuckoo?
are you the moon or the light of the moon?
are you the eyelashes, or the dream?

are you the flower or the nectar?

are you the fruit or the sweetness?

Tags: 

Pages