Questions about PHP not related to Drupal should be asked on Stack Overflow. Don't use this tag to generally mean "the question is about PHP code."
-1
votes
0answers
14 views
Enable php module using drupal [on hold]
I would like to install/enable a php module like curl,zip extension etc. using drupal.
Can anyone help me out with this?
1
vote
1answer
10 views
rewrite cck option values list using php
I use finder module for Drupal 6. There is a possibility to rewrite cck select options list using php. In a cck field I have following options with values and names:
1|a
2|b
3|c
It doe's not matter ...
1
vote
2answers
22 views
Drupal is not saving any changes made through administrator, Drush works fine
I just began working for a company and am using Drupal for first time. I'm working locally on WAMP. I started by installing and configuring a few modules before making my own and everything worked ...
0
votes
2answers
16 views
Drupal6 how to hide primary navigation
Is there any function like is_page(like in word press) in Drupal 6
so that I can hide primary navigation menu which is (printed using echo statement) in page.tpl.php.
My requirement is to hide ...
0
votes
2answers
20 views
How to create complex conditional clauses / queries?
I've been reading the documentatoin on conditional clauses and also studied the api description for db_and() and db_or() but I fail to create a $query with 3 ->conditions:
select all between 0 ...
-2
votes
0answers
19 views
multiple pages form data to csv file [on hold]
I have a requirement to send multiple pages form data directly to csv file ..not to database .
can any one suggest me a module or code snippets for this thank you.
I really appreciate your help.
3
votes
1answer
36 views
How can I update user data whenever a user account is saved in PHP?
I need to do some processing (calculate a zodiac sign) on some user data after an account is saved. (When saving a user account, I want to use a custom module to re-compute a field and save the new ...
0
votes
1answer
33 views
Create a node programmatically then reference an existing node to that node?
I'm using Drupal 7 and trying to create a node programmatically. Once the node has been created I would like to reference it to an existing node
I'm creating a node programmatically like below
$node ...
0
votes
1answer
28 views
Add Dynamic Wrapper div to a Row
I have buttons below a slideshow I have created. I want them to be centered whether there be 1, 2, etc. I'm looking to have a wrapper div surrounding them with a class name of "button-count-x" (x ...
3
votes
1answer
16 views
How can I set the value of a taxonomy term reference to multiple terms using PHP?
This question describes how to set the value of a term reference field using PHP. But what do I do if I want to set the value of a term reference field in the user profile to multiple terms?
I am ...
1
vote
2answers
52 views
How can I get a field value of a node using PHP?
I have created a field in a Basic Page with the label of User Name and the field name of field_user_name.
How can I get it's value using PHP?
0
votes
0answers
13 views
Drupal Commerce: How to check the original currency code before rounding prices
Based on this I tried to modify the price to do the rounding. But I want only the original currency code = USD are rounded.
I use the devel module dpm ($content); to see variable, and tried like ...
0
votes
0answers
12 views
Display Suite code field taking wrong branch
I am trying to make a Code Field that checks if the value of [node:taxonomy-catalog] is equal to "Shirts." By manually outputting that value, I checked that it is in fact equivalent. I'm making this ...
0
votes
2answers
62 views
How do I use Font Awesome on a Drupal form submit button?
So I've got Font Awesome working on my Drupal 7 site. I'm not using the Font Awesome Drupal module. I'm just declaring the style sheet in my template.php like so...
function ...
0
votes
1answer
30 views
Staging site created from a production site is blank [closed]
I have a requirement to create a staging site (there was no previous staging site) from a production site (this site is pretty old). It contains a huge database.
Can any one explain me the steps?
I ...
3
votes
1answer
47 views
How do I programatically submit a webform via drupal_form_submit?
Drupal 7, Webform 3
I want to programmatically submit a webform via drupal_form_submit. However, I'm having difficulty finding a $form_state structure that works. I've submitted my webform via the ui ...
0
votes
0answers
22 views
Group By with multiple values (Views PHP)
tl;dr: How does one return multiple values from a views php field so the values can be individually grouped.
I have a View with a PHP field which consists of the following code:
$node = ...
0
votes
0answers
11 views
make webform variables available outside function
I've got a Drupal/php question I'm stuck on.
I'm creating a module to intercept webform submissions and send them to a third party API.
I'd like to make the variables created in my ...
1
vote
1answer
20 views
Writing to a custom field in PHP
In Drupal 7, using the Field module, Field SQL Storage and Field UI I've created several custom user fields. I can display them in PHP like this:
global $user;
$account = ...
0
votes
0answers
18 views
Node ID will only Print for Certain Pages
I have this code for a Blog content type:
<?php $var1 = menu_get_object(); ?>
<?php $var2 = $var1->nid; ?>
<div><?php print $var2; ?></div>
The main blog page and ...
1
vote
1answer
68 views
Warning: Cannot modify header information - headers already sent
My log is cluttered with this message:
Warning: Cannot modify header information - headers already sent by (output started at /home/path/to/drupal/7/includes/common.inc:2681) in drupal_send_headers() ...
-1
votes
0answers
17 views
Need to replicate exact function of “save node”, (not just node_save())
I have several contrib modules that hook onto the node-save (form submit) function when a node is created. However, I have imported many nodes through feeds and thus bypassing the save process.
...
0
votes
0answers
26 views
views_get_view() returning empty arrays for fields?
I'm trying to get the results of a view so that I can pass each row returned by the view to Javascript as an object on which I can then run data visualization (using D3.js). Essentially what I'm ...
1
vote
1answer
25 views
Display (and pass) a custom user field in php
In Drupal 7, I've added some custom fields in Account Settings>Manage Fields. One of them is field_company_name. I'd like to be able to display this field and pass it to an external php function.
I ...
0
votes
1answer
30 views
Get the TID from taxonomy view
I am using one of the packaged views that comes with the Views module titled 'Taxonomy term' to handle what product looks like when someone searches the taxonomy. Is there a way to grab the tid of the ...
0
votes
0answers
56 views
7 - Update a user with services
I'm using Drupal 7 and the services module and I'm trying to update a user profile using PHP & Curl.
Do I always have to login before sending a "PUT/update" ?
This is my code so far :
<?php
...
0
votes
1answer
30 views
Site install fails with Aegir
I've been using Aegir to install Atrium sites without a hitch. Users self register through Aegir to spawn their own open atrium sites. Today I noticed new atrium sites failed to install. A week ago ...
0
votes
0answers
44 views
Views: get image-field with global php
im using Drupal 7 and views 3.
in a global-php-field i tried to show the image from field_artengalerie_term_bild. But
print $row->field_artengalerie_term_bild; shows the nid only. then i tried ...
0
votes
1answer
73 views
How do I set up PayPal parallel payments in Drupal 7 Commerce Express Checkout module?
After an exhaustive online search, I can't find an answer to my problem: where do I place the code snippets PayPal provides to implement PayPal parallel payments in Drupal 7's Express Checkout module? ...
0
votes
0answers
20 views
Image attribute function on all image styles
I have a function in template.php:
function mytheme_preprocess_image(&$variables) {
if ($variables['style_name'] == 'gallery') {
$variables['attributes']['class'][] = 'lazy';
...
2
votes
1answer
40 views
Rules in Drupal 7: EntityMalformedException in custom PHP
I used to run successfully the following custom PHP code in rules before a node is stored
$update_node = node_load($node->nid);
$lat1 = floatval($node->field_geo["und"][0]["lat"]);
//SOME MATH ...
0
votes
1answer
47 views
Is there any side effect to use APC installed on shared hosts? [closed]
I'm using a shared host for a Drupal6 site.
And this shared host has an option to use "APC".
I just tried this option on a test site as it can be enabled just by one click on my account page of the ...
0
votes
1answer
30 views
block visibility based on user
I would like to remove certain blocks, so that admin can not see them.
In block visibility settings - in pages tab, I try to put followng php code but with no effect. (In user tab there is no php ...
1
vote
0answers
38 views
clean URL test failed D7 [closed]
I have spent about three hours trying to get clean URLs to work and it is really doing my head in. I am VERY new to Drupal and after hearing all the wonderful things about it, this is really a big ...
0
votes
2answers
13 views
Profile Module PHP code
What's the best way to profile custom PHP code I've written in a Drupal.
I'm at the optimization point of a project I'm working on.
0
votes
1answer
43 views
drupal 7 Views: output a field with views php
Drupal 7.22
Views: 7.x-3.7
i have the field "content:path" and i want to output the containing data with php. I use a global php field.
it shows me this:
Available variables
$row->path: Inhalt: ...
0
votes
0answers
19 views
OG services add new group
I want to use Organic groups Services module to add by PHP new Organic Group node.
I wanted to do it in this way:
$opts = array('http' =>
array(
'method' => 'POST',
...
1
vote
2answers
85 views
Create a node using services with PHP
I want to add a new page node using drupal services and REST server.
$postdata = http_build_query(array(
'type' => 'page',
'title' => 'aaa',
'field_test[en][0][value]' ...
1
vote
0answers
35 views
hide a field using custom php in rules
Drupal 6 only: I have a button field on a petition node for users to sign that petition. I have custom php in a rule to check if they've signed it before. If they have, I need to hide the button.
So ...
0
votes
0answers
16 views
How to convert drupal parameter to html element
I have custom module which sends list donations to user,i pass set of donations as a parameter but problem is pass list of donations shows as string not as a html elemt
foreach($donation as $dd) {
...
0
votes
0answers
74 views
Installed TCPDF and encountering PHP Fatal error: Cannot use object of type REPORT_PDF as array
I am using Drupal version 7.18 and have installed TCPDF package in my library under /var/www/html/drupal-sites/all/libraries
Everything is working well for my generated pdf report.
However, when i ...
0
votes
0answers
13 views
How to add expose View filter for a derived field
I have a Drupal View looking at User profiles. One of the fields is derived, or calculated, which is done using Views PHP.
I'm trying to add an exposed filter for this View, but the expose option ...
1
vote
1answer
52 views
How to programmatically delete all values in custom CCK field for a given node?
I'm on Drupal 6, and I have a multiple value CCK field. I need a PHP function to delete all the values in that field so I can later repopulate it. I am currently doing this:
if ...
0
votes
2answers
46 views
Print base path in html.tpl.php
Im trying to print the full path to my theme in my html.tpl.php file. In the following code the 2nd part prints correctly but the first part does nothing.
<?php print base_path() . ...
0
votes
0answers
21 views
PHP snippet won´t work: unset() a commerce checkout pane with custom module
This D7 snippet won´t do anything in my code and I don´t know why:
<?php
function mymodulename_commerce_checkout_pane_info_alter(&$checkout_pane) {
foreach ($checkout_pane as $pane_name ...
0
votes
1answer
26 views
Programatically insert product/order to cart from php file external to Drupal
I have an external php file on the same server, how can I create an item in the checkout?
I have tried this, but I dont know which or how to include the proper files for the functions. Could I just ...
1
vote
1answer
107 views
How to access the order total amount in Drupal commerce?
I'm trying to make a block with an image that would change when there is something in his or hger basket (empty basket image when basket is empty, full basket when it's full)
My understanding of PHP ...
0
votes
1answer
46 views
Is this snippet modification correct? (php snippet in a drupal commerce rule)
I´ve read about the possibility to use this snippet to hide a specific checkout pane (in Drupalcommerce), according to the cart contents.
Could I use this somewhat modified to hide a pane when the ...
0
votes
2answers
103 views
Views: Apply a wrapper to every 3 and 6 group of rows
My Views Output is as follows
<div class="views-row-1">Content</div>
<div class="views-row-2">Content</div>
<div class="views-row-3">Content</div>
<div ...
2
votes
1answer
185 views
Drupal on PHP 5.5
With the feature freeze for PHP 5.5 long past, I figured it was time I post an update to the popular PHP 5.4 and Drupal 7 question.
So, can Drupal run on PHP 5.5?