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
1answer
17 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
16 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 ...
0
votes
0answers
13 views

How can I immediately flush the php output buffer to the browser in Drupal hook_menu, flush & ob_flush not working?

I'm trying to immediately send the php output buffer to the browser while in a Drupal hook_menu but it doesn't seem to be working. I use the following code on a non-Drupal php page on the same Apache ...
0
votes
0answers
19 views

How to exchange variable values between contextual filters of the same view?

I have a view with two Global: NULL fields as contextual filters, which use php code in their default value. The first global null value calculates and provides an order quantity, and the second ...
1
vote
0answers
16 views

Warning: unlink() expects parameter 2 to be resource, string given in drupal_unlink() (line 2194 of /includes/file.inc)

I'm using drupal_unlink() for deleting my files, but don't know why I'm keep on getting this error repetitively? Warning: unlink() expects parameter 2 to be resource, string given in drupal_unlink() ...
0
votes
1answer
16 views

Pulling user data from external database

I have a game that utilizes mongodb to store the user information. What I am trying to do is use drupal as a community front so users can register for the game in drupal. The problem is that I don't ...
-1
votes
1answer
27 views

php - get value from custom field [on hold]

I try to get a value of a text field inside rules php like this: <?php $glo = $node->field_email['und'][0]['value']; print $glo; ?> But getting error: Notice: Undefined index: value in ...
0
votes
1answer
31 views

rules - check if email is in use

I would like to create user account using rules, after anonymous user creates a node and inputs his email to a email field. Before that I need to run a condition if the email is already in use. What ...
1
vote
2answers
47 views

Showing block in specific urls and content types

I'm using this code to show block in specific urls and content types. <?php $match = TRUE; // block is visible on the content types entered here $types = array('product_display' => 1, ...
1
vote
1answer
26 views

Showing a block in specefic content type and urls

I have a block that i want to show it in a specefic content type and some urls . i tried to add php like : <?php $match = FALSE; // block is visible on the content types entered here ...
0
votes
1answer
23 views

How to get the highest value of a specific field in a multivalue field collection

How to get the highest value of a specific field in a multivalue field collection, USING PHP? This is about displaying the right discount for a marketplace product. There is a node type Product with ...
0
votes
0answers
20 views

Upgrade php version cause site error [closed]

After upgrading php version 5.3 to 5.4 cause "ERROR 500 - INTERNAL SERVER ERROR" error in my site.My drupalversion is 7.28 .
0
votes
2answers
2 views

Is there a way to create a Text Format on install of a Drupal Module? And enable a Filter for my module?

I want to do a custom filter that replaces certain text with HTML. Essentially shortcodes as done by Wordpress. Unfortunately, the Filtered HTML Text Format strips most HTML. So I created my own ...
0
votes
0answers
21 views

How to use exec() to run external software in drupal?

i am trying to use exec() function to run external software. this software is an .exe file. code that i created is given below $command = 'php sites\all\modules\wkhtmltopdf\bin\wkhtmltoimage.exe ...
0
votes
1answer
24 views

Translate View footer

I'm trying to translate a link in footer on my views . the code is : <?php $link = l(t('Click to view all the writing categories'), 'somewhere', array('attributes' => array('class' => ...
0
votes
1answer
28 views

Where is $page['sidebar_second'] rendered? I want to edit the style of the <ul> listing of the recent comments

The comments in the block recent comments is styled with an unordered list. I want the points of the list beginn exactly under the N of New Comments. Google Chrome tells me that there is a ...
0
votes
1answer
32 views

How to fetch the status of profile flag?

I have a profile flag called "keep my photos private" using which user can flag his content and can keep it private. I want to fetch the status of the flag by the specific user. I have tried php code ...
0
votes
0answers
24 views

Returning the userId from an external script

I have a very simple external php script which will not return the userId. The script is posted below: <?php include_once "/includes/bootstrap.inc"; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); global ...
0
votes
2answers
22 views

Drupal 6 on php 5.5 compatibility

Did someone tried Drupal 6 on php 5.5? I have running 20+ drupal 6 sites on php 5.4 without large issues, but what about php 5.5?
0
votes
1answer
23 views

Insert a view with a context using php?

I know I can insert a view using the following code: <?php $view = views_get_view('VIEWNAME'); print $view->preview('default'); ?> In my view I have a contextual filter of ...
0
votes
0answers
36 views

How to make contents public or private based on flags

I have two flags in my privacy profile settings to make contents public or private, I have two content types called 'videos' and 'albums' and two flags called 'keep my videos private' and 'keep my ...
0
votes
2answers
16 views

Adding an active menu trail to the main ul, in the html.tpl.php?

Is there an easy way to get the active menu trail in this nav ul? I don't really understand PHP yet, I'm still learning. I personally would have setup the menu in Drupal, not in the html.tpl.php. ...
0
votes
1answer
46 views

Generating a random number without duplicates on blog comment

A section of my site is a blog where I allow comments. Each comment has a thumbnail associated with it. If the commenter is a user, then their profile photo is used. If they are anonymous I have a ...
0
votes
1answer
25 views

Cannot redeclare drupal_get_hash_salt()

I had a site and it was running fine on the live server but when I moved it to my local server it gave me this error. Fatal error: Cannot redeclare drupal_get_hash_salt() (previously declared in ...
0
votes
0answers
47 views

Tracking the userID

Where can I find the code where Drupal sends strings (such as the userID) from a content submission page to the node table in the database? If you know of a guide that explains the Drupal content ...
0
votes
1answer
38 views

How to comment on image in colorbox (modal form)?

I have created view to display images and also user to display it in popup using Colorbox trigger in view. I want to allow users to comment on each individual image in modal form only. Just like ...
0
votes
1answer
17 views

browscap.ini is not configured in php.ini

In my status report I'm still getting this error: Browscap data / browscap.ini is not configured in php.ini. When I searched on the internet I found this topic that suggested this: [browscap] ...
0
votes
0answers
27 views

How to print Global:view using php code in drupal view?

I have two views called contents where I am displaying Albums and videos, another view is photos count where I am displaying photos count of specific album. I have included "photos count" view into ...
1
vote
3answers
44 views

How can I print the value of the node body using PHP with the text format applied?

I am printing the node body using PHP on an admin view via a template; however, when I do this, the text comes out as one giant block (spacing is ignored). However, when I go to edit the node, the ...
0
votes
0answers
33 views

Automatic cron job not giving proper results

When I ran my cron manually ,everything is working fine.But when it run automatically it is generating the error message. This is my code in my cron. function hook_cron() { mymodule_report(); } ...
0
votes
0answers
9 views

use a conditional statement with display suites and imagecache action for image display [duplicate]

I have created a blog that has two types of blogs; images and video. Both of which have a field named Summary Image (that image displays on the blog teaser display) I have created 2 image styles one ...
0
votes
1answer
36 views

Drupal memcache is not updating cache values sometimes [duplicate]

I am fighting with this issue since last week.I need to cache some set of values in which each value belonging to specific id on every cron run.I am setting the expire time to "CACHE_PERMANANT" and ...
0
votes
1answer
23 views

change node author with rules. using an array of users with specific role

I am creating nodes with rules and the default author for these nodes is the user 1 (admin). I have a set of users as 'administrator' roles. e.g: John, Jack, Sophie Is it possbible with rules(or ...
0
votes
0answers
13 views

Add class from Panels Setting form to my style output

Im using D7 and Panels with the Omega 4 theme. I have successfully managed to create my own Panels Layouts as well as Panels Styles. Currently my Panels Styles are quite simple, they just print the ...
0
votes
0answers
13 views

unwanted php errors and warnings displaying to screen

I'm trying to understand why I have a php error message displaying to the screen. The error is this one: Warning: include_once(): Unable to allocate memory for pool... I believe I can eliminate the ...
1
vote
1answer
18 views

Drupal 7 way to allow instantiating derived classes

I have a class called MyService, a function to get the only instance of it custom_get_my_service(), and multiple functions a,b, etc that call the instance getter, as you can see below. All of this is ...
0
votes
1answer
66 views

Problems with permanent caching in drupal

My requirement is to update some params in the script for a some specific nodes. If a set of nodes is attached to an X content type, it should take some params in a script. For this purpose I am ...
0
votes
1answer
16 views

Render view for specific user, drupal_mail

Is it possible to generate the content of the view as a specific user. So only the content the user has access to is rendered. //Get view $view = views_get_view("list_nodes"); //Pass arguments ...
0
votes
0answers
22 views

Drupal 7 - render the login form outside of drupal

Say i have drupal installed under /var/www/ and i create a custom php page (call it ex_login.php) under the same directory /var/www/ex_login.php How can i render the existing drupal user login form ...
0
votes
0answers
29 views

Error when accessing /user/login

I'm working with a themer on a new site. Everything is fine for me on my machine, but since I provided him a Db Dump and the latest code went into GIT he's getting a fully working front-end site, but ...
0
votes
1answer
38 views

Using views to display content comparing users id

First of all, sorry for my bad english. I'm using Drupal 7 Here is my problem : I have a views in wich I would like to display a list of custom content type only for the users that I selected with ...
0
votes
0answers
8 views

Cannot connect Drupal 7 with Apache Solr, Error Undefined property: stdClass::$entity_type in apachesolr_search_process_response()

I am new to Drupal and Solr development, I am trying to do basic thing, which is connecting Drupal with my Solr on my localhost. I have Drupal 7 and I have installed Apache Solr module by downloading ...
0
votes
1answer
27 views

Creating default object from empty value

I am having issues with a template - in the template.php there is code causing a warning: Warning: Creating default object from empty value in theme545_preprocess_html() (line 31 of ...
0
votes
0answers
35 views

Drupal PrivateMSG Module: How to print Inbox msg Count & Outbox msg Count?

Can someone please tell me how to do this please? I know how to display the unread count, but i also need to print the inbox and outbox count in my custom module. Some help would be much appreciated, ...
0
votes
0answers
15 views

Getting the uid instead of the pid with profile2

I would like a function that allows me to have the same uid and pid with profile2 for each user but I don't know how I can do that. I'm trying to make a function which allows me to return a list of ...
0
votes
1answer
21 views

Using Contextual Filters and Panels

Hi Drupalites I need some help. 1.I was using relationship to output authors personal info associated with a piece of content which i did successfully. so i was trying something else but i didnt ...
0
votes
2answers
32 views

Show Block only if it's a front page and GET variable is set

I am setting up a block in Drupal 7 to "show block on specific pages" through PHP. What I want is that if it's a Front page and there is a GET (listed) variable, only then it shows the block ...
0
votes
0answers
20 views

How to add functions inside block PHP code

I have a node block which contains PHP code snippet. I found that if I define a function in that block and call it within the block, the code seems to break. I know that I can add the function into a ...
0
votes
1answer
28 views

Rule to send mail to the users about the percentage of their profile completed(single & multiple profiles)

I am trying to write a rule to send an email to the user if his/her one of the profiles is not completed. But I am not getting how to get the empty field's list to sent to the user. What actually i ...
1
vote
2answers
41 views

Can't install Drush on FreeBSD

I'm running FreeBSD 10 with PHP5.3.28 I can't use the port or package to install Drush because it will install the default PHP (5.4) as a dependency. So I installed Drush manually. Then when I ...