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
3answers
23 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
12 views

preg_replace_callback(): Modifier /e cannot be used with replacement callback [on hold]

Our site produces about 12 errors, all similar, but referring to slightly different sections of code: Warning: preg_replace_callback(): Modifier /e cannot be used with replacement callback in ...
0
votes
0answers
4 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
30 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
21 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
0answers
15 views

How to install drupal 8? [on hold]

How to install drupal 8 on a localhost Mac Mavericks 10.9, with apache 2, php 5.4 and mysql.
0
votes
1answer
16 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
9 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
21 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 ...
-1
votes
0answers
17 views

how to check or uncheck checkbox on click using cookies

I am using a jquery code to check/uncheck checkbox when i am checked checkbox they work good but when i am uncheck checkbox and refresh page they cannot uncheck they show me checkbox is checked. here ...
0
votes
1answer
18 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
17 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
22 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
19 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
17 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
31 views

php - get value from custom field [closed]

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
42 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
51 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
28 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
24 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
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
23 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
29 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
34 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
28 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
23 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
24 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
37 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
49 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
26 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
39 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
18 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
28 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
45 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
34 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
25 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
30 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
41 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 ...