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
6 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 ...
0
votes
0answers
7 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
23 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
56 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
21 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
12 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
12 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
29 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. ...
-3
votes
0answers
21 views

How to use PHP isset and foreach?

This code gives me the PDF button link. I need to replicate it for a Word button link to go next to it. How do I combine thse two snippets of code? The variable for the word is ...
0
votes
1answer
26 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
0answers
34 views

PHP code in rules [closed]

I'm a beginner in PHP code, but yet with few basics. I'm trying to set up PHP code in a rule...Quite easy I guess: Sending an email to admin if the date of an upcoming event is within the next ...
0
votes
2answers
27 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
18 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 ...
0
votes
1answer
18 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
13 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
11 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
8 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
31 views

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

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
39 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
13 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
23 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
18 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
31 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
19 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
48 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
57 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
24 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
88 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
21 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 ...
2
votes
3answers
135 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 ...
-2
votes
1answer
22 views

How to add content into topic item [duplicate]

I want to add content into a topic item on a website. I am using drupal and have admin access. I want to edit code that will return the below objective. How do I access the files that would have the ...
0
votes
1answer
16 views

Accessing text of a field with type “Text”

I fear that my question could be covered in detail already somewhere, but I did not find something useful. So appologies if this is the case. I added a field of type "Text" to content type "Article". ...
0
votes
2answers
44 views

Drupal, menu links multilanguage

I'm translating the site with my custom theme to another language. The problem is in menu links. On the original language they are fine, but with another one they are looks like "node/id". I've tried ...
0
votes
0answers
84 views

Calculate the difference between two unix timestamp date fields

I need to calculate the difference between two date fields in a table view in Views so that each row in the table shows the time difference in days, hours and minutes . The date fields are set to the ...
0
votes
1answer
39 views

how to specify which region of panelpage can be displayed with php

I am using a page--front.tpl for my frontpage. It overrides a panelpage whice i use for my frontpage. I can display the content of my panelpage with <?php print $content; ?> Is it possible to ...
-1
votes
1answer
41 views

PHP Fatal error /allowed memory size exhausted (but 100% NOT the “problem”) [closed]

I have several blank pages coming up and the server log contains the following error: PHP fatal error […] allowed memory size exhausted […] in ...
0
votes
2answers
53 views

How to build web app with Drupal

I would like to build a php based webapp. I am newbie with Drupal, but after some research I am convinced that Drupal may be the best solution for my web app. However I have some questions, here is ...
0
votes
0answers
31 views

Shared hosting - force mail return envelope

I hope I'm on the right site, because it's a crossover between drupal and server configuration... I am currently using shared hosting for a website and am encountering mail problems while sending ...
0
votes
0answers
26 views

Drupal 7 views show nodes filtered by user profile field

Drupal 7 views show nodes filtered by user profile field In Drupal 7, create taxonomy vocabulary "Interests". It has terms sports, arts, computer... admin/structure/profiles create main profile. It ...
0
votes
0answers
20 views

translate php date?

Im my view I use last-access field for users. I use custom date format (only d) The resulot is for example 1 day 14 hours. Question: how to translate it to different language? I am not using any ...
0
votes
1answer
22 views

Alter keywords searched in solr

I want to search phrase entered by user as q="phrase"^21.0 OR phrase On localhost:8983/solr/admin/form.jsp it parses "phrase"^21.0 OR phrase perfectly! and return correct results How can i do it ...
0
votes
0answers
11 views

PDM: Remember dismissed messages until user logs out

I am using the Persistent Dismissible Messages module with Drupal 7, which works perfectly, however I could do with the adding a certain bit of functionality. When the user logs out, I need PDM to ...
0
votes
0answers
58 views

Call to undefined function views_embed_view() in php/php.module error

I have a Drupal 7 based website that is multi-site. There is one sub domain ,say sub.example.com which is a Drupal installation with out any module or content type and the example.com it self and they ...
-1
votes
0answers
20 views

On click of checkbox send email to selected recipients [duplicate]

<?php if( isset($_POST['Submitter']) && !empty($_POST['Submitter']) ) { $to = "syz@gmail.com"; $subject = "Test Subject"; $body = "Test Body"; $headers = "From: ...
0
votes
0answers
21 views

ckeditor interface language for multilingual site

I am trying to implement various languages in ckeditor interface for my multilingual site if i set config.language = 'en-gb'; config.wsc_lang = 'en_GB'; config.scayt_sLang = 'en_GB'; in admin panel ...