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."

learn more… | top users | synonyms

0
votes
0answers
3 views

Why can't I see loaded images with this script

I have to retrofit an image gallery to work in ie8. My solution is to use: $folder = $_SERVER['DOCUMENT_ROOT'].'/img/'; $filetype = '*.*'; $files = glob($folder.$filetype); $count = ...
0
votes
1answer
4 views

Adding Placeholders for PHP variables

When creating a query using db_query in my module I want to make sure it's as secure as possible. So I'd like to use placeholders in my 'WHERE' clauses. The problem I'm having is how to use ...
0
votes
1answer
24 views

Run a Drupal website offline (±without server)? — E.g. hand it over on a usb-stick / by mail? — Run it from the HD, while retaining functionality?

Why run Drupal offline? Since I use free webhosting, I don't have 100% up-time, so I started wondering whether I could maintain such Drupal functionality, while at the same time working offline. An ...
0
votes
2answers
26 views

Malicious Code - Website Disable

I'm new to Drupal. My website has been disable due to malicious code found in /var/www/vhosts/domain.com/httpdocs/sites/all/themes/tao/tao/css.php What should I remove in this file? ...
0
votes
2answers
9 views

Computed field that displays the full username of the author

I am using a computed field and I want to display the field_first_name and field_last_name, which are properties of the user that created that node. I have been trying things, but it seems like ...
0
votes
0answers
3 views

Simpletest fatal error without message

locally my unit tests run just fine. On my online dev server, they fail and I don't get any error message despite "The test did not complete due to a fatal error." in the test messages and "An ...
0
votes
1answer
17 views

Views PHP: Global(PHP) value for end date

I am rewriting the output a view block with a Global(PHP) field from the module Views PHP, and one of the fields I am rewriting is a Date field. The value for the field is : 2015 - 08:30 to 09:30 I ...
0
votes
1answer
13 views

Problems with SQL Syntax using Left Join and OR

I need some help with my SQL. I've got the following code but it's returning multiples of each item and I don't understand why. When I only include the first Left join it returns results as ...
-1
votes
1answer
30 views

advance search to show post by date

i trying to make the search on drupal show result by date. for example if i type 25/05/2010 it should return posts for that date and also search by key work which is default on the search. how can i ...
0
votes
0answers
4 views

Problems with a “filter field options on term refernce” ajax callback

I'm having problems with a "filter shops on section" ajax callback, when field_sections (term reference with unlimited values) changes field_shops (entity reference) should show all shops with the ...
0
votes
1answer
26 views

Views check access by PHP

I've got 2 roles on my system -uzman and isveren- and several views that need to be restricted to either uzman or isveren. For that purpose, I have been trying to check access control with PHP. I ...
0
votes
1answer
50 views

Displaying Database Data Within the Flow the Site

I have a multi-page form that works fine in and of itself (pathfindertool.module). However, once a user clicks submit I want the page to display some records on the page. And it DOES display the ...
0
votes
2answers
42 views

Printing block on all pages of a contenttype

In my page--front.tpl.php i have a menu block rendered using: <?php $block = block_load('menu', 'menu-basic-menu'); print render(_block_get_renderable_array(_block_render_blocks(array($block)))); ...
0
votes
0answers
20 views

New site, user 1 does not login

I've recently reformatted my machine, and I've just noticed a really weird issue when I'm setting up new Drupal sites. When creating a new site (either through Drush or just downloading manually) you ...
0
votes
2answers
25 views

How to remove user role using hook_user_update

I am having trouble trying to remove a role after user account submit. I have used the following code: function vdb_form_alter(&$form, $form_state, $form_id) { global $user; } ...
0
votes
0answers
5 views

display non published comments with special test and condition

How can i modify in the loop of displaying the comments in drupal 7 foreach (....) { if ($comment->stauts == 0 && $comment->condition ==1){ // Display comment with new class } } ...
0
votes
0answers
12 views

Change a menu link for translation in D7

I have tried the solution as below : function taxonomylocalize_menu_link_alter(&$link) { if ($link['link_path'] == 'node/249' && $link['module'] == 'menu') { ...
0
votes
0answers
28 views

How to call JavaScript or JQuery scripts in Drupal 7 blocks

Since the Webcam module seems to have fallen into disrepair, I tried to create Blocks containing an <img> and a small <script to automatically reload it. An SO question gave me some hints how ...
1
vote
0answers
33 views

How to get product attributes (weight, dimension.height..) in php

I am fairly new to drupal commerce and php so pardon the dumb newbie question. I downloaded commerce_order_ftp_export and after updating it to the devel version I was able to get it working. It ftps ...
-3
votes
1answer
31 views

How to check author role in Views PHP

I need to check author role using views php. I've already added a relationship and added a field(excluded from view) User: role. How can I check if author role is equal to 'administrator'?
2
votes
1answer
60 views

Possible to set user privileges on part of the text?

In my node I have embeded a view using php snippet in body field. When regular user edits it I don't want him to accidently delete the snippet, is there a way to hide or lock that part of the text ...
0
votes
0answers
49 views

Render webform submissions in template

I want to render webform submitted data below the form on every page from a specific content-type. But not all fields are allowed for everyone to see like a phone number, views could solve that but ...
0
votes
0answers
16 views

Add css or prefix/suffix created form.

I am creating a dynamic form in drupal. It needs to create a question for each row in a mysql table. The mysql questions will be changed on a daily basis. My issue is formatting each question into a ...
1
vote
2answers
19 views

Display a link to create new content when content missing (via Contextual Filters)?

I'd like to give users the option to create new content when a certain contextual filter is missing on a panel. e.g. I have my reviews on a panel. When a review is missing I'd like it to display a ...
0
votes
0answers
19 views

why does trying to add a line item on order presave redirect to the user page?

I have a lot more code than this in the hook_commerce_order_presave() however this if ($show_charge_in_cart == True) { $product = commerce_product_load_by_sku("0909990000005"); $line_item = ...
-1
votes
2answers
38 views

How to insert HTML that includes an ampersand>

I've created a custom block, and I'm trying to get this custom block to output a specific piece of HTML. The HTML needs to be different on every page, because it needs to include the page's URL in it. ...
0
votes
1answer
43 views

Changing textfield into textarea

I hope I'm right here with my request and someone can help. I'm working on a website with Drupal, but am not a trained programmer. I use a module which allows me to display a tooltip in Drupal. By ...
0
votes
2answers
33 views

Code review - Reading a field collection

I am trying to read a field collection and build an array in PHP. The array I want to build goes like this:(it's in JS notation but you can easily imagine the equivalent in PHP) highlights = [ ...
1
vote
0answers
29 views

PECL uploadprogress bar does appears But doesnt move

I installed the PECL uploadprogress bar in php and this is working fine but when I start uploading a file it ends up getting stuck and dissapearing when the file is uploaded. This is what i see when ...
1
vote
1answer
32 views

How to patch file-field.inc/file.css webforms file upload progress bar [closed]

I installed the PECL uploadprogress bar for my webforms module in drupal 7. This is installed fine but when i try to actually show the uploadprogress bar it just doesnt show up but puts a empty body ...
0
votes
0answers
19 views

View modal window only once

This code displays the Welcome modal window on page load on the Landing page, and also when the page is refreshed. The Visitor only needs to see it once as they navigate the site and return back to ...
0
votes
0answers
16 views

Drupal Views Relationship in Code

I am trying to write a custom relationship between two tables for Views, and it doesn't seem to be working. The code for my relationship is this: $data['gov_data_bill']['sponsor'] = array( ...
0
votes
1answer
13 views

Passing PHP filtered arguments to Panel and View Pane

I have been able to pass URL parameters to a Panel and from there to a View Pane inside the Panel. However, I must pre-proccess the URL data with PHP. I have only been able to use Visibility rules ...
0
votes
1answer
54 views

user-profile-edit.tpl.php not working for user#1 [closed]

I am going crazy on this one :-/ I have overridden my user edit page with a user-profile-edit.tpl.php In my template I have: function mytheme_theme() { $items = array(); ...
0
votes
1answer
120 views

Your web server does not appear to support any common PDO database extensions

I'm trying to install Drupal7 or Drupal8 and keep getting this error: Database support Disabled Your web server does not appear to support any common PDO database extensions. Check with your ...
-1
votes
1answer
20 views

A code editor for module developer

Is there a code editor which can edit code in module php file ? like editor under plugin menu in Wordpress. Thanks in advance.
0
votes
0answers
9 views

How can I remove the dependency on PHP of rules in a feature?

I am attempting to disable the PHP filter on my site, so I am moving all PHP input in the UI into code. I finished cleaning up my views and panels, and now only some rules remain. Right now, all my ...
0
votes
1answer
27 views

Dealing with compressed JSON string from external API

I'm trying to call the Stack Exchange API but it sends compressed JSON strings and I can't uncompress it. $request = ...
1
vote
1answer
24 views

“global” keyword does not work from within drush script

I have the following script: <?php $GLOBALS['foo1'] = "foobar1"; function g1() { echo "g1 " . $GLOBALS['foo1'] . "\n"; } $foo2 = "foobar2"; function g2() { global $foo2; echo "g2 " ...
0
votes
1answer
39 views

How to get term name using PHP code in views? Drupal 6!

how can i get term name of current term using PHP code? I am using it in views. Thank you. I dont know why, but the below code doesant work: $term = taxonomy_get_term($tid); $name = $term->name; ...
0
votes
1answer
20 views

Source: empty object - in hook_feeds_after_parse()

Working on a module that modifies some csv files before it's processed by feeds_import. I use the hook_feeds_after_parse($source, $result). The processing and $result is ok. But the object $source of ...
0
votes
1answer
66 views

Drupal 7 | Checked box to display image (PHP IF) [closed]

I am slowly getting the hang of PHP. What I am trying to figure out is how to display an image (icon) if the checkbox is ticked. I understand its something like this but its returning errors. ...
1
vote
2answers
65 views

PHP Output in module

I am creating a module that is outputting a static php page into my Drupal install. Here is my module file: <?php function mymodule_menu() { $items = array(); ...
-1
votes
1answer
29 views

PHP code in welcome email

I need PHP (for some logic) inside the welcome email, the welcome email structure is defined in admin/config/people/accounts (in the text box) The question is how can I place PHP code there, I tried ...
4
votes
2answers
102 views

Blocking IP Address In Drupal 7 Via Code

I want to know is there any function in DRUPAL 7 that I can send it an IP address as a parameter and it adds this ip to blacked_ips table ?? Indeed I have a rule that contains a Execution PHP action ...
0
votes
1answer
24 views

How to customize drupal node using 'PANELS'

I am trying to implement the "PANELS" module in drupal 7.31 to customize a page display. Panels Module : 7.x-3.4 Drupal version : 7.31 I have created courses(as a product) using "COMMERCE" module. ...
0
votes
0answers
10 views

Node - Refererence Syntax for 'All Users'

I am building a SEO Function in Drupal 7 which is located in the template.php file. Currently, I require the syntax to reference all users in the conditional statement I have coded. Please provide ...
3
votes
3answers
192 views

Can't log in to Drupal websites after upgrading to OSX Yosemite

I have just upgraded my local machine to OSX Yosemite which has changed my Apache version from 2.2 to 2.4 and my PHP version from 5.4 to 5.5. When I visit both example.dev/user and ...
0
votes
1answer
27 views

Are Drupal .php files associated with a module cached?

I am wondering if they are, as that would explain why a simple change to one of my variables in my config.php file is not showing up in the DOM. Here is what is making me suspect this. In my ...
0
votes
0answers
12 views

PHP mail logging — more detail possible from Drupal in phpmail.log?

I've got PHP configured to log sending of mail to /var/log/phpmail.log. BUT...for Drupal, it only shows "system.mail.inc", which is not terribly helpful in diagnosing which form/node/etc is actually ...