texts: Is there a way to re-invoke #ajax on forms when the form itself is returned with ajax?

texts:
I want to change the delete link on comments so that the delete confirmation is returned with Ajax and then the delete confirmation is executed with Ajax.

I have fixed the form so the delete confirmation at /comment/%cid/delete
so now the submit action is performed with ajax.

Here is the code I used to accomplish this:

function awesomesite_comments_form_comment_confirm_delete_alter(&$form, &$form_state, $form_id) {

  // Add the Ajax Submit Function
  $form['actions']['submit']['#ajax'] = array(
    'callback' => 'awesomesite_comments_ajax_delete',
    'progress' => false,
  );

}

function awesomesite_comments_ajax_delete($form, $form_state) {

  // Get rid of all of the messages that have been set
  drupal_get_messages();

  // Get the comment & node objects
  $comment = $form_state['comment'];

  // Put all of the Ajax Commands into an array
  $commands = array();

  // Place the comment above the form
  $commands[] = ajax_command_remove('#comment-'.$comment->cid.', comment-'.$comment->cid.' + .comment');

  // Return the Ajax Commands Array
  return array('#type' => 'ajax', '#commands' => $commands);

 }

This works perfectly on the delete confirmation page, however, when I return the form with Ajax, the submit no longer is processed with Ajax and a standard page refresh takes place.

Here is the PHP code I have to for delivering the confirmation form via Ajax:

function awesomesite_comments_menu_alter(&$items) {
  $items['comment/%/delete/ajax'] = $items['comment/%/delete'];
  $items['comment/%/delete/ajax']['delivery callback'] = 'ajax_deliver';
  $items['comment/%/delete/ajax']['page callback'] = 'awesomesite_comments_ajax_confirm_delete_page';
}

function awesomesite_comments_ajax_confirm_delete_page($cid) {

  // Get the HTML of the detele page.
  $data = drupal_render(comment_confirm_delete_page($cid));

  // Put all of the Ajax Commands into an array
  $commands = array();

  // Replace the HTML
  $commands[] = ajax_command_html('#comment-'.$cid.' + .comment', $data, array('effect' => 'fade'));

  return array('#type' => 'ajax', '#commands' => $commands);

}

And here is the Javascript I have for taking the "Delete" link on the comments and returning the form (from the callback above)

jQuery('a.ajax-link:not(.ajax-processed)').addClass('ajax-processed').each(function() {

        // Cret the element settings object
        var element_settings = {};

        // Get rid of the progress
        element_settings.progress = { 'type' : 'none' };

        // setup the click elements and add the href
        if (jQuery(this).attr('href')) {
            element_settings.url = jQuery(this).attr('href');
            element_settings.event = 'click';
        }

        element_settings.effect = 'fade';

        // Get the base
        var base = jQuery(this).attr('id');

        // Register the Ajax Request with Drupal
        Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);

    });

I believe what is happening is that Drupal is processing all the forms on the page for #ajax when the page is loaded, however, since the form is loaded via AJAX it isn't setting up the #ajax information (which I can confirm is present). How can you force Drupal to check for new forms after an Ajax request? Or am I missing something?

any help would be greatly appreciated!


texts:
I wrote PHP code that sums floating point values.
The problem with it is that the field value ("field_money") changes by itself anytime.

$total = (float) ([node:field_emp_salary1]+[node:field_emp_mobile]+[node:field_emp_reward]+[node:field_emp_mission]+[node:field_emp_compensation])-([node:field_emp_paycut]+[node:field_emp_advance]);
$total = number_format($total, 2);
$nid = 134;
$node = node_load($nid);
$balance = $node->field_pbalance['und']['0']['value'];

if ($total > $balance) {
  print  $total;
  echo "There is a problem.";
}
else {
  print $total;
  $balance = $balance-$total;
  $node->field_pbalance['und']['0']['value'] = $balance;
  node_save($node);
}


texts:
I'm completely new to Drupal. I've been reading a lot of questions but I could not find anything that fits my needs. I need to create an internal site for my university.

There is one person that is the university coordinator (UC). This person should be able to add a department coordinator (DC) in a way that there are two fields in the form: department name (text field) and the email of DC. After submitting the form a new user should be created with the username the same as name in the email (before @) with a random password that is sent to the email address. This user should be below UC in the hierarchy. DC then should be able to add institute coordinators (IC) the same way. Each DC should be able to manage their ICs. How can I set-up this scenario? Which modules should I install? Is it possible without writing code?


texts: Module (or code) to display character count?

texts:
I would like to add a simple character counter on a form textarea.

Is there a module that does this?

I don't want to limit the number of characters that can be input; I only want to display how many characters have been input in the textarea so far.


texts:
$query = db_select('node', 'n');
   $query->join('field_data_taxonomy_catalog', 'tc', 'n.nid = tc.entity_id');
   $query->leftjoin('field_data_field_chip', 'fdc', 'n.nid = fdc.entity_id');

   $query->fields('tc',array('taxonomy_catalog_tid'));
   $query->fields('fdc',array('field_chip_tid'));

   $query->fields('n',array('nid'));

   $query->condition('tc.taxonomy_catalog_tid',$get_tid,'=');

   $query->orderby("fdc.field_chip_tid","ASC"); //I Want to sort the resultset on the basis of weight instead of the term Id.

   $result = $query->execute()->fetchAll()

I need to sort the result on field_data_field_chip weight instead of the term Id. I am new to Drupal and don't know how to fetch the weight of the taxonomy terms.


texts: How to remove any data "http_proxy" module added or changed?

texts:
I have a serious problem with a broken XML-Feed, that occurred after I installed http_proxy module. I have uninstalled the module, cleared the cache several times and even truncated the cache tables of the database manually. (I have to admit i didn't made a database backup before the installation). The XML feed is flawless, actually it didn't change at all.

I have following error messages:

in the drupal log:

  Notice: Undefined offset: 1 in http_request_get() (Zeile 239 von
  /example.com/sites/all/modules/feeds/libraries/http_request.inc).

The error message above is 2 times in the log with the same timestamp.
Then more recent:

  Warning: simplexml_import_dom(): Invalid Nodetype to import in
  FeedsExXpathDomXpath->__construct() (Zeile 393 von
  /example.com/sites/all/modules/feeds_ex/src/FeedsExXml.inc).

followed by
from the feeds module log:

  Start tag expected, '<' not found on line 1. Error code: 4

So i guess this comes from the http_proxy module. How can i remove any trace of it? Does someone have another idea where to look?

Thanks!


texts: How do I prevent a link on an overlay page from opening in another overlay page in Drupal 7?

texts:
I have created a custom module that opens up a page in the admin overlay.  Upon going to that page, a PDF is generated and the link to the file is displayed on the page.  I created the link using l(), and gave the link a target attribute of '_blank' to open in a new tab/window.

l('Click here to download your PDF file.', $f_url, array('attributes' => array('target' => '_blank')))

The link looks like it is generated correctly.

Click here to download your PDF file.

When I click on it, it opens in a new window, but somehow the overlay fragment is tacked onto the end of the URL in the new window address bar, which appears as the following:  http://xxxx.com/sites/default/files/custom-pdf/xxxx_4.pdf#overlay-context=test.html.

The browser throws up a dialog box with a title of "Adobe PDF Document" and a message alert of "This operation is not allowed".

If I click this link from a non overlay page, it does exactly what it's supposed to do: Open the PDF in a new window.

I'm not exactly sure what's going on here.

How is the overlay fragment being appended to the URL, and how can I prevent it?


texts: Webform - User to edit submission (admin can close)

texts:
I have a webform that a authenticated user can submit. Where is the page for the authenticated user to re-edited their submission? I can't find it?

I also want to extend a another function. I want to have the ability to close a submission (so the authenticated user) can't re-edit it anymore.

Any suggestions?

Thank you,


texts:
Drupal 7.59

I use Views extensively, and would like to add https://www.drupal.org/project/views_data_export_pdf module.

As per the Module documentation, a prerequisite is the installation of wkhtmltopdf Library (https://wkhtmltopdf.org/), which should result in the following structure :

sites/all/libraries/phpwkhtmltopdf
sites/all/libraries/phpwkhtmltopdf/scr
sites/all/libraries/phpwkhtmltopdf/scr/Pdf.php

But I don't find those files in the wkhtmltox-0.12.4_linux-generic-amd64.tar.xz dowload, especially no Pdf.php

I am not a programmer, and thus not familiar with Libraries installation : any help would be welcome


texts: Hierarchy in entity reference view display

texts:
I have a hierarchical taxonomy vocabulary of page categories:

Category A
  - Category A1
  - Category A2
Category B
  - Category B1

I would like to list some of them (conditionally) as options on my Page content type. For that, I am using an Entity Reference field, with the "Views" reference method.

I created a Taxonomy view with the Entity Reference display for that, but this way, the categories display as options without hierarchy:

Is there any way to selectively display taxonomy terms as field options on a content type, maintaining the hierarchy?


texts: How do I include my library on the page?

texts:
I have an Angular app I want to use as a Drupal 8 theme but when I try to attach it with a YAML file, Drupal doesn't register that any JavaScript is being added to the theme.

ng.libraries.yml

base:
  version: 8.x
  css:
    css/styles.09e76a721be8ced0c439.bundle.css: {}
  js:
    js/inline.6375acbd4540ff168f58.bundle.js: {}
    js/polyfills.62cd0a749311c6ac36ca.bundle.js: {}
    js/vendor.d8949c111a4a3560f92d.bundle.js: {}
    js/vendor.d8949c111a4a3560f92d.bundle.js: {}

However, when I reference the script locations directly in my template, it works fine:

html.html.twig

<!DOCTYPE html>
<html{{ html_attributes }}>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Hand of Death</title>
    <link href="themes/ng/dist/styles.09e76a721be8ced0c439.bundle.css" rel="stylesheet" />
  </head>
  <body>
    <app-root></app-root>
    <script type="text/javascript" src="themes/ng/js/inline.cad96cf6be5b6cfb5176.bundle.js"></script>
    <script type="text/javascript" src="themes/ng/js/polyfills.62cd0a749311c6ac36ca.bundle.js"></script>
    <script type="text/javascript" src="themes/ng/js/vendor.d8949c111a4a3560f92d.bundle.js"></script>
    <script type="text/javascript" src="themes/ng/js/main.665799e3572bc9816ad1.bundle.js"></script>
  </body>
</html>

From what little I can make sense out of the docs, somewhere I'm going to have to call Drupal.behaviors.myBehavior, but that would not actually work in my situation.

Is there a way to get JavaScript to work without hardcoding it in the template?

EDIT: I've reverted this to the original so the corrections make sense to future users and went ahead and opened a new question with the most recent code.


texts: Remove entire column from the table programmatically in twig file

texts:
In my twig file views-view-table--myview.html by default a table is coming with header and rows. And I want to remove entire column from the table programmatically in twig file.

How it can be done?


texts:
I'm attempting to get MetaTag info for a decoupled site but the JSON API is not converting the object to JSON correctly. I'm seeing other fields show up fine - the issue is isolated to the MetaTags.

The output appears like this:

field_meta_tags: "a:2:{s:5:"title";s:10:"Test Title";s:11:"description";s:21:"Test Body Description";}",

From what I can tell, s:5 represents an string of 5 characters ("title"), s10 represents 10 characters ("Test Title"), etc etc. Has anyone seen this before?

Drupal 8
Metatag version: '8.x-1.5'
JSON API version: '8.x-1.16'


texts: Are ids strictly sequential i.e. does later added content always have higher id?

texts:
I thought that ids (user id, node id, ...) are strictly sequential which ensures that later added content has always higher id that a previously added one. So that when I have a hierarchy (lower element has a reference to its parent) and the 'reference' is not editable (set on creation) I can safely assume that a child has higher id that a parent.

The problem is that in this question @berdir (who I believe knows a few things about Drupal) says that it does not have to be the case...

I know that gaps might appear in the sequence (e.g. when an entity is deleted) but I'm not sure that he meant just that (and I'd rather be sure).

So my question is, how is in reality and when can I not the sentimentality of ids?

//DISC: The hierarchy system is quite complex and (of course) doesn't rely on ids comparison, the aforementioned concept is used just in one case due to optimization.


texts: Is it possible to automatically delete image files that have been uploaded when a node is not saved?

texts:
I'm using Drupal 7.  On my site, users can add pictures via a content type, Pictures, that makes use of the core image field.

If a user uploads an image file and saves the node, then if the node is deleted the image file will be deleted as well.

However, if a user uploads an image file and then leaves the page, the image file remains stored in the filesystem and is not deleted.  This means that if users are careless, it is possible for them to add lots of pictures that will never be seen and never be deleted, wasting lots of disk space.

Is there any way to automatically delete these "orphan" files?


texts: combining drupal commerce product display page with checkout page

texts:
I am trying to find a good way of combining the Drupal Commerce Product Display page with the checkout page. I am trying to eliminate a page, so that the user would choose the product variation and fill in his profile data all on the same page.

I see that there is a hook_commerce_checkout_page_info_alter() which looks like it may be a start, but it would need more thought of how to actually combine these two pages.


texts: I'm going to use MP3 Player module to play some audio files on drupal 6. as you know it uses Wordpress MP3 Player as standalone player and it only has one skin, so how can I obtain more skins or maybe a flash API explaining how to build one?


texts: How do I change total number of rows in a view programmatically?

texts:
I had to remove manually some rows from a View programmatically for a lot of good reasons, too long to explain. I did it removing item in the pre-render hook from the array

view -> result

It works fine, but the total number of items contained in the view is not changed. How can i change it programmatically? I tried changing

view -> total_rows

but it seems not to be enough. I saw a lot of total_items elements in the object view, and i think changing them would work, but there are 60 items like that, each contained in objects contained in arrays that are contained in objects and so on and i am not really sure how to change every element with that name, parsing the structure of the object view and changing every total_item with the number X instead of the number Y.


texts:
I need to format a webform's text email report so I'm using that webform's email handler admin screen to use the webform_submission:values to tailor it to what customer wants. I finally get it working on local but when I copied/pasted the working custom body into production 8.9.13 I get this mysterious report:

Body custom value (Twig) is not valid.
The specified file 'modules/contrib/webform/tests/files/sample.gif' could not be copied because the destination directory is not properly configured.

Setting aside that the oddness of requiring an image file in the test directory, I go onto production to see that this directory is owned by the user, who is part of the debian adm group, and the files are 644 which everyone can read. OK, I set the permissions to be a little more accessible, like giving execute access to traverse it but that seemed to make it worse by returning a different error:

The specified file 'temporary://fileIdTSGX' could not be copied because the destination directory is not properly configured.

Drush reports that its Files, Temp directory is /tmp where this file is not found. Looking at the permissions of sites/default/files/php/ returns 777. And the contents of its twig directory do not look like this filename. I could not find what module is driving the error message, but the detail message appears to come from core/File/FileSystem where its prepareDestination() is invoked. Presumably, since Twig is a drop in that happens to be used in this interface may mean that my problem is with Webform's interaction with Twig. But Twig appears to have more than enough access so I must not be looking in the correct place.
Clearing the cache, saving a custom body that is simply:
Submitted on [webform_submission:created]
Submitted by: [webform_submission:user]

returns the same temporary:// error. Since it works locally, there is a directory that's unknown to me that is in play that I need to fix on production.


texts: How to overwrite modules by default with DRUSH?

texts:
I am using a module list from Drupal 7 to populate a Drupal 8 site.

Some modules are now included in core, so there are a lot of confirm overwrite messages like this:

 Install location C:\drupal-8.0.1//modules/imagecache_actions already exists. Do
you want to overwrite it? (y/n):

What is the command for default Y or N ?

Now I use this command:

 drush en module -y

But I would like to set default answer to "overwrite yes" if module is already enabled or already exists and downloaded so I don't have to manually enter Y everytime


texts: How can I display a login and registration form, with an extra field on registration, and hybridauth in a modal?

texts:
I need to display a modal login and registration form if a user accesses a particular page.

On the registration form, I need to collect a phone number.

I need to show the hybridauth login on the form as well.  Is there a solution, or compatible modules to make this solution?

It's a common login/registration solution, so I'd think Drupal has this already.


texts:
I have a text field used to enter a code (like 1111). This code is linked to a file (image) hosted in another server.

When a user displays this content type, I want to automatically display 3 things :

*the field content with the code (1111 for exemple) (I know how to do it)

a picture whose url will always be : www.url.com/FIELD_CONTENT.jpg (www.url.com/1111.jpg)
a link to the picture

Is it possible to do that ?

D8 but i can create a D7 website if needed.


texts:
Is there a way to allow users to moderate nodes and their comments by taxonomy terms? And also allow other moderators to add users to to that term as well? It seems that the standard roles aren't granular enough. I don't want users assigned to a "moderator" role to be able to moderate ALL nodes and comments, just those within a particular taxonomy term.

Basically allowing each term to be a "discussion board" where a group of users are the moderators of that term. Similar to how Reddit works.

Thanks


texts: Is there a way to hide images from the media library?

texts:
I'm using the media module, and I'd like to hide some images (in a certain subdirectory) from the files overview in the admin area.

Is this possible?

Thx in advance!


texts: How do I add an extra css class to my Views rows?

texts:
I have created a view and it gives me lots of css classes for the rows of my unformatted list:

...but not enough...I need a class for the content type or field name also, something like:

I can see in the style options for the page: 'Row class The class to provide on each row. You may use field tokens...'.

Is this what I need? Do I have a 'field token' for content types? Thanks


texts: How to redirect user page to front page for specific roles

texts:
I want to redirect every users page to front page? like if user page url is /user/97 then it redirect to front page if user is not administrator. I want user page inaccessible to other users but only administrators.

How can I achieve this?

I tried doing like this:

<?php

namespace Drupal\myisu_ubit\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
// use Drupal\user\Entity\User;

 /**
   * Listens to the dynamic route events.
   */
 class RouteSubscriber extends RouteSubscriberBase {

 /**
  * {@inheritdoc}
  */
 protected function alterRoutes(RouteCollection $collection) {
   // Change the route associated with the user profile page (/user, /user/{uid}).
   if ($route = $collection->get('user.page')) {
      $route->setPath('/');
   }
 }

}

module.services.yml:

services:
  user_profile.route_subscriber:
     class: Drupal\module\Routing\RouteSubscriber
     tags:
        - { name: event_subscriber }

What am I doing wrong here?


texts: Overriding "/user" page with Feature (Drupal 7)

texts:
I am trying to learn about creating a reasonable workflow between a development site and a production site and I have decided to use the Features module to help accomplish this task.

Standard "/user" page allows me to click "forgot my password" or "create new account", but I want more options and I'd like to override that page with feature module. I am not sure is this a good approach, but with this feature I will have ability for users to create accounts, login to the website, and manage their account profile.

I have added dependencies and Strongarm variables, but I don't know how to make it use "/user" path.

Thanks,
Michael


texts:
I have two entities, article and author which are related to each other.

When I display an author I want to display also all articles of him.

I was thinking about a block which is displayed on some url patterns, but I didn't find a way to pass the current entity as filter for the block.
Nevertheless I am not sure if it is a good practice to define blocks and place them in the layout when they are only get rendered on some pages.

How can I display content related to other content?

EDIT:

Trying to use contextual filter:

Add a relationship to the other entity, but which one should I use?

Content referenced from
Content using

Add contextual filter using default value, content ID from URL


texts: How do I view the maintenance page without putting the site in maintenance mode?

texts:
I've just been asked by the stakeholder of a site I'm working on how he can view the maintenance page of his site so he can test links on it without putting the site in maintenance mode.

I'm going to suggest that we do this in a lower environment, since the info is the same but is there any way to do this?


texts: unset form elements with hook_form_alter()

texts:
I've created my module, but I have a problem when its code executes the following code:

dpm($form);

I can't see the notifications fields (from the Notifications module); also, I can't remove the "Format" fieldset from the node create page ("node/add/question"; my content type is called "question").

The following snippet works great, but is there any other method to print all the form's fieldsets? I just stuck at this notifications field set, as I can't remove it.

unset($form['menu'], $form['comment_settings']);


texts:
I have a file with an uri and I want to get its raw and relative path.

Uri: public://videos/Test Video.mp4
Path: /sites/default/files/videos/Test Video.mp4

I found already a way to do this:

$file_uri = $file->getFileUri();
// public://videos/Test Video.mp4

$absolute_url = file_create_url($file_uri);
// https://www.example.com/sites/default/files/videos/Test%20Video.mp4

$relative_url = file_url_transform_relative($absolute_url);
// /sites/default/files/videos/Test%20Video.mp4

$relative_raw_url = rawurldecode($relative_url);
// /sites/default/files/videos/Test Video.mp4

Is this the Drupal-way? Or is there a better solution for doing this?


texts: Is there any way to show user profile of authenticated user after loged in?

texts:
I would like to have a block that contains basic profile of authenticated user so that they can see their username, photo, email and log out link.

Any help will be appreciated.


texts: How to display google map field in hidden div?

texts:
I have a Google Map Field in my form. I'm editing the theme of the form and I'm using a jquery but the map is broken.

The map is inside a div and the code of the template is this:

And here is the Jquery:

$("#show-block-3").click(function () {
         if ($('#hidden-block-3').is(":visible")) {
             $(this).html($(this).html().replace(/Hide/, 'Show'));
                var center = map.getCenter();
                google.maps.event.trigger(map, "resize");
                map.setCenter(center);

         } else {
              $('div#hidden-block-1').hide();
              $('div#hidden-block-2').hide();
              $('div#hidden-block-4').hide();
              $('div#hidden-block-5').hide();
              $('div#hidden-block-6').hide();
              $('div#hidden-location-block').hide();
         }
         // Do it afterwards as the operation is async
         $("#hidden-block-3").slideToggle("slow");

});(jQuery);

I just tried this:

var center = map.getCenter();
google.maps.event.trigger(map, "resize");
map.setCenter(center);

But the result is still the same. I don't know where else to put that code.

Am I missing something? Does anybody know how to fix this? I'm not using vertical tabs or any tabs that group field module has in the template and in the form. I would to stick with the custom code that I already have. Just need to fix the map.

Thank you!


texts: Referencing images in files directory from twig template

texts:
In a newly installed Drupal 9 site, I have images in the sites/default/files/ directory which I am trying to use in my custom theme.
In my theme, I'm implementing a custom entity-print--node--deal.html.twig template which is where I am attempting to output one of the images using the it's path as src in an img tag.
That template is for PDF version of my deal node type to give users a bespoke and nice printing experience including text and properly laid out images.
My issue is the  tag is broken on the PDF. I confirmed the uri of the taget is accurate.
In addition, I tested if images can actually display on my PDF by using the URI of an image on the internet. I created another image using the external uri as src and it displayed successfully on my PDF.
My template code is below:

        Lorem Ipsum is simply dummy text of the printing and typesetting industry.
        Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
        to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
        It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
        and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    {% set imgUrl = url('<front>')['#markup'] ~ 'sites/default/files/TwitterHeaderPhoto.png' %}

    Url check: {{ imgUrl }}

And here is an image showing the output including the problem:

I need help figuring this one out, please.


texts: Get a list of all the modules in code base

texts:
This is more of a developer question.

I need a list of all the modules that are present in my code base. I am not looking for enabled or install modules. I am just looking for all the modules(code) present in my code base.


texts: Flag state as contextual filter in views

texts:
Please help me and provide a little explanation about the following thing:

1) What I have:

a content type called "word"
a flag for this content type called "learned".
a view display with "word" nodes

2) What I want to achieve:

filter view results with "learned" flag state (to get only flagged, or not flagged, or all of them) for current user via contextual filter.

I've added a relationship on "Flags: Content flag" where i can limit results to those nodes, which are already flagged by current user. But honestly I don't understand how to connect this relationship with contextual filter to get a possilibily to receive different results basing on the flag state (flagged, unflagged, all).

Actually, I want to get the same result as if I use an exsposed filter on a Flag state. But I don't want to use an exposed filter as well as I'm using an ajax call to load this view display with predefined options.

Any help?


texts: Easiest way to post videos directly to S3?

texts: I am working on a video sharing site and I plan to use the Video module. Amazon S3 is also being used as the file system. The problem is how to override/extend it so the video file skips the intermediate step of uploading to the server and directly upload to S3 using a separate POST request?


texts: Add new menu item in drop down admin menu

texts: I have a node. I would like to create a link to the node in the administration menu. Adding an item in the administration menu is not working. Is this not possible? How can i do that?


texts:
I really don't know how to fix this so whats why im posting this over here.

Im using Profile2 for my profiles The Main profile is for authenicated users, lets can this User A.

I have also another profile type, with a seperate registration form, lets call this user B.

When user B wants to edit his profile, he can also choose to edit his main profile (profile for user A), i figured out that because user B is authenticaded he can automaticly edit his main profile, and his own profile (specially for user B's). How can i prevent user B for edit his main profile?


texts: How to add organisation to the Drupal.org user profile?

texts:
When posting on the drupal.org, I'd like to attribute the contribution, however when I'm selecting it, the label says:

  X at organization not applicable for customer not applicable

When clicked on not applicable link, I've got tooltip that I should add organization on my user profile. However I already did that (in Edit/Account/Work) and it's set as Current organization. What I'm doing wrong?


texts: How to register and create a node in the same form?

texts: I am trying to make a form that registers the user and creates a node at once. Is there a module for that? What is the best way to code that (if there is no module).


texts:
Our user entities have about 5 fields for the public profile, and 5 fields with settings that determine the content of 60 other fields we need for our implementation (I've thought of making this 60 "computed fields"). The last ones can be overridden by the user, so we need another 60 to store the user entered values (without loosing the defaults) and 30 fields to act as a flag that indicates if the default or custom version is used (30 flags are enough because the 60 fields go in pairs, they are 30 pairs).

Let's say that we attach the 150+ fields to user entities: Wouldn't that be too heavy, especially when viewing the user profile page (where all the other fields are not necessary)?

Should we define a custom field that would integrate a pair of the default values, a pair of the custom values, and the flag, so we would only need 30 of those within a user object? Apart from having to define the custom field, we lose the computed field module, I think.

Should we offload user entities by creating a content type to attach the total 60 + 60 +30 fields, and link the user with the content type using the Relation module?


texts: I'm creating a web site in Drupal 7, there are home page, and three main taxonomy pages(they are primary links), the client is asking, to tell the truth they are insisting on me to make custom admin pages for every primary pages, sounds like primitive but they want to control every part of the main pages manually. How can I handle this task? I've already created these pages with views. Has anybody faced before with this type of issue?


texts:
I wanted to create a site which should display an registration form in lightbox view. I tried to alter the page--front.tpl.php to get this effect but i didnt succed. The lightbox effect of the display should happen when ever the site is viewed.

jQuery(document).ready(function() {
  jQuery(".menu-item-694").triggerHandler("click");
});

can any one say how to get this effect with lightbox or whats wrong in my code displayed above.
Thanks in advance.


texts: how to import term by name in csv file in drupal 7?

texts: I need to import a CSV with 3-4 fields with taxonomy, but I need to insert taxonomy by name. Is it possible with the feeds module?


texts:
I have created a menu called "navbar". In this menu, there is 4 links at level 1. Each of these links has 3 sublinks (level 2). All links in the menu point to a different page.
For example, I have on lvl 1 "Projects" (that points to /projects). That parent links contains 3  lvl 2 subsections : "News" (projects/news), "Photos" (projects/photos) and "Maps" (projects/maps).
Then I create an article, I check the "Provide a menu link" and I select "News" in the dropdown list.
I have "menu block" installed, and I configured a "navbar" block to be bound to the "navbar" menu. I also installed "menu node" to have a table with the mapping between nodes and menus.
Now, how do I customize the menu to display all lvl 1 & 2 and all associated articles ? What function do I need to create and where ?
I have tried the following code to no avail (where business is my theme's name and 2 is the menu id) :

function business_menu_link__menu_block__menu_navbar($variables)
function business_menu_tree__menu_block__menu_navbar($variables)
function business_menu_link__menu_block__2($variables)
function business_menu_tree__menu_block__2($variables)

What should I do ?


texts: Is it possible to get oauth working in services-7.x-3.x?

texts:
Any quick pointers on getting oauth working in Drupal 7?

My need is to implement 2-legged oAuth in order to authenticate consumers to a service endpoint with (the equivalent of) an API key.

At http://drupal.org/node/1336974#comment-5305810 marcingy says he committed the patch in #18. There have been releases of 7.x-3.x-dev since that comment and I don't see that patch in the latest releases...but maybe it's been reworked. What's really strange to me is that the 7.x-3.x-dev version of services (services/auth/services_oauth/services_oauth.info) still depends on the defunct oauth_common.module. I figure that would have been removed since there was never a D7 release of oauth_common...?

The patch in #18 (http://drupal.org/node/1336974#comment-5283802) also doesn't seem to remove the oauth_common dependency. (I guess that patch was for D6.)

I'm gathering that the way to do oAuth on Drupal 7 is by using other modules aside from Services.

Thanks!


texts:
I need a stable Drupal module version like Pageflip. Can any one suggest the module which I am searching?

The existing Pageflip module is still a beta version; I need a module that has a stable release.


texts: How do I alter the form submission handler?

texts:
For some reason I need to replace some characters (if exist) in every single textfields in any form just right before they stored in database. In other words I need a hook in which I could get all submitted data and replace their characters.
I found this solution:

function hook_form_alter($form, $form_state, $form_id) {
  $form['#submit'] = 'my_custom_submission_function';
}

But this isn't a good idea since I have to take care of the rest of the submission progress too. I just need to replace some characters.
Is there any hook to do this? What are the solutions?


texts:
I want to show the D8-based blocks in the block.html.twig file with the  html tag only. However, when I entered this special split file, I created a special branch file for each block area (eg region - sagblok.html.twig), block title and content css, html codes. Unfortunately, the block titles did not appear. My code is below:

{{ title_prefix }}

{%if label %}

{{ label }}

{% endif %}
{{ title_suffix }}

{% block content }}

  {{ content }}

{% endblock %}

Editor screenshot

Sorry for my English.

I have debugged the theme, I am cleaning the cache with the "drush cr" command continually. I have copied the style files of the blocks to the folder of the theme I am developing "core / templates / stable / templates / block / block.html.twig".

The content of the "block.html.twig" file looks like this:

  {{ title_prefix }}
  {% if label %}

{{ label }}

  {% endif %}
  {{ title_suffix }}
  {% block content %}
    {{ content }}
  {% endblock %}

I changed the codes in this file like this:

  {% block content %}

    {{ content }}

  {% endblock %}

then I created a twig file called "region--sagblok.html.twig" belonging to the block region, codes:

{{ title_prefix }}
  {% if label %}

{{ label }}

  {% endif %}
  {{ title_suffix }}

  {% block content %}

    {{ content }}

  {% endblock %}

unfortunately block names do not appear in this way. but when I looked at the source code, I realized that the html codes came, but the block names did not.


texts: How to add selected users to OG Group from field selection when creating group

texts: I have an OG and a field that lists users with checkboxes. Is there a way using Rules, to add the selected users as group members when group is saved/updated?


texts: Check db_merge status whether inserted or updated

texts:
I am using db_merge() in my code, and I would like to print a status message with drupal_set_message() that reports if the record has been added or updated.

Is it possible?


texts:
Does hitting 'recreate' recreate the feature from the site's elements, or vice versa?

I tried hard looking to this in the documentation, but I couldn't find a clear explanation.


texts: How to get Address Field to display correctly with Autocomplete?

texts:
I want to create a postal field for addresses in the Philippines.

I have set up a sandbox site with a content type that has just one field, of type addressfield and using the autocomplete widget. Only one country is allowed.
However, when I create content, all I can see is the field for entering the address and the Google map, I cannot see the Address Field fields.
When I enter an address in the Philippines, it gets coded correctly by Google and displays properly on the map. However, if I then try to save the field, it tells me that obligatory fields ("Address 1" and "City" in this case) are missing.

If I click on "enter one manually", then nothing happens.

This is only accessible by a logged-in user, so I presume that caching is not the problem.

I have tried using FF45 and the lastest release of Chromium, all to no avail

I also presume that I must have made a mistake setting something up, but i cannot work out what that might be...


texts: how to attach existing images(image field) to node in drupal 7?

texts:
I use the following code to upload images

$node  = node_load($nid);
$file  = (object) array(
  'uid' => $v['uid'],//@todo from query
  'uri' => 'public://'.$v['filename'],//@todo from query
  'filemime' => $v['filemime'],//@todo from query
  'status'   => $v['status'],//@todo from query
  'fid' => $v['fid'],
  'filesize' => $v['filesize'],
  'timestamp' => $v['timestamp'],
  'type' =>'image',
  'metadata' => array('height' =>1200,'width'=>1099),
  'height' => 1200,
  'width'  => 1099,
);
$node->field_image[LANGUAGE_NONE][0] = (array) $file;
node_save($node);

This does not work, I am not able to figure out the error in the code which prevents from image upload


texts: Search API Autocomplete does not return any suggestions when input contains ąčęėįšųūž or similar characters

texts: I am using Drupal 7, Solr 4.x, search_api, search_api_autocomplete modules in project. We have a page, which contains fulltext search with autocomplete settings. Problem is - it does not return any kind of results, when these contain non utf characters, for example ąčęėįšųūž.


texts: Is there a way to filter blocks by vocabulary instead of NID or CT?

texts:
Each time I filter block visibility (that is: When the block will appear in it's region), I can do so only via Node ID or Content-Type...

You might have a ready-2-go way to do so with a vocabulary term ? Here is a pseudocode of my meaning:

if (isset >=1 vocabulary->term) {isset block}

Sorry if it's a bit wired, I am just starting to learn PHP and my meaning is "if at least one term of a given vocabulary is in the node, show the block in whatever region".


texts: How to change the teaser for the front page articles

texts:
In my site : http://www.indiacustomercare.com  front page(which is not displaying correctly) I want to show 200 words in teaser for each article.
I've changed it in Post Settings but does not work.

What could be the reason?


texts: Do not show errors including database error to users in D7

texts:
I have disabled displaying errors to the user in my D7 website. See below the screenshot of the configuration-

However, I (without admin login) still see a database related error such as following-

How do I disable the above error display to a normal user (but making sure admin can see)? It would be better if these errors can be logged but not displayed to a normal user. By saying a normal user, I am referring to all non-logged users.


texts: Clearing cache failed to add the new CSS properties

texts:
For Drupal 7, I'm using

Cache pages for anonymous users
Compress cached pages.
Aggregate and compress CSS files.
Aggregate JavaScript files.

The problem is when I update the CSS code for one of my CSS file, the code doesn't show in my page.

I have tried to Clear all cache and even run cron, but the new CSS code doesn't get added to the cached and minified version of my CSS.

The only workaround is just to disable "Aggregate and compress CSS files."

Any thought on this will be helpful.


texts: Body field of some nodes not displayed in teaser view

texts: Some of my nodes have an empty teaser field so when I visit a taxonomy page, you cannot see any of the body content. Only when you click on the node title to view the full node can you see the body. Why does this happen? I fix this by manually editing my database and adding content to the teaser field of the node_revisions table but it's troublesome to fix nodes this way.


texts: Convert former embedded PHP code into a custom block module?

texts:
Had a Drupal site that used the php filter module. After realizing the security risk I started the process of fixing things up.

Currently the last piece of code is a php snippet I embedded into a view to display the input fields of a content type (called post).

<?php
  module_load_include('inc', 'node', 'node.pages');
  $node_form = node_add('post');
  print drupal_render($node_form);
  $form['buttons']['submit']['#value'] = t('Save and add new');
?>

This is a view block embedded within a panel. Not 100% sure how to take this and make it a custom module that I suppose cloud be a block for me to embed on the panel page.

Update:
Attempted to make the module using hook_block_configure() but when enabled it is not showing up as a block option for me to embed.

<?php

/**
 * Implements hook_block_configure().
 */

function hook_block_configure($delta = '') {

  module_load_include('inc', 'node', 'node.pages');
  $node_form = node_add('post');
  print drupal_render($node_form);
  $form['buttons']['submit']['#value'] = t('Save and add new');

}

Is the correct command being used?


texts:
I have created a custom module that can add an entry into my own created tables. However, I need to display the contents of that table into the admin, a table like view. Like this one in the picture:

Can you point me to the correct documentation or what is this called?

Thanks.


texts: How do I redirect a form after has been submitted?

texts:
I need to upgrade this Drupal 6 code to Drupal 7.

I add a form submission handler to a form, using an implementation of hook_form_alter() that executes the following code.

array_unshift($form['buttons']['submit']['#submit'], 'MODULE_case_form_pre_submit');
$form['buttons']['submit']['#submit'][] = 'MODULE_case_form_submit';

The code for MODULE_case_form_submit() is the following.

function MODULE_case_form_submit($form, &$form_state) {
  if ($form_state['values']['type'] == 'case_slide') {
    $form_state['redirect'] = 'case/' . $form_state['values']['cid'];
    return;
  }
}


texts: Finding all Basic Pages not referenced by a main-menu entry

texts:
I am trying to produce a list of all published English or no-language Basic Pages on my Drupal 7 website that are not in the main menu hierarchy.

Initially, I tried the technique in Finding all nodes not referenced by a menu entry or another node only to find that the suggested SQL command does not match the current Drupal 7 database structure for menus.

After downloading the Data Dictionary and some trial and error, I came up with the following drush command (with the environment replaced by [redacted]):

drush @[redacted] sqlq "SELECT nid, title FROM node WHERE node.type = 'page' AND node.status = 1 AND (node.language = 'und' OR node.language = 'en') AND CONCAT_WS('node/', CAST(node.nid AS CHAR(6))) NOT IN (SELECT link_path FROM menu_links WHERE menu_links.menu_name = 'main-menu') ORDER BY nid"

Unfortunately, this command is returning all published English or no-language Basic Pages on my Drupal 7 website, not just those which are not in the main menu.

After testing some variations, I suspect that "CONCAT_WS('node/', CAST(node.nid AS CHAR(6)))" is the problem but have no idea how to fix it. Replacing CONCAT_WS with CONCAT does not help.

All Basic Pages on this website have 5 or 6 digits in their node ID. It is okay if I have to use a different statement to get all 5-digit node IDs and all 6-digit node IDs.


texts: How to add custom user fields to their comments?

texts:
My users have the following fields: 'Avatar' (image) and 'Year' (number). When a user leaves a comment, I'd like to display these fields, the username and the user's current userpoints next to each other on top of the comment. The end result should look something like this:

The fields shouldn't be updated: when they change in the future, they should maintain the value they had at the moment the comment was posted.
How can I achieve this?


texts: Live filtering of nodes by taxonomy terms?

texts:
As part of a company website redesign, the designer I've partnered up with has come up with an interesting way of displaying projects and people using taxonomy. We're just trying to figure out how to implement it in Drupal 7:

We have project, and people, and a vocabulary describing specific skills and topics that are common to both.  Each project and person has an associated node containing the relevant terms.

What we would like to have is a master display for each type: people and projects.  Each master display will show all the terms in the vocabulary (this vocabulary will be kept very small), and all projects/people.  However, when a user clicks on one of the terms, the display of relevant nodes will be filtered to show only the nodes containing that term.

We already have the code to handle the live filtering - if these were static HTML pages it would be simple.  But considering that we are using Drupal for the site, it seems rather silly not to take advantage of having a database to query.

I've spent the last few hours scouring the web for anything that will let me accomplish this.  Ideally I need something that will identify/expose the terms associated with the nodes...  It seems Views is the likely answer, but I can't seem to place both the terms and the content type lists in the same view.  This page from a related question here seems to come close, but I am not currently using Panels and I'm still new enough to Drupal that I have no idea how to use the hook referenced.

Hopefully I've explained this clearly enough, but let me know if I haven't. Thanks in advance!


texts:
I have used a content pane in a panel to add a description on top of it. It was a success but I can't find a way to remove the pane title in the view. The screenshots are below:

I have also set the content pane title to none

There is no option in the panel for title.

So how can I remove it?


texts: Trouble passing PHP variables to JS using "attach"

texts:
Module-noob here. I've seen plenty of threads on this topic in general but haven't found any concerning use of "attach." I'm working on a fairly simple module that applies some JavaScript to every page on the site. It was working fine, but pareview told me not to use drupal_add_js() in hook_page_build(), instructing me to use attach instead. I can't figure out how to get my PHP variables over to my JS using this method.

The JS file itself is loading, but it is not receiving the data from the PHP variables. From what I have read, I understand that the following is the way to accomplish what I am trying to do, but obviously I've got something wrong somewhere. Here is my code:

mymodule.module:

function mymodule_page_build() {

  $page['#attached']['js'] = array(
    array(
      'data' => drupal_get_path('module', 'mymodule') . '/mymodule.js',
      'options' => array(
        'preprocess' => TRUE,
        'every_page' => TRUE,
      ),
    ),
    array(
      'data' => array(
        'mymodule_status' => variable_get('mymodule_status', 0),
      ),' => 'setting',
    ),
  );
}

mymodule.js:

(function ($) {
  "use strict";
  Drupal.behaviors.myModule = {
    attach: function (context, settings) {
      var moduleStatus = Drupal.settings.mymodule.mymodule_status;
      var milk = 'milk';
      $(document).ready(function () {
        // Debug:
        console.log('first');      // works
        console.log(milk);         // works
        console.log(moduleStatus); // Says mymodule is undefined
    }
  };
})(jQuery);

Thank you for any help you can offer.


texts:
I've run into an issue when designing my forum in Drupal 7.
I'm using the Forum core module and multiple taxonomy lists. Each of those taxonomy lists has its use in different subforums. However, my current configuration shows all of the drop down lists in all of my subforums.

So my question is how can I prevent that some taxonomy lists are showing on certain subforums? Would this need another module or should I make a new content type for each subforum?


texts: Node template suggestion stopped to work for new content types

texts:
I experience the simmilar issue as asked here

I already have several template suggestions that are working properly following structure:

node--type.tpl.php

But for newly added content types, it does not work, whatever i do. I cleared cache, recreated content type, checked spelling.

How can i track in devel or in other way what is source of this error ?


texts: Enforce URL rules when posting content types

texts:
so I created a content type "Regions" - This includes the 13 provinces in Canada listed as individual terms.

When creating a new post with the content type "Regions", you have to choose which term to post into. Let's say I would like to post a page "TEST POST ONTARIO", I post it in the term "Ontario"

I would like the URL from this post to be automatically changed to
www.website.com/region/on/testpost
by default, it posts to www.website.com/testpost

Is there a way to automate the url for when this content type is created? or would you have to manually change the url alias every post?


texts: Is there any way to view dpm() data other than printing it on page?

texts:
I have an issue with dpm() in that it never seems to return data (and before anyone asks:

Yes devel is installed
Yes I am logged in as admin
Yes print $messages is set
Yes the permissions are correctly set
No the data set is not empty ( dpm($node) and dpm($content) return an empty field)
Yes it did work previously / on ocassion

it does return a message field, but it is just empty).

Is there any other way to view dpm() data, like using Drush or something? I know I should really 'fix the dpm issue' but I have asked around and there does not seem to be an answer.


texts: Draggable table with the parent-child relationship

texts:
I have a draggable table with a parent-child relationship, where the children can be moved between parents, but cannot be moved onto the parent position. So in sum, the child can change the parent, but cannot become a parent.

Parent 1
  - child x
  - child y
Parent 2
  - child z

According to drupal_add_tabledrag() I added the following classes:

All the parents have a tabledrag-root class, so they cannot be nested under a parent row.
All the children have a tabledrag-leaf class, so they cannot have any child rows.

The problem is that, it doesn't work if the child is the last one or the only one, so both child y and child z can be dragged onto parent position.

How to prevent all the child items from being moved onto the parent position?


texts: Different home pages based on different conditions?

texts:
I have two pages:

/home
/pr

Currently, under site configuration, I have /home as the home page. So whenever someone open mysite1.com, it will show the contents at /home. However, multiple domains are parked on this site. I want it in the case of mysite2.com is opened, the /pr page must show, but if mysite1.com is opened, it must show /home like it always does.

At what point would I be able to do this? Where  can I incorporate this logic?


texts:
I am searching for a way to restrict the access on the activity page. It should be only possible to access it as administrator.

I found an open issue for it: https://www.drupal.org/node/2777445

Is there no way to restrict the access?


texts: Is it possible to patch a non-dev version of a module?

texts: I can create patches from dev copies of modules just fine thanks to this documentation, but when I try to create a patch from a non-dev version I get troubles. If possible, How do I do this?


texts:
I have the coupon pane, the order review and the payment info panes all on the same checkout page. When I add a coupon, an ajax callback is fired and the order summary is automatically updated to reflect the coupon, but the payment info pane is not updated.

I have a rule for two payment methods. One for non-zero order totals, and one for zero total orders. If I add a coupon that brings the total to zero, and then refresh the whole page, the rule action does apply and enab;es my 'free' payment method. However, it only works with a full refresh.

Is there a way to get the payment info pane to refresh during the coupon add ajax callback?

Otherwise, my customers see a zero total and they still see the payment info that requires them to put in a credit card to finish the order.


texts: How can I point to a site in a not common directory path?

texts:
Normally when adding a new Drupal site I just put the sites root folder in /var/www/ and then edit the hosts file for that address and then edit the httpd.conf file to point to that site.

The situation here is the Drupal site I am working on came from a git repo where other people work on it as well. The site came like this - /sitename/web/sites/default so when I put that in my /var/www directory it isn't the same as a usual setup which is - /sitename/sites/default, multipleSite1, multipleSite2, ...

So the /web directory is throwing things off I think. It messes with the simple way I point to a site with http.d conf and the way Drupal looks inside that directory for the settings.php file.

Simple example of httpd.conf that normally works fine

<VirtualHost *:80>
     DocumentRoot /var/www/testsite
     ServerName testsite
</VirtualHost>

Any ideas? I'm sure it's a real simple solution.

-apache2 on ubuntu10.04


texts: Possible to build Relation Type between two specific Content Types?

texts:
I have created Content Types: Person, Story, Company, Series, Article, Basic Page, plus other content types in the Node bundle.

I want the Relation Type between Person and Story only (i.e. "is author of", "authored by") but all online instructions I read say that the Relation Type should be between bundles. However, that scope is too wide.

The display page shows
Entity Collector
Relation Type "is author of"
Select an entity "" (is null)


texts: Create a node programatically and set its CCK field values

texts:
I've tried the technique described here:
http://lucasforge.2bopen.org/2010/06/drupal-6-create-a-node-with-cck-fields-programmatically/

and here:
http://drupal.org/node/1111514

Neither seem to work. The node gets created, but the CCK field I'm trying to set never gets set.

Both those just describe using "field_name[0]['value'] = 'something'" but even if I set the field value through the web form and DSM the result it never has 'value' set, just '#default_value'.

I tried setting "field_name[0]['#default_value'][0]['nid'] = 'mynodeid'" but that didn't work either.

This is the structure of the CCK field I'm trying to set:

field_application_discipline_id (Array, 13 elements)

#type (String, 20 characters ) nodereference_select
#default_value (Array, 1 element)
#required (String, 1 characters ) 0
#columns (Array, 1 element)
#title (String, 13 characters ) Discipline ID
#description (String, 0 characters )
#delta (Integer) 0
#field_name (String, 31 characters ) field_application_discipline_id
#type_name (String, 11 characters ) application
#tree (Boolean) TRUE
#weight (String, 2 characters ) 31
#access (Boolean) TRUE
#count (Integer) 9

Any idea why this wouldn't be working?


texts: Configuring drupal in a virtual directory

texts:
I am running drupal using apache on redhat linux.  Currently drupal is running at the root of the apache site.  However, I want to put drupal in a sub-directory/virtual folder, because it's possible other sites will be on this server in the future.

The sub-folder I want to use is /fr.  I can easily setup apache to use this alias, but how do I configure drupal to know that it's running in a subfolder? I currently have URLs like /agent/dashboard.  If I configure apache for the /fr subfolder, drupal loads but it doesn't recognize /fr/agent/dashboard.

Do I just make a subfolder in the drupal install folder?  I'm not too familiar with apache so I really don't know.  Do I have to redefine all my routes (i'm using Drupal 8).  I really hope not.  I'm looking just for a setting in drupal or apache where I can set this.


texts:
In D8 I created a custom input twig file (based on input.html.twig) :

{{ icon }}

<input{{ attributes }} />{{ children }}

Then I created a new entry in hook_theme() :

function my_module_theme() {
 return [
   'input_custom' => [
     'render element' => 'form',
     'variables' => [
       'icon' => NULL,
     ],
     'template' => 'input-custom',
   ],
 ];
}

Then I'm loaded the template in my form element :

$form['my_field'] = [
        '#type' => 'textfield',
        '#theme' => 'input_custom',
        '#icon' => 'my_icon',
        '#title' => $this->t('My title'),
      ];

My custom variable is sent to the template but I lost all html attributes on the input. If I remove variables from my_module_theme() all html attributes are back, but I'm losing my custom variable.

How can I send custom variables in custom input template ?


texts: How do I get the modified field value of a VIEW

texts:
I have a VIEW which pulls on the content field of a type. I specified I want the rewrite rules to trim to 25 characters with an ellipsis.

Unfortunately I also override the template (views-view-unformatted--XXX.tpl.php) and when I echo out the structure of the entire node and entity in template.php I see nothing of a modified field -- only the full data.

How do I adhere to the requirements of the field set in the VIEW?


texts: Form with throbber not responding to validate or submit methods

texts:
I have the following form built with Form API. Its method is GET. I try to validate or submit, but it does not work. I have checked the method names, etc., and are correct, in fact I see an "attempt" of validation in some cases. I guess that there is something weird for the way I use the select autofilling field. It is a "car models" select whose values are filled by selection of "car brand" select, and I think that the code somehow interferes with the normal use of Form API.

function mymodule_search_form(){
    $brands = get_brands();
    $brand = get_default_brand();

    $form['product'] = array(
      '#type' => 'textfield',
      '#title' => t('Product'),
      '#autocomplete_path' => 'product-busq/productos/all',
      '#attributes' => array("placeholder" => t('Product'), ) // 'class' => array('auto_submit')
     );

     $form['brand'] = array(
       '#type' => 'select',
       '#title' => t('Brand'),
       '#options' => $brands,
       '#default_value' => $brand,
       '#ajax' => array(
           'callback' => 'mymodule_models_update',
           'wrapper' => 'models_wrapper',
           'progress' => array(
           'message' => '',
           'type' => 'throbber',
          ),
         ),
        );

    $form['model'] = array(

      '#type' => "select",
      '#title' => t('Model'),
      '#required' => FALSE,
      '#multiple' => YES,
      '#attributes' => array("placeholder" => t('Model'), ), // 'class' => array('auto_submit')

       '#prefix' => '
',
       '#suffix' => '
',
       '#disabled' => TRUE,
      );

  $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Submit'),
      '#name' => ""
 );

   $form["#action"] = $base_url . "/" . $language->language . "/" .   drupal_get_path_alias("node/3");
  $form["#method"] = "get";

  return $form;
} // function

And now the autofilling function which may be causing the problems, especially the last sentence. The code is copied from a tutorial somewhere:

function mymodule_models_update($form, &$form_state) {
   unset($form_state['input']['model'], $form_state['values']['model']);
   $brand = $form_state['values']['brand'];
   $brand_desc = "";
   $results = db_query("SELECT description FROM {taxonomy_term_data} tax WHERE tax.tid = :tid", array(":tid" => $brand));
    foreach($results as $row) $brand_desc = $row->description;

    if($brand_desc != "") $form['model']['#options'] =      _hook_list_models($brand_desc);
    unset($form['model']["#attributes"]['disabled']);
   $form['model']['#disabled'] = FALSE;
   $form["model"]["#attributes"]["id"] = "edit-model";
   return form_builder($form['#id'], $form['model'], $form_state);
 } // function


texts:
Is there a possible hook or something else that can be written to display all the current active facet link i.e the selected facet. i want to display to the user in breadcrumb format  all the facet they have selected and give them the option to remove it
thanks


texts: Where In or clause for when a variable might not exist

texts:
If I were to run a normal mySQL query that selects all nodes I would do this:

set @type='node';
select * from actions where type = @type;

but what if lets say I set type to be something that doesn't exist for example

set @type='';
select * from actions where type = @type or 1=1;

This will then in return select everything regardless.

How do I do the same with db_query?

I thought just doing

db_query("select * from actions where type = :type or 1=1;", array(':type' => '')).fetchAll();

but that doesn't work. Any ideas? (notice that :type is equal to '' just like in the mySQL example)


texts: Lack of permissions on sites/default/files

texts:
I currently manage a Drupal install on a shared university computer (i.e. I don't have root access to the box), but the sites/default/files directory was created with all permissions and ownership set to a unknown user (as is shown below), therefore I have absolutely no way to delete or change anything in this folder without using the Drupal interface or contacting the sysadmin.

I believe the owner of these files is the webserver's user (which is on another box). Is there any way to change the uploaded files permissions/owner within Drupal (or at least delete/chown this folder)?

myself@sparta:~/public_html/drupal/sites/default/files$ ls -la
total 252
drwxrwxr-x 4     48        48   4096 Set  3 11:43 .
dr-xr-xr-x 3 myself  students   4096 Set  2 12:07 ..
-rw-r--r-- 1     48        48 227057 Set  3 11:43 Estatuto.pdf
-rw-rw-r-- 1     48        48     93 Set  2 12:30 .htaccess
drwxr-xr-x 2     48        48   4096 Set  3 11:25 imagefield_thumbs
drwxrwxr-x 2     48        48   4096 Set  3 10:47 languages
-rw-rw-r-- 1     48        48   2666 Set  3 11:25 posse.jpg

Thanks!


texts:
I have created an admin-only view on a certain content type where we want to review the body content all in one place. The problem is that the input format for these nodes does some additional glossary markup etc. and we want to see the raw body content.

Is there a way to disable or change the input format for this view without changing it for each node?


texts:
I am using GMap Module (in Drupal 7). Map does not show on page load, but when I inspect the web page, map shows up.
I tried reinstalling module but in vain.
Map shows in GMap Configuration, but on node page it shows only if user inspects page. I have made no change in default GMap code
If anyone has solution to this issue, please share
A bundle of Thanks.


texts: Building custom entities, but using existing modules?

texts:
I've noticed a lot of useful modules already created such as workflow, ACL, diff, and more. But these only seem to work with "content types". In our project, we have decided that "content types" aren't really well suited for what we need (Entities make more since). Very complex relationships must be modeled. Our entities are just that, entities, not content.

The problem is that when building an entity using hook_schema() and hook_entity_info(), these entities are not available to be used with different modules such as workflow. Is there any way to make them available? Or will we have to code similar workflow functionality by hand?

Workflow does exactly what we need, except only on content types. We need it to work on entities as well.


texts:
How do I change the JOIN type in a SQL query that Views creates?

For example, in this code

<?php
function eb_mine_views_query_alter(&$view, &$query) {
  if ($view->name == 'statuser') {
    dsm($query, 'before');
    $query->where[0]['type'] = 'OR';
    dsm($query, 'after');
  }
}
?>

Will change

SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created
FROM
{node} node
INNER JOIN {taxonomy_index} taxonomy_index_value_0 ON node.nid = taxonomy_index_value_0.nid AND taxonomy_index_value_0.tid = :views_join_condition_0
INNER JOIN {taxonomy_index} taxonomy_index_value_1 ON node.nid = taxonomy_index_value_1.nid AND taxonomy_index_value_1.tid = :views_join_condition_1
WHERE ((( (taxonomy_index_value_0.tid = :db_condition_placeholder_2) )**AND**( (taxonomy_index_value_1.tid = :db_condition_placeholder_3) )))
ORDER BY node_created DESC

to

SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created
FROM node node
OUTER JOIN taxonomy_index taxonomy_index_value_0 ON node.nid = taxonomy_index_value_0.nid AND taxonomy_index_value_0.tid = '9'
OUTER JOIN taxonomy_index taxonomy_index_value_1 ON node.nid = taxonomy_index_value_1.nid AND taxonomy_index_value_1.tid = '6'
WHERE ((( (taxonomy_index_value_0.tid = '9') )OR( (taxonomy_index_value_1.tid = '6') )))
ORDER BY node_created DESC LIMIT 5 OFFSET 0;

As you can see the query changed from AND to OR through the use of OUTER JOINs.

Now I want to change the same code like this:

SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created
FROM node node
LEFT OUTER JOIN taxonomy_index taxonomy_index_value_0 ON node.nid = taxonomy_index_value_0.nid AND taxonomy_index_value_0.tid = '9'
LEFT OUTER JOIN taxonomy_index taxonomy_index_value_1 ON node.nid = taxonomy_index_value_1.nid AND taxonomy_index_value_1.tid = '6'
WHERE ((( (taxonomy_index_value_0.tid = '9') )OR( (taxonomy_index_value_1.tid = '6') )))
ORDER BY node_created DESC LIMIT 5 OFFSET 0;

rather than using OUTER JOIN I want to use LEFT OUTER JOIN.

So how do I do this in my hook?


texts: creating multi-country website, where each country's site is multilingual

texts:
I understand that you can create translations in many language for one website.
But what if I want to create one website not just simply to be multilingual but for multi-countries and each country's website can be bilingual or trilingual.

For example, let's I have website example.com and its default country is USA.
It will have 2 languages: English and Spanish
When I click any of them it will take me to the corresponding page:

For English version: example.com/us/en/
For Spanish version: example.com/us/es

On the top menu I will have a menu called "Countries".
When I click on "Countries", it can be take me to a "Countries" page that will show all the countries and languages they have, for example:

United States - English - Español
Japan - English - 日本語

Or "Countries" can be a drop-down list showing above.

Can someone please share with ideas to implement this?

UPDATE 1

I feel like this is related to MultiSite feature, but was not able to see any good working example on the web.


texts: If not hook_init(), what can be used for cached pages?

texts:
I created a module to keep query_string laden links from a client site active (per client's request, background question here).

This code works wonderfully when I'm logged in (as user 1); however, I have later found that hook_init() does not run on cached pages.

Should I place this logic into another hook? Should I take a different approach to intercepting and mapping these legacy links?

<?php
/**
 * Extends hook_init()
 *
 * Intercepts vidID or PID and forwards to the page's proper Drupal node.
 *
 */

function module_init() {

    if (!menu_get_item($_GET['q'])) {

        $pid    = isset($_GET['PID']) ? $_GET['PID'] : FALSE;
        $vidID  = isset($_GET['vidID']) ? $_GET['vidID'] : FALSE;

        if ($pid) {
            // handler code
        }
        elseif ($vidID) {
            // handler code
        }
    }
}


texts:
I have a paragraph which can either contain an image or a video. When I let the output just come out in {{item.content}} the actual youtube iframe is output. However when I start parsing things to detect if a video or image is there I seem to lose this functionality.

I can still manually grab the URL output. However, Drupal seems to have some inbuilt features that I'd like to preserve. For example, the Youtube link ends with watch? which Drupal knows to convert to embed?, otherwise Youtube will refuse the iframe connection.

This is what I'm currently doing.

{% for item in items %}

{{ item.content['#paragraph'].field_content_2_headline.value }}

{{ item.content['#paragraph'].field_content_2_content.value|raw }}

        {% if item.content['#paragraph'].field_content_2_media.0.entity.field_media_oembed_video is not empty%}
            {{  item.content['#paragraph'].field_content_2_media.0.entity.field_media_oembed_video.value }}
        {% else %}
            {% for list in item.content['#paragraph'].field_content_2_media.0.entity.field_media_image_1 %}

            {% endfor %}
        {% endif %}

{% endfor %}

If I just output item.content['#paragraph'].field_content_2_media when there's a video detected, I get an error that I'm trying to print a field list item.

Is there a way to reference the iframe functionality that Drupal seems to have?


texts: How to store data in multiple "field collection table" fields

texts:
I'm having problem while storing data in multiple field collection table fields, Here I have tried following JSON format of drupal 7 services.

"field_grp_travel_time": {"und":[ {"value":"1.5"}, {"value":"2"}, "value":"1"} ] }, "field_grp_contact": {"und":[ "50","10","2" ] } }

by using this json node is created successfully but collection fields are empty. Is there any problem in json or missing something?

Here, Group1 is "field collection" and "Contact","Travel time" is sub fields.

( Note : I have set "Number of values" : "Unlimited" for "Group1" )


texts: Drush contrib modules not available if executed externally

texts:
Using Drush 5.8 contrib modules are not available if executed externally.

E.g. Drush Entity is not available if executed on a Django view via a check_output:

check_output("drush -l example.com -r /var/www/my/example/site/ entity-read node", shell=True)

Any command regarding Drush Entity return an error specifying that the command "could not be found.  Run drush cache-clear drush to clear the commandfile cache if you have installed new extensions."

The same command is available if executed via an interactive python shell or via ssh.

I've installed Drush Entity in this way:

drush dl drush_entity

This command on my system put drush_entity into /home/admin/.drush directory. This directory seems to be ignored, since site-alias too are ignored if i put them inside that directory.


texts:
I need to set an item in the main menu as active even though I'm using separate sub menu blocks. What is the best way to do this? Due to particular styling I cannot just put them under the Category headings (like breadcrumbs).

The problem I came across is that the main menu item isn't active, as it doesn't know that the user is in the sub category of it as there is no link back. I can't find a way to set a particular main menu link as class active.


texts: Change default Taxonomy value on form via form alter in D7

texts:
I am trying to alter a form with a taxonomy term select drop down field; I want to change the default term selected when the form loads.  I'm altering the form array via hook_form_alter; however, my changes do not seem to be taking effect.  I'm looking for an answer similar to this but for Drupal 7.

I'm expecting :

        $form['field_mytax_reference']['#default_value'] = array($taxTermId => $taxTermName);

to do the job but the form remains with the default specified when the field was created.

Thanks in advance.


texts: Why would my hosting account user name show up in page not found errors in my logs?

texts: I'm running a Drupal 6 site and recently I've started seeing "Page not found" errors which contain the user name on my hosting server. For example "~username/blog/the-blog-post-title". I use Pathauto to auto-generate path aliases for new content. I've never really seen any problems like this before. I'm also seeing Page not found errors like "user/https://domainname.com/user". When I look at the log entry for these it usually says the path is "http://domainname.com/user/https://domainname.com/user". This is obviously a bad path! I recently enabled Secure Pages and I'm wondering if maybe this might have caused the issue. Does anyone have advice on what might be causing this or how to track it down? Unfortunately there's no referrer listed for these errors so it's tough to know where to look. Could it be something cached incorrectly?


texts:
I have successfuly followed the instructions on the Drupal page for updating uft8mb4 except for 1 table which is pulling up the below errror:

https://www.drupal.org/node/2754539

Error
SQL query:

ALTER TABLE `file_managed` CONVERT TO CHARACTER SET utf8mb4 COLLATE
utf8mb4_general_ci
MySQL said: Documentation

#1062 - Duplicate entry 'public://listings/4232.jpg' for key 'uri'

What do I do to be able to complete the updating?


texts: How to use a separate file for IE responsive.css for version 10/11 in Drupal

texts:
I am setting responsive design for only IE (Internet Explorer) in Drupal 7.
here is my code its for work lower then IE 10 not for IE 10/11

function bootstrap_preprocess_html(&$variables){
  drupal_add_css(path_to_theme() . '/css/ie_10.css',
    array('group' => CSS_THEME,
        'browsers' => array('IE' => 'lte IE 10',
            '!IE' => FALSE),
                 'preprocess' => FALSE)
);
}


texts: Getting menu links: correct chain of API functions

texts:
In my module, I need to create sort of a menu block consisting of certain menu items collected from various menus, and flattened into one level.

I'm not sure about the correct chain of the Menu API functions to call. My first attempt was as follows:

function _MYMODULE_block_view(){
  $html = '';

  $menu_link = menu_link_get_preferred('node/287');
  $html .= theme('menu_link', $menu_link);
  dpm($menu_link);
  return $html;
}

but it raises an error about several #attributes missing, so I guess this is not the right kind of object to get markup from. The API docs don't really help in understanding what kind of objects/parameters are returned/expected by functions, hence the question.

Edit:

Having given what Drupal complained about, the code now is as follows:

function _MYMODULE_block_view(){
  global $language;
  $langcode = $language->language;

  $html = '';

  $paths = array(
    'node/287',
    'node/3',
  );

  foreach($paths as $path){
    $translations = i18n_get_path_translations($path);
    if(!empty($translations[$langcode])){
      $i18n_path = $translations[$langcode]['href'];

      $menu_link = menu_link_get_preferred($i18n_path);
      $link = array(
        '#theme' => 'link',
        '#text' => $menu_link['link_title'],
        '#path' => $path,
        '#options' => array('attributes' => array('title' => $menu_link['link_title'])),
        '#below' => NULL,
        '#title' => $menu_link['link_title'],
        '#href' => $path,
        '#attributes' => array(),
        '#localized_options' => array(),
        '#prefix' => '
',
        '#suffix' => '
'
      );
      $html .= theme('menu_link', array('element' => $link));
    }
  }

  return "
$html
";
}

It does not spit out errors but... should I really trust it?


texts: Drupal 7 commerce meta tags not updating

texts:
I am working with commerce module in drupal 7.

I have installed metatag module. It working as expected for drupal default entities like node, taxonomy etc.

But when I try to add meta tags for commerce products, it fails to save the meta tags alone.

Do I need to do any additional settings?

Also my site is built with multilingual properties.


texts: How do I disable digest subscription notices for all users?

texts: I expect to do this in the database rather than through the UI. I thought I'd done it already, but it seems they are still going out. Any help would be much appreciated.


texts:
I created custom slider block with nivo slider

here is my code :

   <?php
function slider_init() {
    drupal_add_js(drupal_get_path('module', 'slider') . '/js/jquery.nivo.slider.js');
}
function slider_theme($existing, $type, $theme, $path) {
    return array(
        'slider_custom' => array(
            'variables' => array(
                'node1' => NULL,
                'node2' => NULL,
                'node3' => NULL,
            ),
            'template' => 'slider-custom',
        )
    );
}
function slider_block_info() {
    $blocks['slider'] = array(
        'info' => t('Slider'),
        'cache' => DRUPAL_NO_CACHE,
    );

    $blocks['acc'] = array(
        'info' => t('acc'),
        'cache' => DRUPAL_NO_CACHE,    );

    return $blocks;
}
function slider_block_content(){
    drupal_add_css(drupal_get_path('module','slider') . '/css/style.css');
    return theme('slider_custom');
}
function slider_block_view($delta = '') {
    $block = array();
    switch ($delta):
        case 'slider':
            $block['subject'] = 'custom nivo slider';
            $block['content'] = array(
                '#markup' => slider_block_content(),
                '#attached' => array(
                    'css' => array(
                        drupal_get_path('module', 'slider') . '/css/slider.css',
                    ),
                    'js' => array(
                        drupal_get_path('module', 'slider') . '/js/slider.js',
                    ),
                ),
            );
            break;

        case 'acc':
            $block['subject'] = 'custoghhghm';
            $block['content'] = 'adhgjgjghsad';
            break;
    endswitch;
    return $block;
}

i created .tpl :

dev7studios

        <img src="<?php print drupal_get_path('module', 'slider').'/images/toystory.jpg'; ?>" alt="toystory" width="105" height="105" class="myLink" />
        <img src="<?php print drupal_get_path('module', 'slider').'/images/up.jpg'; ?>" alt="up" width="105" height="105" class="myLink" />

        <img src="<?php print drupal_get_path('module', 'slider').'/images/walle.jpg'; ?>" alt="wallE" width="105" height="105" class="myLink" />

        <img src="<?php print drupal_get_path('module', 'slider').'/images/nemo.jpg'; ?>" alt="Nemo" width="105" height="105" class="myLink" />

        This is an example of a HTML caption with a link.

and js file :

(function ($) {
$(window).load(function() {
    $('#slider').nivoSlider();
});})(jQuery);

but the slideshow doesn't play

any idea ?


texts: The question is pretty straightforward. How can I add a class on field A, if field B is empty? I can not find any module does this feature. The Conditional Fields does not have the class feature too. Can this done by programmatically? If so, how?


texts:
What I want to do is be able to tell what the parent of a submodule is on the admin/modules page. There is little to no indication of what it belongs to sometimes.

Example, under the Administration group, I have a module called "Actions permissions." I have no idea what this module is for, the purpose of the module, why I would want it, or what it belongs to. It's just out there. I know it's a child of something else, but there is no indication of that anywhere. I could go on the server and grep it but I think it might be helpful to people to have a way to determine the parent.

So is there a module that:

A) will group submodules in a hierarchy-type view under their parents? Or
B) a module that simply lists what the parent is on the module item itself like we do with Requires:


texts: How to automatically populate /node/add/ form fields via simple logic?

texts:
I have created a content type and the form looks like this:

Home team: Reds
Away team: Blues
Batted first: Reds
Batted second:
Fielded first:
Fielded second:

If Reds batted first, I know the Blues batted second, fielded first and that the Reds fielded second. How can I get Drupal (7) to populate these fields automatically via some simple logic?

I'm thinking the Computed Field module, but the values are not in the database yet: the form hasn't been submitted. So, I'm not sure I can access the Batted first value. Perhaps only via the &$form_state array? - but can the Computed Field module access this array?

Anyway, how can I acheive this? Any suggestions are welcome. Thanks.


texts: How to use official documentation to figure out what namespace to use

texts:
I'm attempting to create a taxonomy term inside a Form plugin like so

$term = Term::create([
    'name' => 'my taxonomy term',
    'vid'  => 'vocabulary_to_put_it_in',
]);
$term->save();

When I do so I receive an error

  Fatal error: Class 'Drupal\my_module\Form\Term' not found

My gut is telling me that I'm not including the namespace like I should but I'm not sure how to actually figure out how to discover that. I'm creating nodes by using

\Drupal\node\Entity\Node::create

And I receive no errors for that. I'm assuming that it's because I'm using \Drupal\node\Entity\ before it, but I was only able to figure that out by looking at examples. I looked at this page https://api.drupal.org/api/drupal/core%21modules%21taxonomy%21src%21Controller%21TaxonomyController.php/class/TaxonomyController/8.1.x and saw the class hierarchy class \Drupal\taxonomy\Controller\TaxonomyController but when using

\Drupal\taxonomy\Controller\TaxonomyController\Term::create

I still get an error saying

  Fatal error: Class
  'Drupal\taxonomy\Controller\TaxonomyController\Term' not found

If it is true, that the reason why it is failing, is because I'm not including the right namespace, then how do I use the official documentation to figure out what I should be including? Or is there something else I'm missing entirely?


texts: How to make a carousel with 1 highlighted node and thumbnails left and right?

texts:
I'd like to make a carousel exactly like the picture below, 6 thumbnail node on the left side, 1 highlighted node in the middle and again 6 thumbnail node on the right side, and when the user clicks on the controls, the next set of nodes shows up.

I guess it must be possible to achieve this with the output of the views and using a module like OwlCarousel to achieve this, but so far I couldn't make it work! I'd really appreciate a full detailed answer.


texts: ERR_EMPTY_RESPONSE during installation with PHP 7.3

texts:
I'm trying to install Drupal 8 with PHP version 7.3.0RC4.

When I go to http://localhost it redirects me to http://localhost/core/install.php with the empty response error.

I checked the Apache error log, nothing, edited the PHP config (php.ini) to display all errors but nothing shows up.

However, when I downgrade to PHP 5.6 it works. Is Drupal ready for PHP 7.3?


texts: Is it possible for the front page view to use a different image style for each teaser item?

texts: Im trying to build a complicated grid ui with a different image size and aspect ratio for each consecutive item in the list. How can I select a different image style for each item?


texts: How to pass a Date as Contextual Filter?

texts:
I have a custom content entity 'service' created with Drupal Console (drupal generate:entity:content). I added my own fields to the standard ones created by DC. Of which 'additiondate':

$fields['additiondate'] = BaseFieldDefinition::create('datetime')
  ->setLabel(t('Addition Date'))
  ->setSetting('datetime_type', 'date')
  ->setDefaultValue(array(0 => array(
    'default_date_type' => 'now',
    'default_date' => 'now',
  )))
  ->setReadOnly(TRUE);

Doing this way stores the date in YYYY-MM-DD string format.
I created an Embed View on this custom content entity to be used with views_embed_view().
I'd like to use Contextual Filter on the field 'additiondate' in order to have all the services that have been added SINCE the date passed as parameter.
The only way to pass a parameter seems to be '2018-04-26' and the result is all the services that have been added ON this date, as you can see in the Preview of my View with the generated request displayed:

Any idea?

Here is the screen capture of my options when I add the contextual filter:


texts: How to make a module prerequisite in drupal

texts:
How should i make a module that is prerequisite for an existing module.

For example:

Step 1 : There is comment module in core itself.

Step 2 : In my module i am doing some form alter which affects comment module. Consider my module name as  comment_test.

Step 3 : While enabling comment module my custom module that is comment_test should be as required module.

Step 4 : How can this be done?

Thanks in advance...


texts: How to limit the results of a view with flagged content to the flagging user only?

texts:
I have created a view which displays a list of flagged content. I have used the Flag module to achieve this. I have named this page as Bookmarks, and the URL to this page is http://example.com/user/%/bookmarks. User should only able to access their own flagged content.

Consider this scenario:

User A has his flagged content in http://example.com/user/2/bookmark (uid=2 for User A).
This page should be accessible only by User A and the admin user.
If User B tries to access http://example.com/user/2/bookmark, it should return access denied.

How can I get this to work?


texts: Changing user register/login pages into secure sub domain

texts:
I need to change my user registration and login pages into a secure sub domain of my site, how is it possible ?
In detail,

When user logon to http://www.mysite.com/admin that must be redirected to https://admin.mysite.com and he can login from there to our main site .Is it possible ?


texts: Menu does not appear while opening my site

texts:
management menu such as add content type,module ,configuration does not appear in my site.
So how can I solve it.


texts:
I was developing on my local machine (Mac OS X) and moved to a VPS with CentOS 6.5.  Problem I'm having is with clean urls.  It was working fine on the local machine.  However on the vps server, I'm seeing something strange.  When I go to enable it, I can go to the config page with clean url (example.com/admin/config/search/clean-urls) and the checkbox is enabled.  When I check it and save it, the page refreshes with "The configuration option have been saved." but the checkbox is not checked.  I can repeat this process.  If I look into variables table, I see the following.

+-----------+-------+
| name      | value |
+-----------+-------+
| clean_url | i:1;  |
+-----------+-------+

I cleared cache manually (via MySQL) and through Drupal interface. I checked reports and it is all clean. I looked at logs, but they don't seem to show anything related to this issue.  The effect of this is that all URLs generated are ?q=..

Any ideas on what I should look for next?


texts: After upgrading from drush 7 to 8 with multisites, using drush from site directory cannot find drupal 7 (Windows)

texts:
Previously with drush 7, I could cd to the site directory (e.g. sites/example1.com) and perform drush commands (e.g. drush st). Now with drush 8, unless I specify the root in the drush command, it cannot bootstrap past level 0:

$ drush st
 PHP configuration      :  C:\wamp64\bin\php\php7.1.9\php.ini
 PHP OS                 :  WINNT
 Drush script           :  C:/Users/Dan/AppData/Roaming/Composer/vendor/drush/drush/drush.php
 Drush version          :  8.1.18
 Drush temp directory   :  C:\Users\Dan\AppData\Local\Temp
 Drush configuration    :
 Drush alias files      :

$ drush st -r c:/wamp64/www/drupal7
           Drupal version                  :  7.64
 Site URI                        :  http://example.com
 Database driver                 :  mysql
 Database hostname               :  localhost
 ....

I do have a sites/sites.php file:

 <?php
 $sites = [
    'dev.example1.com' => 'example1.com',
    'dev.example2.com' => 'example2.com',
    'dev.example3.us' => 'example3.us',
 ];

Local site sites\example1\drushrc.php file:

<?php
$options['l'] = "http://dev.example1.com";
$options['r'] = 'c:/wamp64/www/drupal7';

Without the -r root option, drush doesn't load the sites.php or the drushrc.php.

Drush is installed globally using composer. It was not installed as part of drupal 8.

MORE INFO: Oddly, drush 8 is working with drupal 8 in a multisite directory.


texts: Redirect user to language other than default

texts:
So... i have set a drupal website with 2 languages, english (default) and portuguese. At some point during development the client asked me to change the default language to portuguese but as i've read all over the web that turning the default language to other than engish is not advisable. Is there a way to redirect the user to the portuguese version of the site?

Thank you all guys.
niebes


texts: Rewrite results (like trimming titles) won't work at all

texts:
I created a view with articles. All I need is to trim titles.
The reason I cannot do this from content types (teaser view) is because the title field is a node module element. (It cannot be deleted, and is too late for that.)

There is an option in views output in the preview mode/contextual menus/rewrite results, but it seems it won't work.

None of the rewrite results options will work. It looks like a bug in the Views module.


texts: How do I setup Chained fast backend, Varnish, APCu and Redis cache bins in settings.php?

texts:
On a Debian Jessie server (Nginx, PHP 5.6, Zend Opcache), I installed Apcu, Redis, Varnish. I also installed APCu, Chained fast backend, Redis and Varnish modules.

In order to make these caching backends play together with Drupal 7, what is the correct backend for each cache bin?

The documentation says :

  Because chained_fast backend will mark all the cache entries in a bin as out-dated for each write to a bin, it is best suited to bins with fewer changes.

How do I take care of that recommendation ? Is that correct to put APCu as $conf['chained_fast']['fast_backend'] or is Redis faster ? Between the 20 and more tables, how can I estimate which cache bin should be set to Redis or APCu? Last, shall I only set cache_page for Varnish or is cache_panels a good candidate also for Varnish if all my pages are built with panels?

At the moment this is my settings.php cache part:

//Cache backends
$conf['cache_backends'][] = 'sites/all/modules/contrib/apcu/apcu.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/contrib/chained_fast/chained_fast.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/contrib/varnish/varnish.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc';

// Chained fast settings
$conf['chained_fast']['fast_backend'] = 'DrupalAPCuCache';
$conf['cache_default_class'] = 'ChainedFastBackend';

// Related Varnish settings
$conf['reverse_proxy'] = TRUE;
$conf['cache'] = 1;
$conf['block_cache'] = 1;
$conf['cache_lifetime'] = 0;
$conf['page_cache_maximum_age'] = 86400;
$conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR';
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
$conf['omit_vary_cookie'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE; // Don't bootstrap the database when serving pages from the cache.

// Redis settings
$conf['redis_client_interface'] = 'PhpRedis';
$conf['redis_client_host'] = '127.0.0.1';
$conf['lock_inc'] = 'sites/all/modules/contrib/redis/redis.lock.inc';
$conf['path_inc'] = 'sites/all/modules/contrib/redis/redis.path.inc';

// Cache bins configuration
$conf['cache_prefix'] = 'vts'; // Unique prefix for each site
$conf['cache_class_cache_entity_node'] = 'Redis_Cache';
$conf['cache_class_cache_entity_user'] = 'Redis_Cache';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['cache_class_cache_panels'] = 'VarnishCache';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';  // The 'cache_form' bin must be assigned to non-volatile storage.


texts: Sharing data in the same database, being able to edit data

texts:
I am looking for a way for Drupal to be able to access and modify data in an external table in the same database.

Both Drupal and the script need access to the same data.
Duplicating/Migrating is not an option since data should be available real time.
Data is located in the same database, but the other script has its own tables.
We currently use the Data module and Views to display data from the external tables, and that works well.
We are having a hard time finding a way to add or edit records in these same tables within Drupal (i.e. Add/Edit/Delete forms within Drupal). We've found modules that read such data, but not write data.
Ideally, the data in the external table should behave like an entity within Drupal. So, once defined and setup, it behaves just as if you were editing a node.
Logged in Drupal users would have access to these forms to edit their own data (that actually resides in the other script's tables).
Currently using Drupal 7 since it has more modules, but I am willing to upgrade to Drupal 8 if that's the only way to edit an external table within Drupal.


texts:
I am newbie into Drupal.

I want to add 2 form elements dynamically to existing form via AJAX based on particular condition. But in the examples I saw till now the AJAX callback defined returns only one element to form. I tried to achieve this by adding these two fields in fieldset and returning fieldset as a single item. But this replaces my container div completely. This works only at first time and then the contents returned by callback replaces the container.

function new_registration($form, &$form_state) {
    $form['select-reason'] = array(
        '#type' => 'select',
        '#title' => t('Reason'),
        '#options' => array('' => 'Select') + _global_reasons(),
        '#description' => t('Reason.'),
        '#ajax' => array(
          'event' => 'change',
          'callback' => 'is_true',
          'wrapper' => 'options',
          'method' => 'replace'
        ),
      );

    $form['options'] = array(
        '#type' => 'container',
        '#prefix' => '
',
        '#suffix' => '
'
      );
    }

function is_true(&$form, &$form_state) {
      $product_quality = $form_state['values']['select-reason'];
      if(_belongs_check($product_quality)) {
          $form['a-add'] = array(
              '#type' => 'fieldset',
              '#collapsible' => FALSE,
              '#collapsed' => FALSE,
          );
          $form['a-add']['detail'] = array(
              '#type' => 'textfield',
              '#title' => t ( 'Details' ),
              '#description' => t ( 'Enter product name.' ),
              '#maxlength' => 400,
              '#size' => 100,
              '#required' => TRUE,
          );
          $form['a-add']['num'] = array(
              '#type' => 'textfield',
              '#title' => t ( 'Number' ),
              '#description' => t ( 'Enter number.' ),
              '#maxlength' => 400,
              '#size' => 100,
              '#required' => TRUE,
          );
      } else {
            //remove 2 fields added in IF block
      }
      return $form['a-add'];
    }

I also tried to return HTML structure of these two and place it in #markup type of form element. But I am not convinced with this way as theming might be complicated.
Can anybody help? Thanks in advance.


texts: How do I get Drupal to load a node instead of looking for the index.php outside of drupal in a subfolder

texts: I inherited a site that has a lot of manually created html/php files in subfolders outside of Drupal. In other words, not as nodes, but static html/php fiels (leading of from the site root). I would like to move many of them inside Drupal as nodes because they are just some basic html/php. However, when I create a node using the same alias, it continues to load the old static html/php page. (I have flushed cache, both local and in drupal). Thoughts?