drupal

How to programatically create a Drupal node as user X not Y when Y is logged on

Is there a way for me to do the following: Create a new content object of type 'A': //The global user is user Y $node = new Object(); $node->type = 'A' //etc.. //Save node - but I want the node to look like it was created by user X node_save($node); This is a case where user Y does not have 'create A content' permission, but user X...

Find a redirection on registration

In Drupal, there is a site I have to work on that has an annoying quirk. Anytime someone registers, they are redirected to a custom page. I have grepped for drupal_goto, and looked in the database to find out what is causing this redirect to happen. Whats the most effective way to track this down??? ...

How to get the url for a ajax page?

I'm pretty new to ajax and I applied it succesfully to a Drupal site. But I was wondering, how do I get an URL to a page where part of the content is loaded through ajax. Is this even possible? The JSON object is retrieved on click, so how do I make it work when retrieving a certain URL? I realize this is a very broad questionany, any h...

performing select count across two tables sql

I have a table relationship which links one person to many relatives. so the tables are 1. Client. 2. Client_relative. I want to display all the rows of the Persons table, while displaying a count of how many relatives each person has. I have this query: SELECT c.clientid, c.fname, c.lname, count(cr.relativeid) as relativecount FROM {c...

Theming Webform in Drupal

I'm trying to theme my webform but I can't seem to get the new webform_form_#.tpl.php to load properly. When I go to the node page I get a blank page on firefox with an empty body. So in Template.php i've added the following line (my webform is on node 4) function phptemplate_webform_form_4 ($form) { return _phptemplate_callback('web...

Serving WMV on a drupal site?

I have a WMV file that I need to host on my drupal 6.13 site (on ubuntu 9.x). Is a there a relatively painless way to do this. Do I need the "Video" module to do this? Or can I just install a video player and point my WMV file to it? My other concern is the user should be able to view this video on my site without needing to download a...

PHP string comparison weirdness

I'm comparing a string from the database to a list of strings in an array: if (in_array($entry, array('Söme string', 'other-string'))) This works for other-string, but not for Söme string, the main difference beeing that this string has an umlaut and an html entity in it. If $entry is Söme string in the database, the co...

link to view within a node!

I have a page listed with a series of node titles and these node titles are linked with their nodes. Whenever user clicks a node title it displays the details related to the node and a block view displaying all the data related to the node. On this page i want to display a link to another view which also displays data related to the same...

Drupal 6 Form Api adding an item to an existing form.

Please delete duplicate question ...

Drupal 6 Form Api adding an item to an existing form.

I want to add a new item into an existing form. I have the ID of the form and I know I need to use hook form_alter but not sure how to add it. function modulename_form_alter(&$form, $form_state, $form_id) { switch ($form_id) { case 'form id goes here': // Need to do something here.... break; ...

Load external script in <head> in Drupal 6

I want to load an external script in <head>. It is module specific so I want my module to take care of the loading. In Drupal 6, function drupal_add_js() does not allow to add an external script in <head>. It will be available in Drupal 7 passing the "external" argument to the function. In D6, I can use drupal_set_html_head() instead, b...

Drupal 6 editing the submit function on a content type

I have a content type and I wish to edit the submit function. I thought the way you would do this would be as follows: function moduleName_contentType_node_form_submit($form, &$form_state){ drupal_set_message(t('Test')); } I cleared the cached but the message is not being displayed on the screen. Am I doing this correctly or do I ...

Drupal 6 getting the node title from a submitted form

I am using form_alter to edit the submit function when editing content. In my custom function I wish to edit a custom message to the screen with the title name. I thought a way I could do this is something as follows function mymodule_myfunction(&$form) { drupal_set_message(t('Some text ' . $form['#node']->title)); } The title is ...

Remove required attribute from a CCK FileField

Hello. I have a node with a required CCK filefield. I want to remove the field requirement on certain pages, so I added a hook_form_alter in my module and tried the following: $form['field_image_file']['#required'] = false; which doesnt work! Printing the $form I see that there are loads of places where the #required value is set to...

How do you determine if apachesolr has returned null results

I am looking to execute some code if apachesolr has returned null results for the search query in a separate module. I am looking to leave the apachesolr module and acquia modules untouched. ...

Create a gallery from a CCK ImageField

What I have Currently I have a view that creates a list of entries, each entry has a title, description and multipule images. The view just shows the list right now and all the photos are group from the images field show when you preview the view. (the view is a block) What I am trying to build The list works, however instead of just...

Globally filter the whole site by tag

Hello! I am looking for an easy way to allow visitors of our Drupal 6-based website to filter all displayed obejcts globally by a tag from a given taxonomy ("featured topics"). This way a user could eg. select the tag "marketing" from a drop-down-list, which is located somewhere near the navigation, and the system would filter all pages...

What's a good CMS for an intranet site?

Hey all, I know this question has been tossed around by many developers and designers. I just got finished with my companies intranet site using joomla 1.5 with a custom bulit template and modifying almost everything in joomla. It got me thinking if I should be using an enterprise CMS instead of an free open source CMS. I almost wen...

Programatically Display/Change Menu Link

When an anonymous user comes to the site, the last item in the Primary Links needs to say Login. However, if they are logged in, it needs to say Account. Whats the easiest way to achieve this in code? ...

Bring field content from "parent" node to "child" node in Drupal

What I need to do is bring data from a field in a "parent" node to a "child" node. Something like the following: $myactive_trail = menu_get_active_trail(); $parent = $myactive_trail['2']['link_path']; print $parent->field_video['0']['filepath']; I know that there is not such thing as a parent not hence me trying to use menu_get_active...