Questions tagged [7]

Version tags should be used only for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
0
votes
1answer
9 views

hook_custom_theme() works except if a user submits a user form with mismatched passwords. Then they get served the admin theme

Title basically. My hook_custom_theme() has been working for ages and I only just realised the admin theme is being served for an error when saving a user form ie. mismatched passwords. A snippet ...
0
votes
0answers
7 views

How to print in views field template the url of a multi field image?

I would like to print in a views field template the url of each image of a multi field image. This is my code but print only the URI $vals = $view->field['field_property_slideshow']->get_value(...
-3
votes
1answer
20 views

Transfer Aegir site to LAMP

Can anyone please advice me on how to move a Drupal 7 site from Aegir to a LAMP stack? I've been handed the emergency project of moving a site to a new hosting. Ordinarily, that would be easy enough ...
0
votes
0answers
9 views

Entities of type Group and Group_Type are deleted when running drush updb or drush rr

I am using the Group module combined with a feature module. The feature module includes two group types in the implementation of hook_default_group_type as can be seen in here: https://pastebin.com/...
-2
votes
0answers
20 views

Send JSON with hook_menu and sent to method POST to URL [on hold]

I have written the following code: /** * Implements hook_menu(). */ function [NAME_MOD]_menu() { $items = array(); $items['test/json'] = array( 'page callback' => 'test_json_logs', '...
0
votes
0answers
13 views

Page relative to a node [on hold]

I have a working php script which takes a few arguments and prints a result based on the arguments. I also have a drupal website with a lot of content. Every node contains the abovementioned arguments ...
-1
votes
0answers
11 views

Determine what OS that the website is running on at any given time [on hold]

I have a situation where we are attempting to use flag emojis to represent different countries in some text fields. However, we have an issue with this when the drupal site is accessed from a Windows ...
-2
votes
0answers
23 views

XSS problem and mod-security [on hold]

ive been got , i think . my hostings' mod-security has identified a problem> its all seemingly been fine so far for a couple of years Pattern match "(?:\b(?:(?:type\b\W?\b(?:text\b\W?\b(?:j(?:...
0
votes
0answers
20 views

Why all emails are rerouted to one email address?

All emails are sent to Email_1(for exmaple only). Even when I try to use different email(for example Email_2) and execute "Send test email" in mysite/admin/config/system/smtp, the Email_1 receives ...
0
votes
0answers
9 views

Warning: Attempt to modify property of non-object [on hold]

I have created a custom module for updating webform field data, but I am getting the error Warning: Attempt to modify property of non-object in gievances_webform_submission_presave() I am using ...
0
votes
0answers
3 views

Unable to install site when attempting to upload a Background Process module

We recently added a new module Background Process to our local drupal environment by running the command drush en background_process -y. After installing, I was able to use the method ...
1
vote
1answer
33 views

Set parameter for internal or external traffic based on IP

We want to block external traffic in Google Tag Manager and I am trying to do something like shown here. I created this: /** * Implements hook_init(). */ function myfunction_init() { $...
1
vote
1answer
18 views

Display summary + read more links if body content is long, otherwise display body alone

We have a content type which has a customized template. In general, the body content of these nodes is short -- one to two sentences at most. In some cases, however, the body content is a paragraph ...
-2
votes
0answers
20 views

Ban user from forum

I am using Drupal 7 Advanced forum module. I need the functionality to ban a specific user from forum for a certain amount of time. I need exactly what the 'Ban user' module does except that it ...
-2
votes
0answers
23 views

Author of last revision not displayed [on hold]

I can see who has created revisions of the page, and which ones are not yet published, but I can't see who published the last version of the page. The task is to see the author name of the published ...
-1
votes
0answers
11 views

entity_metadata_wrapper not saving data consistently

When using the Entity Metadata Wrapper, I am getting inconsistent results when attempting to update data on the user object. I have a chunk of code that looks like this: global $user; $user_data = ...
1
vote
0answers
16 views

Incorrect User data being loaded after save

I am running into some data inconsistencies when attempting to load user data after saving the data. Basically, I have a callback that will update a field on the current user object. In a simplified ...
0
votes
0answers
17 views

It's possible to inject text in the not-found message [on hold]

It's possible to inject text in the not-found message in order to trick the user to make him visit website or do something an attacker might be interested in. It is returning the user input in the ...
2
votes
1answer
28 views

Is there a way to get the max size of a varchar textfield?

I have an entity with a textfield created using the core Fields feature that looks like this when I inspect the type of the field table in the database varchar(40). I want to be able to determine max ...
-1
votes
0answers
27 views

How do I prevent/mediate constant site attacks?

I'm using Drupal 7. I scan my log messages daily. I've noticed an increase in external attacks that include: access denied - typically “node/add” page not found – typically a php file call, or, ...
0
votes
1answer
39 views

Adding a view block to a basic page

I have been tasked with creating a new basic page that contains displays, the content of some new content type. So far, I have created the basic page and I have also created a new view block (i.e. I ...
0
votes
1answer
12 views

Is there a field tpl for body and/or title fields?

I need to add some data- attributes and I am hoping to change it for the body and title fields on article content types. Do the title/body have tpl's that I can modify to add these? Or another method ...
1
vote
1answer
23 views

How to align views pager url with real page number?

When creating pager in views (D7) you get urls with query parameter like page=X by default. But this X does not match actual page number. page=1 is generated for 2 link in the paginator and so on. ...
0
votes
0answers
9 views

CKEditor/Media Gallery Using Absolute URL for images, how to update?

After entering 100's of hours worth of content we noticed that the images entered through the media gallery plugin contain absolute paths, not relative. This means they breaking when we switch domains....
0
votes
1answer
18 views

How to set “Language Selector dropdown” required in node form

I want to know How to set "Language Selector Drop-Down " required in node form? I tried to do this via hook_form_alter, but it seems $form['language'] is not created in this hook ! Is there any hook ...
-1
votes
0answers
32 views

hook_form_alter() does not work

I have created a form by web-form module in drupal 7 now I am using a form_alter hook but it is not working here my code function gievances_form_alter(&$form, &$form_state, $form_id) { ...
0
votes
0answers
13 views

How to merge 2 term reference fields from 2 content types programmatically

I am looking to consolidate two term reference fields from two different content types into one term reference field used in both content types. I would like to try and do this programmatically and ...
0
votes
1answer
12 views

jQuery not working with JS Injector

I've put the following jQuery into JS Injector on my Drupal 7 site: jQuery(document).ready(function($) { console.log( "ready!" ); $(".org-chart-detail-box").css("background", "green !important")...
0
votes
0answers
11 views

Show possible counts for unselected facets

I'm using Search API with FacetAPI and Search Api Database programmatically to good effect. The problem I am finding though, is that if a facet isn't selected, then it won't return any data on the ...
1
vote
1answer
18 views

Cannot assign roles creating User through REST endpoint

Sidenote, already seen this page, doesn't seem to help: How to create user with role(s) through REST service? I've setup a new endpoint on my platform to try to allow a 3rd party to create users on ...
0
votes
1answer
35 views

Programmatically change the weight of a form element

I have a user activation/registration form with different attribute like Captcha and security questions which are coming from different modules. I want to change the display order of form elements. ...
2
votes
1answer
24 views

How do I check Organic Groups group permissions from a custom module?

I'm trying to show or hide a button based on if a user has permission to post content to a group or not, but I don't seem to be able to call the og_user_access function from my custom module. I've ...
-1
votes
1answer
30 views

Multiple or Single Git Repository

Though this isn't about a Drupal issue specifically, it is specific to Drupal. I'm looking for community opinion on best practices for storing multiple versions of Drupal. In my case, I've got a ...
0
votes
0answers
15 views

getenv() returning empty strings when variables set through MAMP

I am using MAMP to run a local version of our Drupal project, but Drupal is unable to interact with it's environment variables. In MAMP, under the Apache tab I set this line as Additional Parameters ...
0
votes
0answers
7 views

pm gantt module not displaying the gantt chart

Iam using the pm module of drupal 7. I have also installed the pm gantt module. created a project and two tasks for the project. but the gantt chart is not getting displayed. I searched the console ...
-1
votes
1answer
29 views

Fetch and update with foreach loop

I need to update the database. the code I am using was working, but after I have done some Drupal updates, it doesn't work anymore. I'm fetching data from table all is working but when I add code ...
0
votes
1answer
19 views

IP blocking doesn't prevent requests

I am getting a lot of bad requests from a crawler at a specific IP Address non-stop. I added the IP to the blocked list and cleared the cache, but I still see more requests in the dblog coming in from ...
0
votes
0answers
23 views

How do I store data in the session?

I have loaded a user using user_load(). I want to store the data in the session for the currently logged-in user. I am using the following code. global $user; $test = user_load($user->uid); $...
0
votes
1answer
61 views

Recommended Drush version to use and install for Ubuntu 19 with PHP 7.2 and running Drupal 7

It's been awhile since I've upgraded my server and I'm setting it up from scratch. I'm using Ubuntu 19, apache 2 and PHP 7.2. My site is Drupal 7 which is still running php 5.6 in my old server. I'm ...
0
votes
0answers
10 views

Uploading xlsx-file changes permissions of the file? Errors when loading via PHPExcel

My goal is to let the user upload a xlsx-file and then read the file to create objects. So i created a file upload page in my custom module where the user can upload a file via the 'file' form field ...
0
votes
0answers
17 views

Ajax in a template file to show the value of session variable

I have a webform in my node.tpl which action points to hook_menu url of a module. When the form submit happens, it compiles the form data in the custom module and stores the response value in a ...
0
votes
0answers
17 views

Nginx URL rewriting giving 404

I have a URL of something like www.something.com/development/2019/06/24/xxxxxxxx and I have rewrite it to www.something.com/news/xxxxxxxx I have written following code in nginx rewrite ^/...
0
votes
0answers
12 views

Search API index one of many fields as one field

I have a site-wide search page that's powered by Search API and Search API Solr. It returns results straight from an index that contains content from various entity types (files, nodes, taxonomies, ...
0
votes
0answers
14 views

Alter Entity Reference data before view is rendered

I am attempting to work around a bug where an Entity Reference Field on User Account is saving duplicate references. I originally tried to remove any duplicates on the field by implementing ...
0
votes
0answers
15 views

Automatically generated <a> tags when rendering body content

My D7 creates anchor tags automatically when 'www.*****' in text is found. Example: <span class="class">www.site.com</span> produces <span class="class"><a href="www.site.com"...
1
vote
2answers
23 views

Executing view twice with different filters returns same results

Here's my simple scenario : Execute view with exposed filter (min & max dates) If there are no results, execute again with min date = 0 to get all results Unfortunately, the query static cache ...
0
votes
0answers
10 views

Set a field value with FAPI states

Does anyone know if there is a way to set the value of a field with states? E.g. If "this" is checked, set input value to "0" Something like.... $form['booking_process'] = array( '#type' =&...
1
vote
1answer
91 views

Modified user record during presave hook not saving properly

A project I am working on has a bug where an array field on the user object is getting duplicated values. To fix this bug, I am implementing the hook_user_presave hook in one of our custom modules to ...
0
votes
0answers
11 views

Hook to call a function after menu rebuild?

After a menu rebuild, such as one that occurs automatically when visiting the Modules admin page, some of my Drupal JS behaviors are not in the correct state. I need to re-initialize or attach them ...
0
votes
0answers
24 views

AJAX in callback function

I'm trying to convert old code written in standard HTML/PHP/Javascript/JQuery into a format (more) consistent with Drupal. The code consists of a form with interactive elements (regulated by ...