User login

How to

Information on how to do something... anything.

Drupal 6 theme from a module

Comment Module Example

Most of the time, the best way to learn is from looking at core. Randomly clicking around in a Drupal 6 download led us to modules/comment, where we noticed comment-folded.tpl.php. Aha! A template file with that name will probably not be called automatically by Drupal's template systems (as node.tpl.php might). So let's see just how comment.module handles this.

The _theme hook alerts Drupal to the presence of theming functions and, as in this case, a template:

Update a Debian user's password and passkey and grant sudo access

For a user named agaric:

sudo passwd agaric
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

From a different server with working id_dsa public key that had been cat'd into authorized_keys:

scp authorized_keys ben@example.org:~

Then back on the server to which we're updating this user, from your own home directory to which you just uploaded the authorized keys file.
sudo mv authorized_keys /home/agaric/.ssh

Configuring Global Redirect and Path Redirect

The modules in question:
Global Redirect: http://drupal.org/project/globalredirect
Path Redirect: http://drupal.org/project/path_redirect

Download and place your modules in the sites/all/modules directory of your site using your chosen method. Agaric recommends Drush.

Confirming a merge as non-destructive

It worked this time, anyway. Reviewed the diff (for two different revisions? brain/memory not working), and then when it appeared none of the changes conflicted, ran the subversion update.

-bash-3.00$ svn diff sites/default/modules/change_agents/user_profiles/user_profiles.module

Index: sites/default/modules/change_agents/user_profiles/user_profiles.module

Reset your Drupal checkout so that it is clean and ready to try more patches

$ cvs update -C
(Locally modified node.admin.inc moved to .#node.admin.inc.1.24)
(Locally modified node.module moved to .#node.module.1.974)
(Locally modified taxonomy.admin.inc moved to .#taxonomy.admin.inc.1.27)
(Locally modified taxonomy.module moved to .#taxonomy.module.1.425)
(Locally modified taxonomy.test moved to .#taxonomy.test.1.3)

[... and a ton more stuff]

cvs update -C will move all the files you have changed to a renamed file and bring down the originals again.

Resolution

Redirect to Drupal front page

<?php
    // if the data's not good, send us to the home page
    // note:  drupal_goto without any arguments sends to / - the front page
    // or could use <front> -- url() is called and treats the same
    // so this is not necessary:
  return drupal_goto(drupal_get_normal_path(variable_get('site_frontpage', 'node')));
 
   // this will do:
  return drupal_goto();
?>

Resolution

Synching a new Webform with Salesforce

http://example.com/admin/logs/salesforce/webform

"Ensure all Webforms are exposed to Salesforce"

The form will be exposed to Salesforce module. Then go back to:

http://example.com/admin/logs/salesforce

Where the form will be listed as disabled:

[See screenshot]

Configure first, and then enable.

File: 

Installing XSL for PHP

The Hard Way

This link covers almost any kind of server or PHP setup, but it's very complicated:

Configuring and Testing PHP Servers for XSL Support
http://flex.sys-con.com/node/200299
Other notes on "Recompiling with XSLT support"
https://forums.misdivision.com/archive/index.php/t-188.html

Print name and filename of the top-most file attached to a Drupal post

This is very much a hack, as it puts far too much database loading and PHP logic not even in the theme layer, but worse, embedded in the content itself. A better version might use the theme layer to make the $filename and other such variables available to certain content types with files attached, for instance.

For now... here's the hacky way. But first, some of the research to get us there:

php get first element of array
http://us3.php.net/reset

Syndicate content