Awhile back, I wanted to add author names to the Drupal search index. After poking around a bit, I found that this was actually pretty easy. I created a new module called custom_helper and in it put the following function:
//Adding author name to the search index
function custom_helper_nodeapi($node, $op, $arg = 0) {
switch ($op) {
case 'update index':
if ($node->uid) {
$user = user_load(array('uid' => $node->uid));
return $user->name;
}
}I recently needed to add an extra link to the end of my $items list in a list view and found that this could be done quickly in template.php.
I set out to do two things:
- add a link to the end of my list view that does not contain node data
- as part of this last list item, include a custom link that changes depending on the name of the view
Accomplishing this was a lot easier than I expected. All I had to do was add a switch statement for the view name, and also add a line with the content I wanted to add to my $items array before the theming function.
I recently upgraded this site from Drupal 5.1 to 5.7 on Dreamhost and ran into an odd problem. After upgrading, all of my urls included the path cgi-system. So, instead of my login page being at juliakm.com/user, it was at juliakm.com/cgi-system/user. Because of the url issue, my site lost its theme.
I was banging my head against the wall this weekend trying to remember how to display nodeprofile fields with user information. It's actually really easy and I thought I should write a post about how to do it for the next time I forget.
In this case, I have a content type called 'myuserprofile' that is selected as the content type to use for nodeprofiles. In my myuserprofile content type, I have a field for users to enter their favorite food.
Every once in awhile, when working on a Drupal site, my content either disappears or I cannot log-in. At this point, I usually get rather angry and start thinking of worse case scenarios. What if I can never log into my site again? What if anonymous users can't read articles?
In a rare moment of clarity, I put together the following Drupal permissions debugging checklist. I hope that you find it as useful as I have.
1. Check user access control and make sure that all users can "access content"
Path: mysite.com/admin/user/access