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

-1
votes
0answers
17 views

what is starting point of any drupal module.?

Only beginner can ask this type of question. as i am learning drupal recently. what is the first executes after .(dota0module entered.(like main() in c) and how can i find flow of modules.
0
votes
0answers
7 views

How to add social sharing buttons to a CCK slideshow

I have a simple d7 cck slideshow/carousel for a couple different node types and I need to add the ability to "share" the image that is visible in the slideshow. I have included my custom buttons in ...
0
votes
0answers
13 views

How to mask URL link and IP address of remote server after insert other site content [on hold]

Can you help me please. I need insert website very close as this (but for my own sensor network) - to my Drupal website. But I have to mask URL of this website and IP address of this server too ...
1
vote
1answer
12 views

Nesting Navigation Tabs

In my custom module, I'm defining a menu_item with the type MENU_NORMAL_ITEM. In the default bartik theme, this adds a new navigation tab (next to the Home tab). This is great; however, I need nested ...
0
votes
1answer
18 views

Add and customize login block on page.tpl

I'm trying to add the user login block in my page.tpl file. I've tried inserting the following code but the only thing I see is the username, password and submit fields. The "Register" and "Forgot ...
0
votes
0answers
17 views

Print out multiple upload fields on a page

I'm trying to output 4 upload fields on a page. But the problem is that it only outputs the first one and not the rest. All works fine when uploading the files with Drupal's form api, but I just can't ...
0
votes
1answer
17 views

hook_views_pre_render -> how to access variables

I have a view of teasers, and would like to check the status of each node. Using hook_views_pre_render (in the template.php file of the theme), I can access: $view->style_plugin->row_plugin ...
0
votes
0answers
12 views

Fill a field with a specific number when clicking on a link

I have changed my node.tpl.php file a little bit, <div class="content clearfix"<?php print $content_attributes; ?>> <?php // We hide the comments and links now so that we can ...
-1
votes
0answers
10 views

Drupal 7 and Adobe Edge Animate

I have an ecommerce store im in the process of building using drupal commerce. One product type needs to be customizable. It will be a shirt that can be customized with what i think is the best ...
0
votes
1answer
27 views

PHP code works on one drupal 7 site but shows blank page on another? [on hold]

OK we are currently undergoing a site redesign, the designers have built us a Live site in Drupal 7 and have a Development site also in Drupal 7 with our new layout. I am in the process of recreating ...
0
votes
1answer
9 views

How to install certain modules only for specific site using Acquia Desktop

I am using Acquia Desktop for creating multisites. Problem is whenever I am installing a module it gets replicated in everyother site. What i need to know is that if i want to have a module only for ...
-1
votes
2answers
23 views

call views block with php

I make a page and enable php filter core module too. Now I want to call a views block with php. How can I do this? How can I call a views block with php?
0
votes
0answers
10 views

How to store a variable array at THEME_preprocess_page to use in a page.tpl? [closed]

In use to have this menu code working well in page.tpl.php but I learned it is best practice to do the heavy lifting on the template.php or in the case of omega 4 sub theme, you place all your ...
0
votes
0answers
23 views

Does PHP & SQL Upgrade affect Drupal? [closed]

This drupal website is hosted on a server with the following specifications. Current versions on server : PHP : 5.2 MySQL : 5.0 will be upgraded to: PHP : 5.4 MySQL : 5.5 by the hosting company ...
0
votes
0answers
12 views

Delvelop application using drupal functions and classes in custom PHP code [closed]

How can I use drupal core classes and functions in my custom PHP code ? Idea is built a website using drupal with a custom document management module using drupal core classes and functions. It will ...
0
votes
0answers
14 views

hook_init executing instructions multiple times..Does it happen only for drupal_set_message or also for other statements? [duplicate]

I have added a Drupal_set_message in my hook_init implementation of my module. I havent placed any if condition as i want the set of instruction to occur in every page . But often in many pages i can ...
1
vote
0answers
15 views

How to use drupal tokens using token_replace

Recently i developed a module which will prompt a message to user when he logs in Hi xyz .thanks for vising the site. using drupal_set_message.Now in order for this to work i had to use ...
-1
votes
0answers
16 views

Get Post By Tags

How we can get the post by tags. I have used below snippet by not getting post $node = node_load(arg(1)); if ($node != NULL) { $field = $node->field_my_vocabulary; $terms_en = $field['en']; ...
0
votes
0answers
13 views

Drupal alter country list generated by location module [duplicate]

I want to remove some countries from the drop down field provided by location module, is there any admin way to remove the fields or hook_form_alter is the only way to limit them, thanks in advance
0
votes
0answers
18 views

How to get the value of a content type field in Drupal and pass it to a JS file

In my Drupal theme I have a field for soundCloud URL which its machine name is (field_soundcloud_url_) I have a javascript file that will work based of the value of this variable. But it does not ...
0
votes
1answer
18 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
16 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. ...
1
vote
2answers
22 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
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
21 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
40 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
22 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
29 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
22 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
11 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
24 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
14 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
22 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
2answers
47 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
14 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
29 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
21 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
39 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
140 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
45 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
24 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
24 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
61 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
20 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
42 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
34 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
28 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
174 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 ...