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

Drupal 7 Services REST - DELETE Request

I'm trying to delete user account via REST api. Here is my code: $service_url = 'http://www.example.com/rest/user/login'; // .xml asks for xml data in response $post_data = array( ...
0
votes
1answer
17 views

Views Php how to select actual term name not term ID

How to select term reference field with variables in views global PHP field? I need to not Term ID, but actual term name. My views is fields of a content type that contains term reference field. And ...
0
votes
1answer
10 views

Send email with URL of same page as the email link?

We have a page that displays a logged-in user's selections from a Flag Lists process. The page includes code to generate the specific URL of that page, so it can be copied and pasted elsewhere. ...
0
votes
2answers
18 views

select nodes whose created date in hours is equal or larger than 48 hours

I make a PHP routine in which all node is selected and check created date and delete those nodes which is created in last 48 hours or greater. $result = db_query('SELECT n.nid, n.title, ...
0
votes
0answers
13 views

Big Data Display - Drupal or Not? [closed]

Does anyone have any thoughts about whether or not Drupal can handle display of big data, especially data read in from a SQL Server via stored procedures? I'm trying to convince my company that it can ...
0
votes
1answer
19 views

Two variables in function

I know this is my fault and lack of knowledge of php . Sorry about this . I have a function in my template.php . /** * Implements THEME_preprocess_node(). */ function ...
0
votes
1answer
15 views

HOOK_node_submit funtion not working in custom module

I recently upgraded a drupal installation from 7.15 to 7.31. All seemed to be working well but as I went through testing features I noticed one of the template forms for content submission wasnt ...
0
votes
0answers
19 views

hook_js_alter not being called

I find this strange. My module seems to be named correctly but the module will not be called. The var_dumps are not on the page nor are watchdogs when I put them in. The module shorthand is ...
0
votes
1answer
30 views

Hiding Field(s) if Date is Expired

I'm using Drupal 7 date field. Using views, when the date has expired, the page goes to a section labeled 'past events.' In the template page, the date and time are both separated for instance. ...
0
votes
1answer
20 views

clean URL and slash after index.php in drupal 8

Drupal 8 does not send any form. Stores only if you write through /index.php/ example: site.com/index.php/config That would be needed to site.com/config There is the idea that it's something with the ...
0
votes
1answer
28 views

How to add custom RewriteRule in .htaccess

I have a website which some one else has built using Drupal Database API (nothing else from Drupal has been used). With the RewriteRule added to the .htaccess file which is in the root folder, the ...
0
votes
2answers
20 views

Form Alter Foreach Loop changes not sticking

I'm trying to modify my exposed filter block to put each of the controls inside fieldsets, and make other modifications to them. However, when I try to utilize a foreach loop to do this, none of my ...
0
votes
0answers
8 views

Jquery Ajax to Drupal to External site, reading response

I have a drupal site. There is a page (page 1) with a form that gathers user info and submits it via AJAX to a Drupal Module page. The AJAX format is jquery var responseTarget = ...
0
votes
1answer
21 views

How can I restart the PHP environment installed with Drush for Windows?

I have installed Drush for Windows, works great, but it installs its own version of PHP in a subdir of the install directory. I've increased the memory limit and execution times in that ini but how ...
0
votes
1answer
13 views

Drush version component error

I am trying to enable drush aliases in linux so that I can use Acquia, but I am getting the following error when I run: drush @dev status Drush command terminated abnormally due to an unrecoverable ...
0
votes
1answer
20 views

Saving a value from Javascript on Drupal form submit

I have a jQuery map that I've built that allows users to select states and counties. This is all done in Javascript. I would like to, on form submit, take this data and submit it to the user's ...
0
votes
1answer
16 views

How do I prevent Drupal raising a segmentation fault when using a Node.js theming workflow?

Symptoms: Some drush commands fail; Some Drupal pages are blank. The failing drush commands report "Segmentation fault: 11" The Apache log (e.g. php-error.log in MAMP) also shows the same error. ...
0
votes
1answer
9 views

drush -v @live status can't find remote php

I can't seem to get drush to execute fully using ssh. If I try: drush -v @live status The resulting error message is: /usr/bin/env: php: No such file or directory I can explicitly execute php ...
1
vote
1answer
26 views

Write form value to database

I need to save this to database, but could not find a way to make it work. Now this paypal_email is only saved to current user. Apparently it is saved somehow to the database under user table, but it ...
0
votes
0answers
19 views

Add class to view block if view has count result using template.php

I need to add class to view block if view has certain count result. For example if count result is 4 or less. I have working code for view format HTML list, but I need to use Unformatted list. ...
0
votes
0answers
32 views

How to add class to view block programmatically

I need to add class to view block programmatically, but could not find working way to do it. My view format is Unformatted list. I have this in my template.php: function ...
4
votes
1answer
132 views

How do the seasoned OO PHP people go about setting up a professional development environment and how can we apply this to Drupal 8

A few years ago I was in to Drupal 7 development. Back then, in the company I worked for, we just kept everything in the database, had a few modules we kept on disk somewhere, didn't really use ...
0
votes
1answer
44 views

Issue implementing Ajax in form

I created a basic page which has a basic form and implements ajax, or attempts to do so. My issue is that it doesn't seem to be functioning as it should. What might be Ajax, only works after I press ...
0
votes
1answer
26 views

Is drupal the right solution for me? [closed]

Hopefully this question is suited for this forum, please advise if not. I'm looking to develop a Web front end that is used by end users to input utility transfers for home owners, electricity, gas ...
0
votes
2answers
22 views

Get IP of the Author only

I use this solution for now which works great: It's with Computed fields, and I use this line: $entity_field[0]['value'] = ip_address(); So basically what it does, it's when a user submits a new ...
0
votes
1answer
18 views

If Profile2 fields are empty, problem in accessing data

I just found out that if ALL fields of certain Profile2 profile ie. main are empty, I am not able to access data inside main profile. For example I want to do a check if a field is empty but can not ...
0
votes
1answer
43 views

profile2_load_by_user Trying to get property of non-object

I use simple code to hide field from profile2 main profile based on another field inside the profile2 main profile. If field_testcheckbox is not checked, hide field_info. function ...
0
votes
1answer
17 views

Drupal PHP filter being overwritten in Lexicon Module

I've been using the PHP code text format on my Drupal website and I have been encountering a frustrating issue with the Lexicon Module. I bet the answer is dead obvious, but I haven't been able to ...
0
votes
3answers
37 views

how to get the count of total comments posted for specific content type including deleted comments too?

I want to get the total count of comments posted only for a specific content type including deleted to get the highest comment id no matter whether comment is been deleted. please help me or else ...
0
votes
1answer
32 views

How to execute php code on Access Denied page

I have written php code in block which is not getting executed on "Access Denied" pages. How to make php to run on all pages including "Access Denied" pages too. Please help me.
0
votes
0answers
23 views

sequence of conditions regarding performance

maybe this question should be asked on php forum in general but I am using drupal variables so here it is: In custom php I have 3 conditions: global $user; if (($node->status == NODE_PUBLISHED) ...
3
votes
2answers
167 views

Where to query database in a module

I'm creating a module that is basically a form but needs to use information from a table in the database to react the some of the button presses. Rather than executing the database query each time the ...
0
votes
1answer
50 views

Use AJAX on a form with multiple buttons

I have a form that has two text areas and three buttons, "Copy", "Reverse" and "Clear". I would like the buttons to, respectively, copy the text from one text area to the other, take the text from the ...
0
votes
0answers
11 views

How to I programatically search for a specific entityform submission?

I want to search for submissions where a field has a specific value. $query = new EntityFieldQuery(); $formentities = $query->entityCondition('entity_type', 'entityform') ...
0
votes
1answer
25 views

How to print add/remove link for user relationships module?

I want to print Add/Remove friend link fro user relationship module on user profile page. I am trying this using below code but its causing white screen. //add link global $user; $account = ...
0
votes
1answer
13 views

Add class to views row instead of replace system classes

I have this code: function theme_preprocess_views_view_unformatted(&$vars) { $view = $vars['view']; $rows = $vars['rows']; foreach ($vars['view']->result as $id => $row) { if ...
0
votes
1answer
28 views

Check if field has value (content)

I have code which checks if field exists, but I try to change it to check if field has value (content) or not. In views I have one field to show all content (Rewrite results). So all fields are ...
0
votes
1answer
33 views

How to get relationship id in views drupal 7?

I am using User relationships module and created relation friends. Where we can send and receive friend requests just like fb. So l have created view to list all my-friends and also added remove link ...
0
votes
1answer
71 views

How to parse current page URL query parameters to create link using l() function

I have a view in D7 with a few exposed filters. This view generates a URL/page like this: example.com/node?location=XXX&check-in=XXX&check-out=XXX&lang=XXX. I am looking to build a link ...
0
votes
2answers
28 views

Uploading file, parsing and displaying data

For a site i am building right now, there is one component that I would want the user to upload a file, where it will be parsed (currently a python script, but can be ported to something else). The ...
1
vote
2answers
69 views

Problems adding javascript to a specific page

Drupal Version: 6.x Currently, I have a custom module created. In my template, I keep html code that I would like to embed within a container, such as a div, with a particular id. For this question, ...
0
votes
3answers
34 views

How to display programmaticaly default user picture?

I want to display programmatically default user picture if the user is not uploaded any. For that I have written code php code but its displaying user uploaded user picture correctly but not the one ...
0
votes
0answers
6 views

Modifying the content in a view

This is in Drupal 6, so Views 2.x I'm trying to modify the output of a view - there's a field that should be set in some situations, but not in others, but for some reason it is defaulting to "Please ...
0
votes
1answer
37 views

Fatal Error when trying to log in DRUPAL

My Drupal 7 website is throwing 500 internal server error, when I try to log in as Admin. I checked the apache error log it throws below error PHP Fatal error: require_once(): Failed opening ...
0
votes
1answer
62 views

Add class to views row if image fields has content

I have views which has multiple image fields. In some cases all those image fields are empty, but some cases one of them has content. When image field has content I want to have extra class ...
0
votes
1answer
23 views

How to display or hide a Views field based on it's length?

I have 2 fields in Views the first of which is always displayed, and the second I would like to display only if the first field has more than 70 characters. I have tried to do this using Views ...
0
votes
0answers
12 views

Generate iCalendar file - Clean Output

I need to generate a iCalendar file and I have this function in my template.php: function MYTEMPLATE_get_event_file($data){ ob_start(); header('Content-type: text/csv; charset=utf-8'); ...
0
votes
1answer
22 views

hide a node from node author in view

I have a view of content type 'video' which shows a preview videos of particular author. I have passed content id as contextual filter. Now,I want to show a node (video) to the other users but not the ...
0
votes
1answer
22 views

How can i hard-wire a link, in blocks, using $base_url or something similar?

I'm trying, unsuccessfully so far, to create a block that is simple hard-wired link. but i need to use $base_url or something equivalent (like base_url(); ?) but i guess adding php is not allowed. i ...
0
votes
1answer
22 views

Views API - how to replace PHP fields

So a client that I inherited has multiple PHP fields in each of their views. I'd like to replace them. They're using PHP Code module as well as Views Customfield. Would I have to write a custom ...