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
vote
1answer
19 views
Using the l() function within a node description field
I'm converting an old site to Drupal, and I need to convert all the old URLs to the new system, which uses pathauto. I can turn the old links into node paths (eg. node/28), but I ideally want the ...
0
votes
0answers
9 views
how to use the facebook api for drupal to import data for views
I have set up a Facebook developer account and have recieved my App ID and my App secret. I have been trying to figure out how to use this information to get views posts into drupal so that I can ...
1
vote
0answers
13 views
Set a custom module variable based on webform nid
I am working on a custom module that hooks into Webform in various ways. Right now I am saving variables using system_settings_form and understand that these will go into a Drupal variables table ...
2
votes
1answer
34 views
Enforce Minimum Length by adding spaces
So currently I am using the maxlength module (https://drupal.org/project/maxlength) in order to enforce the fields maximum length and I have a view set up that is embedded to a php Rules action ...
-1
votes
0answers
11 views
Sync drupal authenication with cakephp
We have designed a system with drupal. Now we want to develop our main system with cakephp. The drupal system will be a part of the main system.
We want to have a central authentication for all parts ...
3
votes
0answers
44 views
Fatal error in include, the file is there
When trying to run a custom module script triggered by the use of a 'one time login' sent by an email for users to reset their passwords I have to include 'user.pages.inc'
This is the URL (edited for ...
-1
votes
1answer
26 views
Change label in views php
I am using the views php module and want a custom label.
The label field doesn't allow php to be entered, how would I go about changing the label?
1
vote
1answer
28 views
Please tell me what drupal table the block php visibilities settings is stored at
Within a block I have configured under the "Visibility settings" and "Show block on specific pages" I have put in PHP code that determines where this block is displayed within a page or not via a ...
0
votes
2answers
16 views
How do I hide an area in a template or layout if multiple regions have no content?
I am able to set this up using a single check for a content in a region, but what if say 3 regions must all have content before the area is displayed?
Here's what I use in my templates when checking ...
0
votes
0answers
26 views
How to display rendered field dynamically
It may seem that my question is out of topic, yet if you read whole text, you'll find that not.
I've custom content-type
When I display content of that type, initially there isn't field_zdjecie_1. ...
1
vote
1answer
24 views
Why does Views PHP give me NULL for $row->path?
I have a views block to display only the titles of some few nodes. Titles linked to the single node. I want to have a CSS class .active added to the title's links when the linked path matches the ...
0
votes
0answers
18 views
How can I validate multiple forms at once?
I have a function that displays three different forms (textfields in format MM/DD/YYYY). I need to validate that the users age given is above the required age to enter the website and cannot figure ...
-2
votes
2answers
62 views
If drupal is NOT front page [closed]
I would like to use the opposit of this statement:
<?php if(drupal_is_front_page()) {
So that the code I want to display is displayed on all pages EXCEPT the homepage. drupal_is_not_front_page ...
0
votes
1answer
35 views
Insert Record Using db_insert in Block
I have created a Block with PHP as text format.
What I want is to insert record into separate database using db_insert function.
Here's my code:
<?php
$tracker = array(
'database' => ...
0
votes
1answer
19 views
Possible to pull the validate hook on forms not in form api
Is it possible to utilise the validate hook from within a node rather than a module? The code below works within a module calling a form with the form API. But if i was to have a variable in a node ...
0
votes
2answers
38 views
Programatically create 'Send this user a a private message link' for user pages
I know that this question had been asked several times, but it seems like all existing answers only apply to ealier versions of Privatemsg module. I am running 7.x-2.x-dev and I would like to ...
1
vote
1answer
123 views
Drupal and Hiphop php VM
Faceboock has just released on GitHub their new Hiphop PHP VM, please follow this link:
https://github.com/Facebook/hiphop-php/wiki
Do you know if it is possible to enhance Drupal performance with ...
3
votes
4answers
226 views
Will the PHP filter prevent SQL injection attacks?
I had trouble getting the form API to work though I am considering re doing all my forms with it. I have some custom html/php forms however I directly insert into the DB using pg_query. I am looking ...
3
votes
1answer
20 views
What variable is responsible for the default admin bar on top of every default Drupal theme?
This is basically my html.tpl.php -
</head>
<body>
<?php print $page; ?>
</body>
</html>
What do I need to add to make that horizontal admin bar appear?
0
votes
1answer
28 views
Email Validation php
When validating an email address using the code below I get this error when i run the same code from within a drupal node, where I coded a form using php/html
if (filter_var($email, ...
0
votes
2answers
33 views
Drupal places a <br> after text automatically?
I have the below code, however when I place it within Drupal 6, Drupal places a after the text 'Coordinator', see second code insert for the firebug info. I am not sure where this is coming from? ...
0
votes
0answers
20 views
Adding Block Title Styling To Views Fields
Hello i have a drupal theme that uses css to make the first word a differant colour to the rest of the text. works great, like it a lot etc etc
I was looking at expanding my drupal and css knowledge ...
0
votes
0answers
14 views
Automatically create elfinder profiles
I am using elfinder in pair with organic groups. When a group is created, a role is automatically created and assigned to members when they join (or removed when they leave). I also display the right ...
0
votes
1answer
61 views
Dynamic Form Generation
I need to create a web form that functions as a skills checklist. The user will select a 'specialty' from a drop down and based upon that selection, a list (with as many as 50 radio selections) will ...
0
votes
0answers
25 views
Modify <title>-tag in document header via views
I have a view, that generates page urls like:
www.example.com/vehicles/%
I want to overwrite the default <title>your site.com</title> with a custom value based on the value of %
...
0
votes
1answer
21 views
add and remove preassign role to user on completion of user profile
I have created user through admin. Admin Assign specific role to user. But On first time login we want user to complete user profile and then only it will able to access anything else on site. So I ...
0
votes
1answer
69 views
Drupal 7: How to insert site's Main Menu and also use my custom style on it?
I've a menu like this-
<!-- Main Menu -->
<ul class="nav sf-menu clearfix">
<li><a href="about.html">About Us</a></li>
<li><a ...
-1
votes
1answer
89 views
Inventory Management Using Drupal [closed]
I've just started learning Drupal to develop a web based inventory system. I am not familiar with Drupal so I learnt how to put custom code in Drupal via the block structure. However, I don't think ...
1
vote
0answers
25 views
How do you output a $row->field_data in a custom views PHP field?
I have the following Custom PHP Views field: http://prntscr.com/1dd8m0
I did a print_r($row), but I keep getting output that doesnt match what I have in those fields: http://prntscr.com/1dd9ls
Does ...
0
votes
0answers
85 views
Installing and loading google client php api
I am developing a php module that uses the Google Client class from the google client php api. I have downloaded and unzipped the latest google client php api at sites/all/libraries, and put my module ...
0
votes
1answer
158 views
In Drupal 7 Views what is the php code to validate a field against a contextual filter argument?
Currently I am using the path url to pass in arguments:
path: /%/%/%
On the 3rd argument I am loading a Taxonomy term. I also have a field loaded called: field: device type
What do I have to put in ...
1
vote
1answer
54 views
Can I check a user is logged in using Services
I need to be able to integrate an external PHP script with Drupal 7. However because the script also connects to a MySQL database errors are produced when I include the bootstrap.inc, so I'm looking ...
0
votes
0answers
22 views
How do you view the Views row variables easily when using a custom PHP field?
I'm trying to output the product "edit link" in my product pages via a view, but i only want this displayed to approved roles. I made a custom PHP field in view and I want to print out the ...
1
vote
1answer
24 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
58 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
42 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
26 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 ...
3
votes
1answer
45 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
85 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
51 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
40 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
64 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
47 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
285 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 ...
3
votes
1answer
155 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
55 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
18 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
21 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
26 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
382 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() ...