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
15 views

Commerce add product to cart while not logged in

Here is my question : Context : I made a TPL page with a products list, you select one of theme and click on submit. Then there's an ajax call to a PHP script wich adds the product to cart. Problem ...
0
votes
1answer
10 views

Drupal calendar popup - Year dropdown not showing in colorbox - Screenshot added

I am using drupal calendar pop up in colorbox.when i clicked on year its not showing year dropdown but giving js error of TypeError: m.replace is not a function Above issue is coming in Firefox only. ...
0
votes
1answer
11 views

Conditional for view template

<?php if ($rows): ?> <div class="view-content span12"> <?php print $rows; ?> </div> <?php elseif (($rows) AND ($exposed)) : ?> <div ...
0
votes
1answer
33 views

Array and Select Options

I have the following code working together with a scrip that populates fields on autocomplete. What I would like to do is instead of having an autocomplete text box - use the city field in a drop ...
0
votes
3answers
31 views

Redirect to page before login

Now i know there are some ways that a redirect on login can be setup, ie using views etc, but i think my issue maybe a bit more complicated. When a user accesses a node for example where they are ...
0
votes
2answers
39 views

Convert a drupal website to standalone exe file

I'm trying to convert my Drupal website to a standalone .exe file. I tried some popular applications like ZZEE PHPExe or ExeOutputPHP, ZZEE PHPExe returns the error that /includes/boostrap.inc is not ...
2
votes
1answer
153 views

Google Drive Integration with Drupal

I need to Integrate my Drupal site file field with Google Drive. Public User(Annonymous user in drupal) will be selecting a file from their Google Drive which should be attached automatically to ...
0
votes
1answer
24 views

What does -> mean in the context of Drupal [closed]

I see a lot of variable declarations that go something like this: $variables['classes_array'][] = drupal_html_class('node-', $node->type); What does '->' mean in $node->type and why can't we just ...
0
votes
0answers
6 views

join two tables and take 20 distinct values without the use of “distinct()”

how i can join 2 tables and keep the first 20 different values in the table?I create a table with no values on module installation: function distinct_schema() { $schema['distinct'] = array( ...
0
votes
2answers
21 views

Question and Answer web page idea [on hold]

I am making a website and i'm trying to add a Q and A page where questions can be asked but how would I add it where each questions have their on divs and comments sections are allowed under the ...
0
votes
0answers
7 views

Field permissions combined with content type

I use module field permissions to restrict/enable role's access to certain fields. The editor role creates and edits articles. I reuse field_terms (taxonomy field) in multiple content types ...
0
votes
2answers
33 views

How do you get DRUPAL_ROOT when using it in a separate php file?

It has been covered many many times on several sites, explaining how to define DRUPAL_ROOT and bootstrap the page (whatever that actually means). However no one has ever said how to use it in a ...
0
votes
1answer
15 views

How do I separate multiple values for “print render($content['field']);” with a comma?

So in my node template, I am using the following code: print render($content['field_taxonomy']); Sometimes there is only one result printed, and sometimes there are multiple results printed. How ...
0
votes
0answers
21 views

Why is Drupal commenting part of my php code?

I have a block that is being executing some php code and when I enable my block on my site the first couple of php lines are commented out. <?php global $user; if ($user this turns into this ...
0
votes
1answer
14 views

Want to process node edit in two different ways

On every node page there is an edit and submit, you can set when the edit is available and such. So, what I want to do is this. When a regular user uses the edit button(which I want to be available ...
0
votes
0answers
21 views

Drupal views $title is null

I have created a view as a page and have set a title for it.Its works fine on the view preview but on the actual page its becoming null.The title also displaying on the title bar of the browser. I ...
0
votes
2answers
39 views

Passing variables via template.php for search module

I'm using search.module. I used dpm(get_defined_vars() ); in my search-results.tpl.php file to see all returned variables, so I can reference a needed variable in some PHP code I'm writing in there. ...
0
votes
0answers
9 views

bookmark organize for anonymous user permission

I have use drupal 7. I download and install the flag , flag bookmark, bookmark module.I have also add settings for bookmark. Bookmark functionality is work for authenticated and admin user. i wanna ...
0
votes
0answers
22 views

Trying to customize login page for mobile, interfering with desktop version of login page

I've been trying to customize the login/retrieve password/create account pages on the mobile version of my website for a couple of weeks now with little success. I haven't found a satisfactory answer ...
0
votes
0answers
4 views

Drupal 6 cck field update

In Drupal 6, want to update cck field. For example, have a content type 'question' with field 'question_description'. Try to update this field as following. load in the content of content type ...
0
votes
0answers
15 views

ahah fields in custom form stopped working after migration

I migrated my drupal 6 website to a new machine. my custom form with ahah-fields are not working in the new server. OLD => NEW ............................ ubuntu => 9.10 => ...
0
votes
0answers
36 views

Problem getting Drupal SESSION value from standalone php page in subdirectory

Last 2 days I am searching for solution on Internet. I have a module in my drupal site's "sites/all/modules" folder named "coupon".I added a new test.php file in the "coupon" folder which has no ...
0
votes
1answer
23 views

Creating a dynamic URL in node--resource.tpl.php

I'm trying to create a URL in my node--resource.tpl.php file that contains fields from the resource in question in the URL. The following code is what I've been playing with, but when the user clicks ...
0
votes
0answers
13 views

Using substr() with Drupal search-result.tpl.php returning fewer characters than expected

In my search-result.tpl.php file I want to return only the first 200 characters of the body field before outputting it to the screen (assuming there are that many characters). I'm trying to use the ...
0
votes
1answer
21 views

Using Left() with Drupal Custom Module

I'm trying to return only the first 200 characters (if there are more than that) from a body field in a Drupal custom module. I've found the general php/mysql solution here: ...
2
votes
1answer
19 views

Drupal 7 Comments Alternating Row Colors

I'm interested in making the comments that appear on my resource content type nodes show with alternating background colors. Anyone know how to make this happen? I tried something like this with CSS ...
0
votes
0answers
68 views

Trying to theme my user login/registration/password reset pages in Drupal 7, going bonkers

What seems like it should be a very, very simple task -- theming the user login, registration, and password pages in Drupal 7 -- is turning out to be a Kafka-esque nightmare. I can't figure out what ...
0
votes
0answers
24 views

To use some hook instead of “PHP contextual filter code” in view

Can anyone please give a solution on having a substitution of "PHP contextual filter code" for views, inside a module code?
0
votes
3answers
34 views

Redirect user based on role and node content

I want to redirect a user when they login based on what role they have and whether they have created a node of a type. So if the user has administrator role, direct user to admin url else if the ...
0
votes
1answer
35 views

How to load a field from a user that is being viewed

I am looking to load a field from a user's profile that is being viewed.For example, I am looking at another users profile and it will load their associated field. I am programmatically adding a ...
1
vote
2answers
116 views

First page load/execution slow, login slower Drupal 7

Drupal 7 site experiencing slow execution/load time for first page visit and slower execution/load time for login. The web server and database servers are dedicated and well resourced, the site has no ...
0
votes
2answers
29 views

How do I get the user name of the user profile page that is being visited.

I created a module and I need to use the user name of the user's profile being viewed, how do I call/get it?
0
votes
0answers
16 views

display suite code - set token value of color field module as php variable an convert to rgb

$hex = "[node:field-ref-participants-category:field_color]"; print $hex; list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x"); echo "rgba($r,$g,$b,.9)"; Why does $hex printed correctly, but doenst work ...
0
votes
0answers
13 views

PHP code & panels; how to transfer database code into module code [duplicate]

There are various blog posts on how to get php code in views out. See https://ohthehugemanatee.org/blog/2013/12/26/44497-people-are-wrong-how-to-never-use-views-php/ ...
0
votes
0answers
17 views

PHP code is not working on Drupal Rule translation

I am working on a multilingual site and using i18n module for language translation. Now I am trying to translate a Rule containing <?php?> code. But <?php?> code is not working for Rule ...
0
votes
2answers
23 views

Coloring rows in returned drupal search results

I'm trying to modify search-result.tpl.php and template.php to color the backgrounds of search results returned such that every row has a different color than the one that preceded it. Only two colors ...
0
votes
0answers
21 views

Custom rules not working in an entity form

I have created an entity form with two integer data type text fields named Enter first number and enter second number. I save the entity form as greater of two. In the entityform > rules, I add a ...
2
votes
1answer
28 views

+1 user field after comment is made

I created a new user field to keep count of comments. I want to increase it by 1 after a user posts a comment and decrease it by 1 when comment is deleted. Is there any way I can use rules to do ...
0
votes
0answers
17 views

Drupal taxonomy-term text-body dependency

i'm using drupal for a website where i post from time to time different events. For this, i made a taxonomy type with four vocabularies, each stands for another event type. Now my question: I know ...
1
vote
3answers
34 views

Multiselect values not getting saved in hook_settings()?

This is the code I have implemented in my module which is working fine! /* * This is a helper() */ function MYMODULE_feeds($page_id = '') { foreach($pagefeed['data'] as $feedval) { ...
0
votes
1answer
78 views

Making Panel-Col-last the first

I have a 2-column panel (Regular, not stacked). I've made it responsive and it appears allright in mobile view @media screen and (max-width: 519px) {width: 100%;}. The only problem is that my site ...
0
votes
0answers
9 views

Preprocess function values not persisting

I am having a really bizarre problem over the last few days. I'm trying to alter a field value through a preprocess function and while I can see the value has been changed inside the function, it ...
1
vote
1answer
56 views

Error 500 when downloading updates for modules

Recently I've transferred several Drupal sites to DigitalOcean.com VPS server (Ubuntu). Almost all work well. But when I try to downloading updates for modules I get error: An AJAX HTTP error ...
-3
votes
2answers
48 views

Is there a way of converting a Drupal project into pure and optimized PHP-MySql code?

I have a project in Drupal 7 whose development has finished. We will not add more new types of content, no more custom or contributed modules, only data. As Drupal is based in PHP: is there a way of ...
0
votes
2answers
26 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
52 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
38 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
34 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
1answer
22 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
43 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 ...