texts: New Drupal 8 install, homepage works, all other pages throwing a 404

texts:
I have a server that houses my personal website (in the root folder.) Let's call it me.com. In the root I have: me.com files, a /dir/ called "me2." In /me2/ I have my drupal 8 install for a new site. Installed fine. Logged in, can access homepage. Every other link I click goes to a 404. I am not sure why this is happening.

*Edit: "me.com" site is Wordpress.


texts:
Say I have two Flags attached to content; for example a "mark public" flag & "mark private" flag or a "like" flag & "dislike" flag, basically opposites. Is it possible to have the first flag automatically unflag itself conditionally whenever the second flag is flagged? This is basically like using Flags as radio buttons; only one can be selected at once and the other is automatically turned off. Otherwise when using Rules to determine if particular content was flagged "Public" or Private", is difficult since users can flag the same content both "Public" and Private" at the same time.

This could be easily achieved with only one Flag. But this doesn't translate well to a "like", "dislike" flag scenario, since users can only choose to like something but not specifically to dislike. A voting module would be a good alternative for this case however the only one currently available for D7 is the Rate Module which provides ratings for only nodes and comments, not as flexible as Flag module. I have tried implementing Rules to check for if one flag is flagged make the other unflagged, but it does not work.

Any suggestions as to how to tackle this?


texts:
I am using Drupal 8. I installed the Drupal commerce module and successfully set it up .

I am able to add the products to the cart, but I want to redirect the users to checkout as soon as the product is added. How can I achieve this?

In Drupal 7 we can do this using rules, but I am not able to find the rule event for this, in Drupal 8.


texts: Create view with path relative to taxonomy term

texts:
I have multiple content types and would like to create a couple of views to show various content types as sub directory to the term page.

The challenge is that I need to the path to be taxonomy/term/%/content-type1
taxonomy/term/%/content-type2

Tired using tokens in the views path. It didn't work.

Any other suggestions?


texts: Permission to edit a node by multiple users

texts: Suppose there is one node (Like node/4) which the Admin can edit. My requirement is to give permission to multiple users to edit the same node i.e. node/4. Please help how to accomplish this task.


texts: How can I unset an option from Profile2 while it is part of Registration?

texts:
I have a Main Profile page that I added to the User Registration page but I only need one option from the entire Main Profile to display while the user is creating an account. I was able to hide all of them using 'display: none' in the CSS but this caused an issue with a particular field in the Main Profile where they could list themselves as 'Featured'.

In my Custom Module I have a form_alter function but when I print out the form in  tags it only shows the form values of the actual registration part. It doesn't include any fields from the Main Profile. In the developer tools on Chrome it shows that the Main Profile section is in the same form as the registration section.

Is there any way I can get to the Main Profile elements to do an unset on my particular field within my form_alter function?

Thanks


texts:
I installed version 8.3.7 and today the version 8.4.0 (NOT localhost, multilingual or not), using PHP 7.0.13, MySQL 5.6.22, and made the proper settings apparently. I read about this problem, which generates this error:

  Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.

I took the necessary steps like changing the settings.php file and inserting:

$settings['trusted_host_patterns'] = [
  '^gersonvagner\.com$',
  '^www\.gersonvagner\.com$',
];

However, the problem persists in all instances, for example when I try to put the site under maintenance or try run cron. I don't know where else I might be going for more than a week of testing and reading. If anyone can help me.

Every time I go to validate any action in the administrative environment it returns me with this message, anyway, the changes are accepted, but always this message is shown to me. Examples: If I run cron for updates, it runs and the message appears successful, but after the screen with the message I mentioned earlier. If I put or remove the site from the maintenance mode, the same occurs, that is, the site enters or leaves the maintenance with success, but I will only know this if I return to the domain and see the status, because the screen that always appears next is with this message: "Redirects to external URLs ...". This is repeated in all changes that are made in the admin environment, such as installing or uninstalling modules or templates. I don't see what I am doing wrong.


texts: How to search for complete SKU like "K-00019" (without splitting it at "-" and without removing leading zeros)

texts:
I am using Search API to search commerce products by SKU. But when I enter "K-00019" as search string, every item is retrieved that contains "19". I investigated why this happens and found, that a method called "prepareKeys" splits the string K-00019 into two parts: K and 00019, then ignores the first part (letter K) and transforms the second part to 19 because of leading zeroes.
As you can mention, this behaviour leads to way too much results.
I need a search that allows to search for the complete sku. Do you have an idea how I can accomplish this? I do not have to necessary use Search API, if you have another suggestion, it would be perfectly fine, even a workaround would be okay.


texts:
I am trying to develop a Drupal 8 module in which I have to override the html.html.twig template. The idea is that I do not want any of the default html.html.twig template returned instead I only want the custom template returned. I have been spending hours Google hunting and trying to make sense of the many examples and I have gotten myself totally confused.

What is happening is the content of my custom template are being displayed in the default html template so I am seeing the custom content inside the default html template rather than overriding the default content.

For the sake of getting this template override working I have simplified the module as much as possible and simply want to return the contents of a variable into a placeholder in the twig template. Once this override is working I can go back and add the code that will create the correct content to be output into a number of variables in the template.

What I do not understand is exactly how to I override the html.html.twig template.

My module is called unsw_blocks and in the unsw_blocks.module I have the following

function unsw_blocks_theme() {

$theme = [
'unsw_blocks' => [
     'variables' => ['test_var' => NULL],
    ],
];

return $theme;
}

In the Unsw_blocksController.php have the following

class Unsw_blocksController extends ControllerBase {

  public function unsw_blocks($name) {
  return [
    '#theme' => 'unsw_blocks',
    '#test_var' => $this->t('The variable called test_var simply passes this text itself to the theme template'),
  ];
  }
}

In the custom modules templates directory I have unsw-blocks.html.twig which simply contains

Testing Template

test_var: {{ test_var }}


texts: How can I override the page title using contextual filters?

texts: I have 3 contextual filters in a view and I use them to override the views title. However, still, the page title (title in the browser tab) are still using the default title of the view. How can I make it use the title provided from the contextual filters?


texts: Add a template suggestion with highest-priority in custom module

texts:
It's easy to override an existing template in custom theme using one of the template suggestions or just by copying the desired template file and past it under custom theme templates directory.
But whenever you have an overriding template in your custom theme, and you desire to override that template in custom module you can do it by adding a new hook suggestion using hook_theme_suggestions_hook() or hook_theme_suggestions_alter() hooks, the problem is how to informe Drupal that the new added suggestion by the custom module should has a highest-priority than the one defined in custom theme, especially when the custom theme already used the existing highest-priority suggestion.
One of the proposed solution is using hook_theme_registry_alter(), but this is the wrong approach because  it will always force the theme system to use the template declared in the custom module templates directory.
Is there an approach to have a full control on managing suggestions priorities ?


texts: Reference to parent node on entity form type

texts: I have a "Request more info" Entity Forms Type form that is accessed from basically every content type in the website, with a Menu Tab link created via Views. I attempted at adding both a NodeReference and Entity Reference with Prepopulate without successs. The closest I get is having a Select List displaying all Nodes from all referenced Content Types (Hundreds). Is it possible to have this field pre-populated instead of the user having to choose from a long list of Node Titles?


texts: How to set the default value of a CCK field

texts:
I got a CCK field to select a currency; this field is not required, and the dropdown displays '-None-'. I want to change that.

There's the option to let PHP-Code return the value. It says:

return array(
    0 => array('value' => 'value for value'),
    // You'll usually want to stop here. Provide more values
    // if you want your 'default value' to be multi-valued:
    1 => array('value' => 'value for value'),
    2 => ...
);

So I tried with:

return array(
  0 => array('value' => 'my_text'),
);

Drupal now tells me:

The PHP code for 'default value' returned Array ( [0] => Array ( [value] => my_text ) ) , which is invalid.

I got a list of 4 currencies to choose from, which are the allowed values in my dropdown. What do I have to do to replace '-None-' with my own default?


texts:
I want add a Download Button, as far as I know that means the posted content contains Buttons.

now I add the CKeditor for the purpose. When post content users have to use HTML ,But not all the users know HTML,

then What should I do


texts: How difficult would it be to show a column in the user list (admin/people) that shows the user's ID number? Is this possible?


texts: Unit Testing code that retrieves content

texts:
I have a method which calls another one to retrieve a specific node ID. If it can be found, it then retrieves the node.

Is this the kind of functionality that can be tested in Drupal? Or even should it tested? If so what is the best approach for it?

private function retrieve() {
  // Call another method to get IDs of specific bundle based on its workflow status. We get just one ID back as there is only one node for this bundle.

  // If statement to validate we do have a node ID.
  // Call method to retrieve content for node based on the retrieved `nid`
  // Return node content if any has been found

  // If no content is found return FALSE.
}


texts: How to save the "user agent" in the Drupal logs?

texts:
when going through the log files it would be really helpful to know if an error was caused by a real user or by a bot.

Is there a way to save the "user agent" string (browser name) to the drupal log?


texts:
Im noob in Drupal and I don't know how can I put the FB code for display the last post in a block. I'd create a block with php code text format, but doesn't work, the block does not render the code.
This is the code from FB, if I put it into a plain html file it works fine

How can I put this into a block?
I'd created a block--fb.tpl.php cloning the block.tpl.php and pasted the code but this doesn't work either.
This is for not use the FB module because I should create an app and FB request my data and I don't want an app, just render the last post of the profile
can someone give me some gide with this?
Thank you so much for your help


texts: Is there a Grouped Product listing type in Drupal Commerce

texts:
I have a Magento site I would really like to migrate to Drupal Commerce.  The one must-have feature is Grouped Product.  A grouped product will have a base product from which the product listing will use the photos, description, etc.  The related products will provide their titles, prices, etc. to the product listing.  See the photo for an example.

Can this be done with Drupal Commerce?

Thanks for your time and help!


texts: Drupal clean URLs not working from subdirectory

texts:
I'm not sure if this belongs here or in serverfault, so feel free to flag it if necessary. I have a server with a drupal installation at /drupal. I want the URL www.example.com to point to www.example.com/drupal. I don't want to change my server root, just do an Apache Rewrite.

RewriteRule (.*) /drupal/$1

This works, so when I type www.example.com I go to the drupal site. The issue is no other URLs go to the correct spot. So when I type a URL like www.example.com/about, I see the drupal theme but then the content just says

  The requested page "/about" could not be found.

The page www.example.com/drupal/about does show up fine. I've also changed $base_url to www.example.com. Any idea what could be wrong?

I've also tested that URLs like www.example.com/?q=node/16 work fine, so the problem is just with clean URLs.


texts: Get Last Node Access Timestamp Per Node by User

texts:
Drupal 8.x

I am trying to compare the current users last access timestamp to other timestamp values and am wondering how to get the current users "last_access" in HOOK_preprocess_node().

MYMODULE.module:

function MYMODULE_preprocess_node(&$variables) {
  kpr(\Drupal::currentUser()->getLastAccessedTime());
}

This returns a timestamp, however, it updates quite infrequently and not on node load, or even after cache clear, and does not seem node specific.

I've accessed this value in HOOK_preprocess_user() with $variables['elements']['#user']->access->value, however, I would like the same value available in node.

How do you get the timestamp of the user's last view of a node per node?


texts: How do I programmatically get the link for a webform submission?

texts:
I have managed to create a table of webform submissions of a particular type, thanks to the answer from a question posted here.  What I would like to do now is add a link for each webform submission, and I can't figure out how.

I tried looking through the API, and found a toUrl function, but I don't understand how to use it to get the link for each webform submission.  Once I have the link, I would like to combine it with the rest of its info in submission_data[] for display in the table.

Thanks in advance!

$query = \Drupal::entityQuery('webform_submission')
  ->condition('webform_id', 'sign_up');
$result = $query->execute(); // Gives me IDs associated with the "sign_up" webform.

$storage = \Drupal::entityTypeManager()->getStorage('webform_submission');
$submissions = $storage->loadMultiple($result);
$submission_data = array();
foreach ($submissions as $submission) {
  $submission_data[] = $submission->getData();
}
// $submission_data now contains all the submissions from "sign_up" webform.

How do I add a link to the webform submission? When I look through submission_data[] it doesn't contain the ID of the webform submission


texts:
I currently have a content type called Training from which I have created a node for each training course I have. Each node has a multiple date field for when a course runs over more than one day (not necessarily days running after each other).

How would I create additional occurrences of a course dates without duplicating the node.

Eg

Fire course
2 day course
Session 1:
25/12/14 & 25/01/15
Session 2:
14/3/15 & 15/3/15


texts: Cascade entity reference in a content type

texts:
I have two content types parts and maintenance.
Parts has 3 fields.

Oven type
Oven Part
Parts price

In maintenance i have a entity reference field with autocomplete that points to parts.
So now when a user types in a part the autocomplete show a list of possible matches.

The problem is that 2 different ovens can have the same parts but the price is different.
So I would like it to be a cascade so that a user can first select the oven and then select the part for this oven.

select the oventype

show the parts that fit this oven


texts: Cannot create hook_menu subitems with proper position in administrative menu

texts:
I would like to add an hook_menu item and generate its expandable subitems under ubercart's 'admin/store/' path.

For now I have:

function activit_menu() {

  $items['admin/store/products-fabrics'] = array(
      'title' => 'Látky produktov',
      'access arguments' => array('access administration menu'),
      'type' => MENU_NORMAL_ITEM,
  );

      $items = array_merge($items, activit_generate_products_fabrics_menu_items());

    }

function activit_generate_products_fabrics_menu_items() {

  $products = activit_get_products_with_fabrics();

  $items = array();

  foreach($products as $product) {

    $items['admin/store/products-fabrics/'.$product['nid']] = array(
        'title' => $product['title'],
        'access arguments' => array('access administration menu'),
        'file' => 'd_forms.inc',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('activit_eshop_fabrics_of_products_form'),
        'type' => MENU_LOCAL_ACTION
    );

  }

  return $items;

}

But this code will create both 'products-fabrics' item and all its subitems at the same level in administration menu and 'admin/store/products-fabrics' item is not expendable. After clicking at 'products-fabrics' item you will see the same andimistration page as aftre clicking at 'admin/store' plus the subitems links at the top oft he page. I can hide this page with css an let only the subitems to be visible. But I need to create expandable 'admin/store/products-fabrics' item in order to be able to click directly at 'admin/store/products-fabrics/subitem'.

I was trying all the possible item types but no success. Is there something I am missing?


texts: Drupal 7 - Giving correct path to callback function in #autocomplete_path

texts:
I have this below code for autocomplete implementation but I just get AJAX error

As you can see there is not anymore details for tracking down the issue. I also checked the logs but seems like this particular error is not logged anywhere which is making me hard to debug. However I suspect (almost confirmed) there is a strong relation between menu path (tdyards/tdyards_searchbox), autocomplete_path (tdyards/tdyards_searchbox/autocomplete_callback)and callback function name (tdyards_searchbox_autocomplete_callback)

Please help me to understand and correct this

Below is the complete code of my module which is sub-module of tdyards

function tdyards_searchbox_menu(){

  $items['tdyards/tdyards_searchbox'] = array(
    'title' => 'Autocomplete (simple)',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('autocomplete_form'),
    'access arguments' => array('access user profiles'),
    );

  return $items;

}
function autocomplete_form($form, &$form_state) {

  //dpm(cities_autocomplete_callback("A"));
  $form['info'] = array(
    '#markup' => '<div>' . t("This example does a simplest possible autocomplete by username. You'll need a few users on your system for it to make sense.") . '</div>',
  );

  $form['user'] = array(
    '#type' => 'textfield',
    '#title' => t('Choose a user (or a people, depending on your usage preference)'),
    '#autocomplete_path' => 'tdyards/tdyards_searchbox/autocomplete_callback',
  );

  return $form;
}

function tdyards_searchbox_autocomplete_callback($string = "") {

  return drupal_json_output(drupal_map_assoc(array('Data','Theta','Quota','Meta')));

}


texts: How do i get the all the regions available in the current theme programatically?

texts: I want the list of the names of all regions available in the current theme in drupal 8. How to do this ?  And is it possible to get the list of the blocks placed on that region ?


texts:
I am utilising the basic page content type. When viewing my basic page the layout consists of:

A view that outputs a block in the form of a header. Using the basic page fields "title" and "short description"
A block that outputs the body of the page.

When I view my page, the node/articles markup is rendered as follows:

...

...

Analysing the markup we can gather that:

They both have the same node id
The latter can be differentiated by the data-quickedit-entity-instance-id="1" tag
Only the 'quick-edit' button appears for the first article
On quick-edit click, both of the articles are trying to be manipulated by some form of js - there could be conflict here.

So the question is. How come the quick edit feature does not work for a node that is rendered twice on one page?

Has anyone got any reason why it is not working or can provide a solution for this?

Thanks in advance


texts: Functional tests report constants are undefined, even if the constant is set in the test or phpunit.xml

texts:
I have unit and kernel tests that check for the existence of secrets (via define) in a settings.secrets.php file in my local site (Acquia Cloud convention). This file is not committed to the repo, stored in the database or exported.

When writing a functional test, I ran into an issue (which sounds similar to this one). If I tried to put define in my test file, I would just get an error and test failure saying the constant is undefined.

I came up with this, overriding prepareSettings() to write to the settings file generated for functional tests:

  /**
   * {@inheritdoc}
   */
  protected function prepareSettings() {
    parent::prepareSettings();
    $directory = DRUPAL_ROOT . '/' . $this->siteDirectory;
    copy(DRUPAL_ROOT . '/sites/example.secrets.settings.php', $directory . '/secrets.settings.php');
    $append_line = 'include_once dirname(__FILE__) . \'/secrets.settings.php\';';
    file_put_contents($directory . '/settings.php', $append_line, FILE_APPEND);
  }

The file that is copied just contains define statements with fake values.

Is this a valid approach to fixing this problem in a functional test, or did I miss something else and don't need the above code?

Update:

The code in the question only works for Functional tests as they have that method. Lower level kernel and unit tests have no access to that.

Instead, I found that you can add constants to phpunit.xml and then the tests have them defined:

    <php>
        <const name="MYMODULE_API_URL" value="https://api.myproject.localhost"/>
        <const name="MYMODULE_API_KEY" value="123456789"/>
        <!-- Set error reporting to E_ALL. -->
        <ini name="error_reporting" value="32767"/>

There appears to be one exception though - BrowserTests that have calls to drupalGet can still throw Use of undefined constant exception and fail the test. I can't figure that part out. I also tried using a testing profile that does not enable page or dynamic cache - same result. For now I had to comment out the drupalGet calls until I figure it out later.

However by adding it to phpunit.xml, you cannot do it in prepareSettings or you get a 'constant already defined'. So it appears that it is aware of the existing of this value.

Why do non BrowserTests not adhere to constants that are set either in code or in phpunit.xml, but any other tests do?

Update 2:

Here is the code in the test. The lines in the first loop for drupalGet will fail with the error, but curiously, the last block passes just fine:

    foreach ($permitted as $account) {
      $this->drupalLogin($account);

      foreach ($this->entity_types as $entity_type) {
        $this->drupalGet('node/' . $entity_type['nid'] . '/edit');

        if ($entity_type['response'] === 200) {
          $this->assertLinkByHref('/node/' . $entity_type['nid'] . '/update');
          $this->assertLinkByHref('/node/' . $entity_type['nid'] . '/data');
        } else {
          $this->assertNoLinkByHref('/node/' . $entity_type['nid'] . '/update');
          $this->assertNoLinkByHref('/node/' . $entity_type['nid'] . '/data');
        }

        $this->drupalGet('/node/' . $entity_type['nid'] . '/update');
        $this->assertResponse($entity_type['response']);

        $this->drupalGet('/node/' . $entity_type['nid'] . '/data');
        $this->assertResponse($entity_type['response']);
      }

      $this->drupalLogout();
    }

    // As someone without the specific permission
    $this->drupalLogin($this->staff);

    foreach ($this->entity_types as $entity_type) {
      $this->drupalGet('node/' . $entity_type['nid'] . '/edit');
      $this->assertNoLinkByHref('/node/' . $entity_type['nid'] . '/update');
      $this->assertNoLinkByHref('/node/' . $entity_type['nid'] . '/data');
      $this->drupalGet('/node/' . $entity_type['nid'] . '/update');
      $this->assertResponse(403);
      $this->drupalGet('/node/' . $entity_type['nid'] . '/data');
      $this->assertResponse(403);
    }


texts: How to change user id from incremental integer to random hash?

texts:
By default drupal uses incremental user id but I want random 7 character hash, is there any module that can help me with that? If not what is the simplest way to achieve that?

from:
    user/1

to:
    user/5rey2t5

by the way I know how to generate the hash in php I'm looking for the best way to implement it.


texts: How to alter the fields available for commerce backoffice Quick Edit?

texts:
I have added a "waiting time" field to the orders in Drupal Commerce, so that each order has a waiting time.

I would like for the field to be available using the Quick Edit options of Commerce Backoffice. How to do it?


texts: I'm looking for a way to give an author the possibility to set the field visibility in the node add/edit form. Something like the Image Hide Module just for Text Fields with a checkbox behind each text field to select if this field is rendered or not.


texts: Show content only if user is an owner of this content (node)

texts: How do I show a node "only if a user is an owner of the node" with Panels/Page Manager' Variants and its Visibility Rules (right icon on each content)?


texts: How can I add a class to a view list item that has a moderation state of draft

texts:
I have a view that outputs a list of nodes for a menu. The view
displays the title linked to the node. The View allows published nodes or
nodes in the moderations states draft or review. How can I add a class around the titles that are in draft or review. I would like to style these differently. I am using drupal_view to print the block inside a template. Can this be done in a theme preprocess or custom module?


texts: Having trouble seeing YouTube video in Drupal 7 using Media and Media YouTube

texts:
I'm having trouble seeing YouTube video in Drupal 7 using Media and Media YouTube.

I've followed this tutorial but I never seem to get a video to show up on my page.
http://www.cleverlogic.net/tutorials/drupal-7-video-setup-using-media-and-media-youtube-module

Another thing I've noticed is that when I add a video to some content type, I never see the video's thumbnail.

No errors seem to get displayed.

I'm using Drupal 7,
Media 7.x-1.0-rc2
Media YouTube 7.x-1.0-alpha5

Thanks for your help.


texts: How do I add the JavaScript src file inside a block?

texts:
I have called the JavaScript source code, <script scr=""></script>, inside a block. And this code is working fine.

But I am not sure whether it's good practice or not.

If it's not a good practice, give me some suggestions for adding above code inside the block.


texts: Access current node in an existing block

texts:
I am using Drupal Lightning and a bootstrap subtheme. I have a requirement to place a section of the node page template in another block region. So I need to access the nodes fields in that block, fields like the taxonomy, block, breadcrumbs. Example my node--page.html.twig template prints these fields:

{{ node.title.value }}
{{ content.field_text }}
{{ drupal_view('mysection', 'block_1') }}
{{ drupal_block('mytheme_breadcrumbs') }}

It also has an includes template

{% include '@mytheme/includes/section.html.twig' %}

I can print these fields fine in a node template

node--page.html.twig

But I need to print these fields outside of the node template and into a block. I tried to create a View block and set a contextual filter "Content ID from URL" Then placed the View block in a region and then in the region template I tried to access the node fields from my region template but could not. I can access the title and body fields. This is the template.

region--myregion.html.twig

I then tried Entity blocks. I created a new block of type Entity view (Content). I tried to access the node fields from my region template but could not.

block--entityviewcontent.html.twig


texts: I have created some roles and these role's user also can create certain type of user.so how to know who is creator i.e, user author name.


texts: How can I save/load my Entity from a different database in Drupal 8?

texts:
For a custom Drupal 8 module I am integrating data from a separate database (other than the default drupal database) by defining a new Drupal entity in my module.

How can I configure my Entity class (or an EntityStorage class?!) to get the data of this entity from a different database?
Can I change the injected (?) Database Connection object from which the entity is queried?

My question is similar to Drupal entity from different database dealing with Drupal 7. However, I think Drupal 8 has some different approaches.

Note: This other database is currently running on the same server.


texts: How to programmatically list users with a certain role?

texts:
What is the preferred way of programmatically generating a list of users with a certain role?

(I know how to do it with a database query, but surely there's a higher-level method.)


texts: I am trying to understand how the addressfield module is using hook_field_widget_form. When is it called and where are its parameters coming from? When I do a printout of its $instance parameter, I see that it has default values. Where are these set?


texts:
I would like to customize the messages for one time login links (i.e. password reset links). In some cases, I redirect the user to the login page. In these cases, it does not make sense to have "Please request a new one using the form below."

Is there a hook or module I can use to add some logic to that message? (I can do a global override with String Overrides, but am looking for more conditional messages.)

I am using Drupal 7.


texts: How can I pass variables from views template to node template?

texts:
I have a view of contents of a content type. This content type has fields which references entities of another content type (and that in turn references another set of entities of yet another content type).

I am trying to iterate through this view with twig templates.

If I choose to show contents for my format, I can easily access the referenced entities and its fields. My quandary is however, I cannot track what row.content row/index I am in.

If I switch to show fields, I can use the global view results count and I have an effective counter.  However, I cannot seem to be able to access the referenced entities to get the values of the fields.

So far I have not found anything thru searching the net that actually addresses this particular problem.

I am using the views-view-unformatted template which in turn calls the node--view template. I am unable to 'pass' along the row index from the unformatted views template to node view template.

I already know that this is doable when using fields, but fields is out of the question because of the inability to access referenced entities.

Now there are two possible solutions to this issue:

Show content and somehow track the row.content index between twig templates.
Show fields and be able to actually access the fields of referenced entities.

Anyone have any suggestions?  Thank you.


texts:
The log messages for tasks seems pretty uninformative when you have an error. Is it possible to change the log level for task logs in Aegir? If so, how?

Thanks!


texts:
I have a content type with two taxonomy terms: "Intern" and "Non-Intern"
I want the items with "Intern" to only be visible when logged in. How do I achieve that?


texts: Create a template for a custom page in Drupal 7?

texts:
Is there a simple way to create a custom template in a theme for a custom page in Drupal 7.

I've tried all of the normal conventions:

page-custom_page_name.tpl.php
page-custom--page--name.tpl.php
etc.

None seem to be working. Help would be much appreciated!


texts:
When I try the view for out-of-the-box use that comes with Similar entries 7.x-2.0 i get this error:

Strict warning: Declaration of similar_handler_argument_nid::query() should be compatible with that of views_handler_argument_numeric::query() in require_once() (line 11 of C:\xampp\htdocs\drupal\sites\all\modules\similar\views\similar_handler_argument_nid.inc).

I searched drupal.org and found someone with the same problem: http://drupal.org/node/1270404
with no answer since September so I decided to try here.

I have tried the beta1 and dev version, run cron, tried to find some tutorial on how to use the module, read the readme for the module and had no luck. Am I missing something obvious?

I also get the error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'score' in 'order clause'


texts: Output referenced entity in correct language

texts:
The following code outputs referenced entities in the original language they were created.

{% for story in node.field_stories %}
  {{ story.entity.label }}
{% endfor %}

I want it to render in the current language (translation) instead. How can I achieve this?


texts: How is it possible that neither if nor else branch gets executed here?

texts:
I'm developing one of my first drupal modules and stuck here:

$maxexp = db_result(db_query("SELECT max(expiration) FROM {uc_roles_expirations} WHERE UID=%d and rid=%d", $uid_befizeto, 4));
dpm('DB query finished');
dpm('me = '.$maxexp);

if($maxexp) {
   dpm('True branch');
 } else {
   dpm('False branch');
 }

This is a snippet from mymodule_nodeapi's case 'insert'. My problem is that I do not understand why do I see the following messages after saving a node:

DB query finished
me =
Node blah saved successfully

I simply do not understand if there is no error, how it is possible that I cannot see True branch or False branch among the messages..


texts:
Requirements:

Change the Navigation block link "Add Listing" based on role.
This is the built in Navigation block and I've renamed Add Content to Add Listing

I've tried all the solutions here.  Though I admit I am probably doing it wrong.

Change menu link title dynamically?
How do I modify a menu link title dynamically?
How do I dynamically change the title of a menu link?

I've created a module with the following code:

function mymodule_menu_alter(&$items) {
  $item['options']['alter'] = TRUE;
  $items['node/add']['access callback'] = '_accesscheck';
  $items['node/add']['title callback'] = 'mymodule_title_callback';
    var_dump($items);
}

function mymodule_title_callback($arg1) {
    $title = 'New Title';
    return $title;
}

function _accesscheck(){
  global $user;
  return $user->uid;
}

This is a var_dump snippet of what I'm after:

["node/add"]=>
  array(5) {
    ["title"]=>
    string(11) "Add content"
    ["page callback"]=>
    string(13) "node_add_page"
    ["access callback"]=>
    string(16) "_node_add_access"
    ["file"]=>
    string(14) "node.pages.inc"
    ["module"]=>
    string(4) "node"
  }

Before I attempt to include roles I'm just trying to get the link to change.


texts: View filtering, Relationship Vs Contextual filter

texts:
I used contextual filters before and I know they are just like the normal filters but more dynamic, now I have this view "Sidebar Product advert block" that needs to show the product advert ( Similar to product teaser! advert is a view mode ) BUT only if the product is referenced in the field_product_teaser in the article data type. So to be more clear:

Articles have a reference entity (Autocomplete) field_product_teaser.

Products referenced in this field should appear in the sidebar!

So the condition is {{ product.Product-id == article.field_product_teaser }}

I hope that was clear enough, what should I use in this case ?? contextual filters? relationships? I tried using both with no luck!


texts: HTML Form that Passes Information to Hidden Fields Through URL

texts: I am trying to build an html form that is stretched across several pages. My intention is to use the GET method to send all of the fields data in the query string (URL parameters) and then store this data in hidden fields on the next page. I need to know how to append the data to the URL and how to retrieve it on the next page. I think I will need to send information across at least three pages. I have searched for a way to do this but I haven't really gotten a clear explanation. I am somewhat new to HTML coding. This is the most difficult thing I have attempted to code. Also, (this is not strictly necessary) but I would like to show this information as dynamic text as well. So I can show that certain pieces information have been added to the form. This needs to be separate from the actual form though. Thank you in advance. Any help is greatly appreciated.


texts: Attach JavaScript and CSS assets when render entity using Views REST export

texts:
Goal:

Have a REST endpoint which will deliver list of rendered entities.
Each row should contain a ready-to-use HTML.
All the necessary JavaScript and CSS files should be also included on the page.
P.S. I need this endpoint for lazy-loading of entities.

Given:

I have a Views display with REST export.
I render entities there using the rendered_entity field.

Problem:

JavaScript and CSS files, needed for rendering, are not attached on the page.
E.g. scripts for display of an image gallery, lazy-loading of images.


texts: How to change the path of views content?

texts:
have developed a website for my team and used VIEWS for all the link in the website.

While trying to click the links from client system it shows some error that says remote connection doesn't accept it.. like localhost some problem.. i don know how to resolve it..

I use to paste the IP address of the server and open in client system, so while doing like that in client system it will show this "http://localhost:8082/" . So i think the client system takes the local host so can anybody have an idea to resolve it.

The remote device or resource won't accept the connection.
after troublshooting the result is this.


texts:
I'm trying to create a 'link_field' in Drupal through a module, I've got the following code but I'd like to configure the field settings to do the following:

Not require title
Update the number of values to unlimited

I'm struggling to find any information around what setting key/pair values you can pass through for these, anyone able to offer some guidance on these?

    <?php
/**
 * Implements hook_enable().
 *
 * Create a field. Fields can be created without any needs to attach them to
 * entities.
 */
function youtube_carousel_enable() {
  $field = array(
    'field_name' => 'ytcarousel_field',
    'type' => 'link_field',
  );
  field_create_field($field);

  /**
  * Bind field to a entity bundle.
  */
  $instance = array(
    'field_name' => $field['field_name'],
    'entity_type' => 'node',
    'bundle' => 'homepage',
    'label' => 'YouTube Video'
  );
  field_create_instance($instance);
}

/**
 * Implements hook_disable().
 *
 * Remove field from node bundle (content type) and then delete the field.
 */
function youtube_carousel_disable() {
  $instance = array(
    'field_name' => 'ytcarousel_field',
    'entity_type' => 'node',
    'bundle' => 'homepage',
    'label' => 'YouTube Video'
  );
  field_delete_instance($instance);
  field_delete_field($instance['field_name']);
  print 'Removed ' . $instance['field_name'] . "\n";
}
?>

Cheers


texts: How to display something conditionally in template file depending on the current path

texts:
I would like to do  on page.tpl.php conditionally depending on the current path. I'm using Auto Assign Role and have two paths for registration.

Reading this tutorial, as far as I've understood I can make a template file that overrides the registration page. However I would like to display different things on two deferent paths. How can I do this?


texts: How to add a long textfield in Matrix Module ?

texts:
Does anyone know how to add a long text to the matrix module column?

I've tried with the "custom" field but it's not working.
Any idea?


texts: How to add custom css class to block wrapper

texts:
I need to add custom css classes to several blocks (can be blocks from view, or facet api, etc).
Is there a way to do it without creating a template for every block?
It could be useful a theme function, or a hook, that should do something like:

 if ($var == 'block_name') {
   $class_custom = 'my-custom-class';
 }

Is it possible?


texts: How safely allow untrusted users to use img tag?

texts: Following this question, I'm wondering how can I allow users of a social site (which obviously are not all trusted) to upload images while avoiding XSS threats?


texts: How to change line-wrap length on Drupal 6 Blog?

texts: I'm currently managing a Drupal 6 website which has a blog displaying about 155 characters per line. I'd like to set that to under 85 if possible. Is this buried somewhere in the menus or it is something I'm going to have to find in some php file?


texts:
I have this scenario:
The contenttype "event" has a date-field (with repeat-options). All repeating events are repeated for a certain timespan once a week.

I want to achieve this views-block:

Show me all repeating events (got this to work with condition
eventdate:rrule not empty).
Group by Event-Id and don't show me every repeating event (because
the description text of the event contains the human-readable
repeat-logic ... e.g. every tuesday at 12.00)

My Problem is:
I activated "Use aggregation" in the view and wanted to group the events by node-id, but the date field (field_data_field_event_date_field_event_date_value) is automatically added to the "GROUP BY"-SQL part when i do this (and i can't remove it)

Am I using the wrong approach?


texts: Fetching and rendering custom-library generated blocks in twig

texts:
I am using the following code in my theme to fetch 3 blocks (each containing 4 fields) generated via the custom block library interface i:e all 3  block are of the HomePage-Block type:

function legislation_research_theme_preprocess_page(&$variables, $hook) {
    for($i = 1; $i <= 3; $i++) {
        $block_entity = Drupal\block_content\Entity\BlockContent::load($i);// BLOCK_ID
        $block_view[$i] = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block_entity);
    }

    if ($block_view) {
        $variables['page']['my_block'] = $block_view;
    }
}

In my page--front.html.twig, my blocks output via:

    {{ page.my_block }}

However, the output is of the individual fields from each of the blocks rather than 3 divs containing 4 fields of content from each block. That's making it impossible to to style:

Can anyone advice how I might be able to output each block but contained in individual parent divs?


texts:
I am trying to center 3 images in a block I have created in my footer but
the images just won't center. I tried the wysiwyg editor's center button, but that did not work. I then tried to put in manual css which failed. I can't seem to get these images to center. I would appreciate any help.

Using:
    CKEditor    7.x-1.13

I tried adding a Bootstrap 3 "center-block" css class, but this does not work either.

© 2014 Environmental Law Alliance Worldwide (ELAW)

U.S. Office: 1877 Garden Avenue, Eugene, OR 97403 USA

Phone: +1 541 687 8454

Fax: +1 541 687 0535

Here is what displays:


texts: add product with special price to cart drupal7

texts:
I used the following code to implement "add to cart" in my tpl.php file, and it works fine:

$product=commerce_product_load($node->field_product['und'][0]['product_id']);
$line_item = commerce_product_line_item_new($product,1);
$line_item->data['context']['product_ids'] = array($product->product_id);
$show_quantity = TRUE;

$form = drupal_get_form('commerce_cart_add_to_cart_form', $line_item,$show_quantity);
print render($form);

Right now, it can only use its original price. However, I want to add this product with a special price to the cart and use this special price to checkout.

I have already created a "Price" field named "field_special_price", and if I use print_r($product), I can see its value and can use the value by $product->field_special_price['und'][0]['amount']


texts: Is there a replacement for comment driven?

texts: The comment driven module and similarly the comment alter module are dead or dieing and have no ports to drupal 7. Anyone know if there is a module that could replace either of these?


texts: How to use custom tokens in view header Drupal 8

texts: I make custom token which i use in view filter but now i want to use in view header.The custom token doesn't show in view header Global: Unfiltered text (Global: Unfiltered text) or how i make "Available global token replacements" to use in view header Global: Unfiltered text (Global: Unfiltered text). Thanks in advance.


texts: Why is Drupal 7 loading the wrong .js file?

texts:
There is a very strange bug that is happening on one of our client websites, and we have been unable to figure out what's going on. It's a tough one.

The Issue

In simple terms, Drupal is loading the wrong JavaScript file. We have a custom theme for the site. In the theme's .info file there is this line:

scripts[] = script/script.js

A couple of weeks ago we updated the .info file. The original .info file contained:

scripts[] = script/script-min.js

The script and script-min files are completely different files, and the server should be loading the script.js file.

Here is the behavior we are witnessing:

When we flush theme cache, Drupal reads in the .info file and loads script.js
After cron runs (every 5 minutes) Drupal will randomally decide to load script-min.js
If we check the database, the system table shows that Drupal has cached script-min.js

It should be noted that nothing in the code is loading script-min.js. We have grepped through and cannot find where Drupal would even be trying to load the file from. The script-min.js file exists in the script directory along-side the script.js file, but nowhere is it referenced.

Our Setup

Acquia Cloud Hosting w/ Git and PHP 5.3+
3 environments (dev, stage, production)
Production environment has two web servers, a balancer, varnish and MySQL. Web servers use Gluster file system to sync files
This issue does not appear to show up on our dev/stage servers

What we've tried

None of these fixes worked:

Rebuilding registry
Removing script-min.js file
Targeting web server IPs to rule out an issue with the dual-server setup
Clearing all caches
Clearing Varnish cache

Why we need help

We have been trying to diagnose this issue for nearly two weeks now, and we've run out of the obvious ideas. Our main theory right now is that their might be an issue with the two web servers, but from all of our testing, it doesn't appear to be the case... But does make the most sense.

We are aware that we could probably get the server to use the right JS file by just using drupal_add_js instead of the .info method, but we really want to know why the server is loading a file that we are not telling it to.

EDITS

These modules implement hook_cron() on the site:
acquia_agent,
acquia_spi,
ctools,
dblog,
field,
googleanalytics,
node,
scheduler,
system,
update,
xmlsitemap_node,
xmlsitemap,
xmlsitemap_engines

I have already checked, and during cron, the drupal_clear_js_cache, system_rebuild_theme_data, and drupal_theme_rebuild functions are not hit. My original assumptions had to do with those functions, but if they are not running during cron, they are probably not the issue.

We think the issue might be related to this bug report: http://drupal.org/node/1765812


texts:
In Drupal 7 we use valid_url, but what is the replacement in Drupal 8 for it?
I tried it but it the function is undefined. Finally I found the solution, see my answer.


texts: How to populate a managed file field with ajax

texts:
Problem

I have a large form with a select field tied to an ajax call. When an option is selected a large chunk of the form is rebuilt and a number of fields re-populate.

All the fields pre-populate correctly except for the managed file field.

The managed file field appears to load the image correctly (the thumbnail appears), but on submitting the form, the field empties. It hasn't actually loaded the file.

(And because the managed file field is required it then throws a "managed file field is required error")

How should you correctly pre-populate a managed file on an ajax call?

Example Code (what I have so far)

The field_one_int pre-populates correctly works,  field_two_managed_file is the problem.

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

   if($form_state['my_module_prepopulate'] == TRUE) {
      $form['field_one_int'][LANGUAGE_NONE]['#default_value'] = $form_state['values']['field_one_int'][LANGUAGE_NONE][0]['nid'];
      $form['field_two_managed_file'][LANGUAGE_NONE][0]['#default_value']['fid']
        = $form_state['information']->field_two_managed_file[LANGUAGE_NONE][0]['fid'];
      $form['field_two_managed_file'][LANGUAGE_NONE][0]['#default_value']['display'] = TRUE;
   }
   ...

   $form['ajax_field']['und']['#ajax'] = array (
      'callback' => 'module_ajax_function',
      'wrapper' => 'ajax-wrapper',
      'effect' => 'fade',
   );
   ...
}

function module_ajax_function ($form, &$form_state) {

  $form_state['my_module_prepopulate'] = TRUE;

  ....

  return drupal_rebuild_form($form_state['build_info']['form_id'], $form_state, $form);

 }

Other things ideas I've tried

I tried adding more information to mimic the array that exists in #default_value in a managed image file when a node is being edited. I loaded the file as an object converted it to array however this also doesn't work.

$ajax_logo = file_load($form_state['ajax_node']->field_company_logo[LANGUAGE_NONE][0]['fid']);
unset($form['field_company_logo'][LANGUAGE_NONE][0]['#default_value']);
$form['field_company_logo'][LANGUAGE_NONE][0]['#default_value'] = get_object_vars($ajax_logo);

File object loaded

fid (String, 4 characters ) 2933
uid (String, 1 characters ) 1
filename (String, 12 characters ) photo1.jpg
uri (String, 39 characters ) public://photos/photo1.jpg
filemime (String, 10 characters ) image/jpeg
filesize (String, 5 characters ) 19700
status (String, 1 characters ) 1
timestamp (String, 10 characters ) 1421110296
alt (String, 0 characters )
title (String, 0 characters )
width (String, 3 characters ) 230
height (String, 3 characters ) 230


texts:
I am able to add tabs in the Drupal 7 Main Menu however I want to adjust spaces between these tabs.How does one adjust spaces between tabs.

Thanks


texts: Drupal subscription membership with PayPal

texts:
I am trying to create a website which contains some premium content - What I need is when the user clicks on a subscribe button - he is redirected to the PayPal payment gateway - once his payment is accepted I want a "premium" role that I had previously created to get assigned to that user.

I used the paypal roles module - which seems tailor made for this. However, on returning from the PayPal payment form, the new role is not assigned to the user. Any suggestions with regards to how to solve this issue with this module or any other solution to implement the same?


texts: (solved) send mail with Rules when a term in multi value vocabulary is selected

texts:
Trying to get an mail-update when a tag is selected (if a node is inserted or updated).

The debug shows that 'till the second condition, everything is working fine. The second condition should be comparing if tid = 22 is selected. And i can't get this working ..

The name of the vocabulary is 'zichtbaarheid' (dutch for visibility).

{ "rules_vinkje_k_n_mail" : {
    "LABEL" : "Vinkje K\u0026N \u003E mail",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert" : [], "node_update" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_zichtbaarheid" } },
      { "data_is" : {
          "data" : [ "node:field-zichtbaarheid" ],
          "value" : { "value" : { "22" : "22" } }
        }
      }
    ],
    "DO" : [
      { "mail" : {
          "to" : "\u003Cfoo@bar.com\u003E",
          "subject" : "[node:title]",
          "message" : "[site:current-date]\r\n\r\n[node:body]",
          "language" : [ "" ]
        }
      }
    ]
  }
}

The debug shows

...
10.619 ms The condition entity_has_field evaluated to TRUE [edit]
11.293 ms The condition data_is evaluated to FALSE [edit]
...

=== EDIT ===

The correct config is as following.
Events: after saving new content & after updating

First condition (to 'load' the terms): [entity has field] > in Data
selector [node] & in Field the correct vocabulary
Second condition: [List contains items] > Data selector: node:[fieldname]. In next screen, switch to [direct input mode]. Terms should be visible in a dropdown-menu. Choose the right value

And the export is (you should alter some settings, like the name):

{ "rules_twee_vinkje_k_n_mail" : {
    "LABEL" : "TWEE Vinkje K\u0026N \u003E mail",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert" : [], "node_update" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_zichtbaarheid" } },
      { "list_contains" : { "list" : [ "node:field-zichtbaarheid" ], "item" : "22" } }
    ],
    "DO" : [
      { "mail" : {
          "to" : "\u003Cfoo@bar.com\u003E",
          "subject" : "[node:title]",
          "message" : "[site:current-date]\r\n\r\n[node:body]",
          "language" : [ "" ]
        }
      }
    ]
  }
}

(replace node:field-zichtbaarheid with your term-name, like field-tags)

And, as bonus to prevent recursion:
I've added the term 'mail send' in the vocabulary. This term is hidden, but updated with an action. When firing the rule, the second condition is now to check if the term 'mail send' is checked or not. If checked, the output is false and the rule is not further executed.


texts: Node title inside layout (Layout Discovery + Field Layout)

texts:
Just tried the new core modules Layout Discovery and Field Layout and I want to render the title of a node between two fields.
Without these modules, node's title can be rendered between other fields very simple by using inside node.twig.html something like:

{{ content.field_image }}
{{ label }}
{{ content.body }}

But when I try to use {{ label }} inside the registered layout template, nothing gets rendered. Can somebody help me?

Thank you in advance.


texts:
I have field in taxonomy term field_user which references to User.

At user own page (for example: user/1) I need to show taxonomy tree like this:
-user1 (this is the user whose page we are)
--user2
--user3
---user4
----user5
----user6
--etc

And if we are for example user4 page then:
-user4
--user5
--user6
--etc

It is not necessary to show current user at the tree, but it should show all terms under that user.

I'm using Views to trying to achieve this, but could not figure out proper settings for it. How to do this?


texts: Add field value in the value of another field

texts:
I'm sorry about the title (I think it's a bit confused :D) I can explain better what I need to do.
I have one product with several fields, among which: title,date, description, price, etc... I would add in a field (for example: description) a value of another field (for example: price). I would also that this setting is applied to content type because that field must always belong to the other field, for every content creation.

I searched on Google and it seems the module Token could be a solution but there are many tutorials (and also different among them), so could you help me. Are appreciated other solution, no just Token.
Thank you


texts: How to add a throbber to a submit button in a form?

texts:
In a custom module, I have a form with a simple submit button:
$form['submit'] = [
  '#type'   => 'submit',
  '#value'  => $this->t('Submit'),
];

As the execution of the code in submitForm may last for a while, I'd like to add a throbber to this button.
So I updated the code to:
$form['submit'] = [
  '#type'  => 'submit',
  '#value' => $this->t('Submit'),
  '#ajax'  => [
    'callback' => '::ajaxCallback',
    'progress' => [
      'type'    => 'throbber',
      'message' => $this->t('Be patient'),
    ],
  ],
];

and in my ajaxCallback, I have nothing as I just want the throbber to be displayed during the execution of the submitForm.
When I click the submit button, I get the throbber but no more validation of the form (validateForm) nor execution of the submitForm.
What am I doing wrong?
[Edit] I added
$form['#prefix'] = '
';
$form['#suffix'] = '
';

and updated $form['submit']accordingly
  '#ajax'  => [
    'wrapper'  => 'my_form_wrapper',
    'callback' => '::ajaxCallback',
    'progress' => [
      'type'    => 'throbber',
      'message' => $this->t('Be patient'),
    ],

and now it works!
But it adds another issue:
It breaks the default location of the messages (information, warning, error).
Now they are within the wrapper :-(

I tried with different themes and I have the same result.
Any idea why and how I can fix that?


texts:
I want to implement a functionality such that:
 The user registers on site and is sent an email (validation). Then he is taken to a page where hes is able to click on login form.

This was done using drupal's basic functionality. I had to change the message that was coming upon clicking onetime login page.(/user/reset/#hash)

I did it using hook_form_alter.

But it seems, that the text has been changed for the forgot my password link also.

Is there some way? May be I might have to create a separate page for the forgot password?

Thanks in advance


texts:
In a Drupal 8 site, on the page /admin/config/development/logging, I can specify if I want warnings, errors and other messages to be displayed. But either I want them displayed or not, they exist.

On this other page, admin/reports/dblog , I can see all the logs available in database.

But if my site has many visitors, Debug, Info and Notice logs are constantly inserted in the database. Which causes high charge on the database and "hides" the important logs (errors and warnings).

How can I tel Drupal "Do not insert in database any log with a severity level below WARNING" ? The equivalent of the level value we find in every logging framework.


texts:
I can't figure out why this module is not working. What is wrong with it?

/* hook_menu() */
function profilepage_menu() {
  $items['p'] = array(
    'title' => 'Profile page',
    'page callback' => 'profile_exe',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

  return $items;
}

/* Callback function */
function profile_exe($id) {
  $ar = array('uid' => $id, 'profilesload' => profile2_load_by_user($id));

  return theme('profilebuild', array('collected' => $ar));
}

/* Custom theme function. */
function theme_profilebuild($variables) {
  return "";
}

/* hook_theme() */
function profilebuild_theme() {
  return array(
    'profilebuild' => array(
      'variables' => array('profilesload' => array()),
      'template' => 'profilepage',
    ),
  );
}

The module is installed and a page called profilepage.tpl.php is in my theme directory AND in the module directory.

The output I'm expecting should be the text in the profilepage.tpl.php page along with the contents of the $variables array which I plan to use in my template.

However, when I open http://example.com/?q=p in my browser, the page loads without errors but the expected content is not there.

What am I doing wrong?


texts: Views insert current page node id to image link url

texts:
I want to create a block view of some content's image field. I am trying to insert current page node id to paths of image links. Because linked page is a entity form and I try to prepopulate node id in one of the field of the entity form.

How can write to current node id to URL with views rewrite results?
URL pattern like that. example.com/form?edit[field_whatisrefferaelid][und][0][value]=[currentpagenodeid]
Actually I am seraching for current node id token avaible in views block.


texts: Is there any way through which we can upload images from blocks in admin ? I have imce to upload pictures but if it was there in blocks it would be have been better , i saw many work arounds for this like creating a cck feild of image type then save it as view, instead is there any straight forward approach like upload module for nodes ?


texts: Updating from 7.34 to 7.35 after successfull update, drush status shows version 7.34?

texts:
Recently i tried to upgrade my site from 7.34 to 7.35 everything when successfully but when i go to status report or executing drush status command it shows that im still on drupal 7.34.

These are following screenshots: Result of drush up --security-only (same with drush up drupal)

And this screenshot shows drush status just after the update:

Any suggestions whats wrong?

Thanks in Advance
Tee


texts: How can I prevent "zend_mm_heap corrupted" when adding Views programmatically?

texts:
I have created a module that has 150 views added to mymodule.views_default.inc.

At first I could not get this to load as I was running out of memory. After increasing my memory to a sufficient limit, I now always get the error:

zend_mm_heap corrupted

Has anyone encountered this before while adding views to their modules?


texts: Processing the content generated by a node?

texts:
What call would I use to modify a node's content. For example, let's say I have the words "12345678" located in various nodes. If I wanted to replace all occurences of this in Drupal 7 with "abcdefgh", I could easily hack it in a template like this:

$content = str_replace("12345678", "abcdefgh", $content);
print $content;

This is probably very bad practice, but hopefully it will demonstrate that I just want to be able to replace the occurrence of any text with some other piece of text.

What is the best way to do that in Drupal 8?

UPDATE

I had a look at template_preprocess_node. But it looks like this will allow me to add more variables to the theme, but not to actually replace specific pieces of text.


texts:
I am using hook_apachesolr_exclude but its not working.I have created a custom field if that field is checked i want to exclude that node I wrote the given below code:

function a10_exclude_node_apachesolr_exclude($entity_id, $entity_type, $row, $env_id) {
    $result_node = node_load( $entity_id );
    if( isset( $result_node->field_exclude_from_search['und'][0]['value'] ) and $result_node->field_exclude_from_search['und'][0]['value'] == 1 ){
        return TRUE;
    }
    return FALSE;
}

even when i am writing die inside the hook, hook is not invoking.Please let me know how i can check the above hook is invoking or working.I have also tried the Apache Solr Node Exclude module, when i am checking the node to exclude it does not come inside the result but when again i uncheck the node same result come there and when i uncheck the two or more nodes they do not exclude from search result.


texts: How to create multi select list programmatically

texts:
How to create a multi select list in a custom module, populate values from taxonomy term and access the selected values when the form is submitted.

I have to code below for multi select list. I want to know how to access the multiple selected values from multi select list when the form is submitted.

function rice_graph_form($form, &$form_state) {
  $form['country'] = array(
  '#title' => t('Country'),
  '#type' => 'select',
  '#multiple' => true,
  //'#description' => 'Select a Country.',
  '#options' => rice_graph_get_terms('country')
  );
  if(isset($form_state['values'])) {
    $multivalues = $form_state['values']['country'];
  }
}


texts: How can I display an element only if any value has been selected from an entity select field?

texts:
I have a field on a webform (Drupal 8) that should be displayed only when a user has selected one or more options from an entity select field regardless which options are selected.
The available conditional logic options in webform do not seem to include such state. I have searched online and looked through the example_element_states.yml in the webform module and all select related examples specify a particular option value as the conditional logic.
Has anyone encountered and resolved such issue?


texts: Add external script in head after CSS loading

texts:
My question maybe is a little bit strange.
I have Drupal 7.x and i need to add in <head> a script to verify my adsense account:
<script data-ad-client="ca-pub-xxxxxxxxxxxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

I tried to use drupal_add_html_head (in template.php):
$adsense = array(
'#type' => 'html_tag',
'#tag' => 'script',
'#attributes' => array(
    'data-ad-client' =>  'ca-pub-xxxxxxx',
    'async' => 'async',
    'src' =>  'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')
);

drupal_add_html_head($adsense, 'adsense');

And works but not well because this script block Css loading, infact i should before load CSS and then add this script.
How can i solve this ?
Now some pages are without css
Thanks a lot !


texts: How do I print logic field on page--node.html.twig?

texts:
This code printing 0 or 1

{{ node.field_some_logic.value }}

I want he print NO or YES.

Somobody know, how to do this?


texts: Strange behavior with flexslider: Uncaught TypeError: $(...).flexslider is not a function

texts:
When I logged into a dev version of my site flexslider was broken. Rather than a slide show, I have the slideshow images repeating down the page in a single column . I get a js error in the console that reads Uncaught TypeError: $(...).flexslider is not a function in the jquery.min script.

I'm baffled because I don't recall changing anything, and another dev version of the site doesn't have the issue. The only thing I've done recently is zip the sites folder to move it to a test server which doesn't exhibit the issue.

From googling this is a jquery issue, but I'm at a loss to diagnose how to fix this.

Any help appreciated

EDIT: Not an issue of jquery versioning. Both versions of the dev site (on my local machine) and the live site are all using jquery version 1.5.

EDIT 2: Noticed an issue with my drupal install, specifically flexslider library wasn't there. So, I copied the library to the libraries folder, flushed caches, and still nothing.


texts: How to set an action to unpublish content containing some particular keywords?

texts:
I just enabled action module provided by Drupal core. There in configuration, I have chosen CREATE AN ADVANCED ACTION, and then choose "unpublish content containing keywords". I have entered keywords separated by comma but content still not get unpublished.

How this will work?

Note: I haven't added any custom functionality, nor did I use any contributed module. It's the default feature provided by Drupal core. I just enabled Actions module from the module list. My current version of Drupal is 8.2.4.


texts: Is it possible to add an "or" relation to a rule's event? I'd like to do exactly the same things when two different events took place. With an "or", I don't have to clone the whole rule.


texts: Need multiple url paths for single node without redirecting

texts:
I have the requirement on our Drupal 7 site where if we have a single node we need to be able to have multiple url paths to reach that node.

For instance lets say we have a node with id 1234
Currently we can create an alias for it:
example.com/my-custom-alias

and I can go to example.com/admin/config/search/path/add
and add a second url for this node with id 1234:
example.com/differenturl/my-custom-alias

but when I try to go to:
example.com/my-custom-alias

the browser redirects the page to:
example.com/differenturl/my-custom-alias

What I need is for both urls to resolve to the the same node and for the url to not change (or be redirected).

This is because we use Google Analytics and we need to know from which part of our example.com site our node/1234 is being accessed from.

Currently the only thing that Google Analytics will track is:
example.com/differenturl/my-custom-alias

and won't track:
example.com/my-custom-alias

Does anyone know how I can achieve this?


texts: Converting a content type into a Profile2 profile

texts:
I'm working on a site that's a user-contributed directory of local businesses. Each business that registers gets a user account.

I've thus far built the entire site using "Place" as a content type. However, in order to get users to contribute their listing as soon as they register (And to let the user easily edit that node), using Profile2 might make sense.

So, either one of two questions:

a. Is there any way of easily exporting a Drupal content type into something importable into Profile2?

b. Is there a way to get users to create a node just after or as they're signing up?

Thanks!


texts: Wysiwyg (ckeditor) disappeared after drush rr

texts:
I was restructuring the modules directory (moving modules from /sites/all/modules/ to /sites/default/modules/) because we are adding a multi-site and do not want to share all the modules.  After moving them I ran drush rr in the /sites/default/ directory and then drush cc all for good measure.

Everything went fine except that now on all of the content editor forms the rich text editors are all gone.  I can click "switch to plain text editor" and it works fine, but CKEditor is now completely gone.

I tried doing drush pmu ckeditor and then drush en ckeditor -y and cleared cache again but for some reason the rich text editors still appear completely blank.

I checked the chrome inspector console for errors and found that the site is still looking in the /sites/all/ sub-directories for the module.

/sites/all/modules/custom/custom_cke_plugin/ckeditor/custom_cke_plugin/plugin.js?t=DAED Failed to load resource: the server responded with a status of 404 (Not Found)

ckeditor.js?nviice:219 Uncaught [CKEDITOR.resourceManager.load] Resource name "nyuslink" was not found at "/sites/all/modules/custom/custom_cke_plugin/ckeditor/custom_cke_plugin/plugin.js?t=DAED".

Has anyone had issues with moving CKEditor module and found any resolution?


texts:
So I have a content type called MyContentType and two views: mycontents and mycontent/%.

mycontents shows all MyContentTypes with a pager. mycontent/% shows a single MyContentType based on node id.

How do I make it so when clicking on a content's header in mycontents (or any other way of displaying MyContentType) takes it through to mycontent/[nid]?


texts:
I am working with the module services 3 (D7) and I am calling the Drupal method from a Java client. I can login (and keep the session in the cookie) and I can create a simple node.

But I can't set a Node Reference Field.

To find the way to do it, I first looked to the node structure (with the reference field) in my drupal site:

 [field_presta_presta_suivi] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                        [nid] => 43
                    )

            )

    )

So, in my Java Client, I created a function to reproduce this structure:

public  static HashMap addReferenceField(String field, String language, String type_ref,Object value, HashMap node, int delta ){
        HashMap f = new HashMap();
        HashMap p = new HashMap();
        Object[] i = new Object[delta+1];
        HashMap val = new HashMap();

        val.put(type_ref, value);
        i[delta] = val;
        p.put(language, i);
        f.put(field, p);
        return f;
    }

This function is used to create a HashMap that will be add to the parameter of the service 'node.create'.

This function works with a User Refence Field (which has the same node struture), but when I used it for a node reference, the server returned "Not Acceptable".

I have already passed a lot of time on it and didn't find any example or similar case, so here my question:

How to you use services 3 (D7) to create a node with a node reference field ?


texts: How to (double) opt-in the user registration process before admins are notified for approval?

texts:
I was wondering if you can provide, with drupal core or any module, a double opt-in registration process.

Ideally, users who fill out a register form should receive an email with an opt-in activation link. Clicking that link, confirming their email, would it trigger the standard functionality of awaiting admin approval.

I tried LoginToBoggan but I'm pretty sure it does not provide double opt-in.

Is this implemented somewhere?

Edit: to prevent confusion: I know Drupal provides double opt-in for an "active user", but not for the registration itself. I would like users to verify that they want to register. Ideally:

Visitor enters their email to register
Visitor gets an email which he has to verify
After the link is clicked, the user gets created

How it currently is:

Visitor enters their email to register -> Blocked user gets created!
Either admin approves or user has to "double opt-in"


texts: Automatically making taxonomy terms children

texts:
Im using a taxonomy system that basically uses one long tag to describe items,
for instance apple-butter-cherries would be one term

Is it possible to make the term apple-butter a child of apple-butter-cherries upon creation?


texts:
I know this is my fault and lack of knowledge of php . Sorry about this .
I have a function in my template.php .

/**
 * Implements THEME_preprocess_node().
 */
function salamat_preprocess_node(&$vars) {

    if ($vars['node']->type == 'article') {
        // Remove Add comment link from teaser.
        unset($vars['content']['links']['comment']['#links']['comment-add']);

        // Remove login/register to comment link.
        unset($vars['content']['links']['comment']['#links']['comment_forbidden']);

  }
}

When i want to add a variable like &$variables to function , it does'nt work .

/**
 * Implements THEME_preprocess_node().
 */
function salamat_preprocess_node(&$variables, &$vars) {

    if ($vars['node']->type == 'article') {
        // Remove Add comment link from teaser.
        unset($vars['content']['links']['comment']['#links']['comment-add']);

        // Remove login/register to comment link.
        unset($vars['content']['links']['comment']['#links']['comment_forbidden']);
  }

    if($variables['view_mode'] == 'teaser') {

        $variables['theme_hook_suggestions'][] = 'node__'.$variables['type'].'__teaser';
        $variables['theme_hook_suggestions'][] = 'node__'.$variables['nid'].'__teaser';
        $temp = drupal_get_query_parameters();
        if(isset($temp['show_mode']) ) {
            $variables['theme_hook_suggestions'][] = 'node__'.$variables['type'].'__teaser__'.$temp['show_mode'];
            $variables['theme_hook_suggestions'][] = 'node__'.$variables['nid'].'__teaser__'.$temp['show_mode'];
        }
    }

}

Any advice ?


texts: Is there an existing D7 UI solution to control the content of emails sent by the system?

texts:
On most of the projects I am working on, I have set up several different emails with the HOOK_mail. On top of that you have the default user emails provided by Drupal.

What I am looking for, is an admin UI that would list existing emails and allow admins to edit their content. A bit like what you can do with the default user emails except that I want to be able to use the wysiwyg editor as well.

I started building something custom, but I wonder if there is already something out there. I guess the Message module could potentially do the trick for custom emails but I have never seen it implemented this way.


texts: Is it possible to add java script to webform?

texts:
I would like to have a field in module webform that uses javascript f.e that

 <script type="text/javascript">

var geocoder, location1, location2, gDir;

function initialize() {
    geocoder = new GClientGeocoder();
    gDir = new GDirections();
    GEvent.addListener(gDir, "load", function() {
        var drivingDistanceMiles = gDir.getDistance().meters / 1609.344;
        var drivingDistanceKilometers = gDir.getDistance().meters / 1000;
        document.getElementById('d1').value =+drivingDistanceKilometers;
        document.getElementById('twojadres').value = '' + location1.address;

    });
}

function showLocation() {
    geocoder.getLocations(document.forms[0].address1.value, function (response) {
        if (!response || response.Status.code != 200)
        {
            alert("Przykro nam, ale wpisałeś niepoprawny adres. Spróbuj ponownie!");
        }
        else
        {
            location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
            geocoder.getLocations(document.forms[0].address2.value, function (response) {
                if (!response || response.Status.code != 200)
                {
                    alert("Sorry, we were unable to geocode the second address");
                }
                else
                {
                    location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
                    gDir.load('from: ' + location1.address + ' to: ' + location2.address);
                }
            });
        }
    });
}

</script>

It use js to calculate distance between address which should be get from webform field.


texts: Master HTML inside a node using multilingual text

texts:
I'm using Drupal 7 .. Here is my issue :

I would like to

.. using a node to type HTML inside the body ... in which i include nodes bodies for eg

Body :

[nid:6:body]

So first of all how do we do that ?

And is it possible to use the t() function instead ? Like inside the BODY field of the node

t("Text whatever blabla")

So I can translate the content automatically ?

this HTML should be in a node that is translated to different languages but i would like to have a master node that if i change it .. it changed all the translated nodes ... like for eg i change the  above by a
 and this has to be changed automatically in all the translated nodes... how is that possible ?


texts:
I've been trying to hide the controlbar when the canvas is being shown (the video has't been started up) and show a controlbar once the video has been started up. (see below) Thanks in advance :)

here is how its now by default

here how I want it to looks like...


texts: VIews Proximity Search Fields as Separate Block?

texts:
Just a quick question, or if someone can point me in the right direction...

I have a website that needs to have a search field where customers can enter a service (e.g. photography) in one field, and a post code/zip code in the other so search for services near them.

To do this, I have  a content type for each service with addressfield, geofield and geocoder modules installed, and I have a view set up with an exposed filter criteria to filter the results.

This all works perfectly.

What I would like to do is have the filter criteria search in an external block at the top of every page (like the default drupal search block) that will show a list of results on a NEW page whenever a customer submits the form. Using my current method, I first have to direct customers to the page with the view on before they can search.

I experimented with the Search Configuration module (https://drupal.org/project/search_config) which lets you use the existing drupal search block, but can limit the results to only show one content type, which is perfect, but doesnt include the location post code field, and doesnt have the configuration of displayed results like views fields would do.

If anyone could offer up a bit of advice of where to go next I'd really appreciate the help.


texts: Programmatically get menu links filtered by language

texts:
In Drupal 8, I'm trying to get my menu which has translated menu item filtered by a given language.

So far, I was able to get my menu tree :

    $menu_parameters = $this->menuLinkTree->getCurrentRouteMenuTreeParameters('main');
    $menu_tree = $this->menuLinkTree->load('main', $menu_parameters);
    $manipulators = array(
        // Only show links that are accessible for the current user.
        array('callable' => 'menu.default_tree_manipulators:checkAccess'),
        // Use the default sorting of menu links.
        array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'),
    );
    $menu_tree = $this->menuLinkTree->transform($menu_tree, $manipulators);

But I still have "stand alone" links in both language.

I looked into manipulators and parameters, but couldn't see anything related to translation.

Maybe using MenuTreeParameters::addCondition, but i'm missing something here.

Any help would be greatly appreciated.


texts: Cancel user creation from hook_user_presave

texts:
I created a module that links to Taleo (Talent Management system). When creating a Drupal user, automatically a Taleo Candidate is made.

This works like a charm. But sometimes Taleo answers with an error (example: a candidate with email address info@example.com already exists)

Is there an easy way to cancel the creation of the user from within 'hook_user_presave'? Now the error messages is showed, but the Drupal user is made anyway.

function taleo_user_presave(&$edit, $account, $category) {
    global $client_taleo;
    $session = _taleo_login();
    $error = 0;

    if(!isset($edit['field_taleo_id'][LANGUAGE_NONE][0]['value'])) {
        // NOT LINKED TO TALEO

        $params = array(
            'in0' => $session,
            'in1' => array('id' => '', 'rank' => '', 'status' => '0-Available',
            'firstName'     => @$edit['field_first_name'][LANGUAGE_NONE][0]['value'],
            'lastName'      => @$edit['field_last_name'][LANGUAGE_NONE][0]['value'],
            'phone'         => @$edit['field_phone_number'][LANGUAGE_NONE][0]['value'],
            'zipCode'       => @$edit['field_zip_code'][LANGUAGE_NONE][0]['value'],
            'country'       => @$edit['field_country'][LANGUAGE_NONE][0]['value'],
            'textResume'    => @$edit['field_text_resume'][LANGUAGE_NONE][0]['value'],
            'lastUpdated'   => date('c'),
            'email'             => @$edit['mail'])
        );

        try{
            $edit['field_taleo_id'][LANGUAGE_NONE][0]['value'] = $client_taleo->__call('createCandidate', $params);
        } catch (SoapFault $fault) {
            $error = 1;
            $error_message = check_plain("ERROR: " . $fault->faultcode . "-" . $fault->faultstring);
            drupal_set_message($error_message);
            watchdog('taleo', $error_message, array(), WATCHDOG_ERROR);
            return array();
        }

    }


texts:
I am trying to build an AJAX popup for my custom built multi-step form using the form API. I have examined the module "Modal forms" and wondering if i should use that module or just create the AJAX functionality from scratch. Could someone one please give me an example of how I can add AJAX popup functionality to my form?

Here is an illustration of what I would like to achieve:

I have been looking at the Chaos tool suite module example:

ctools_include('ajax');
ctools_include('modal');

// Add CTools' javascript to the page.
ctools_modal_add_js();

// Create our own javascript that will be used to theme a modal.

I have found this code snippet. I am trying to get it to work in my module.

Here is the code I found

function redirect_custom_reg_menu_alter(&$items) {
  if (isset($items['user/register'])) {
    $items['user/register']['page arguments'] = array(
      'redirect_custom_reg_user_register_form'
    );
  }
}

function redirect_custom_reg_user_register_form() {
  $form = array();
  // Add the form fields for the registration form.
  // ....
  $form['name']['formtype'] = array(
    '#type' => 'radios',
    '#title' => t('form type'),
    '#options' => array(
       t('one form'),
       t('two form'),
       t('three form')
    ),
  );

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

  return $form;
}

function redirect_custom_reg_user_register_form_submit($form, &$form_state) {
  drupal_set_message(t('The form has been submitted. personal="@username"', array('@username' => $form_state['values']['username'])));
}

Here is the code from the modal example in Chaos tool suite module:

switch ($option) {
  case 0:
    drupal_set_message('patient');
    $form_state['redirect'] = 'patient/form';
    break;

  case 1:
    drupal_set_message('student');
    break;

  case 2:
    drupal_set_message('doctor');
    break;
}

Here is the example from the Chaos tools which creates a custom modal display:

Here is the code that I have extracted from the tutorial.
From the comment this seems to be used to theme the custom modal:

function ctools_ajax_sample_page() {
  $sample_style = array(
    'ctools-sample-style' => array(
      'modalSize' => array(
        'type' => 'fixed',
        'width' => 500,
        'height' => 400,
        'addWidth' => 20,
        'addHeight' => 15
      ),
      'modalOptions' => array(
        'opacity' => .5,
        'background-color' => '#246'
      ),
      'animation' => 'fadeIn',
      'modalTheme' => 'CToolsSampleModal',
      'throbber' => theme('image', array(
        'path' => ctools_image_path('ajax-loader.gif', 'ctools_ajax_sample'),
        'alt' => t('Loading...'),
        'title' => t('Loading')
      )),
    ),
  );

  drupal_add_js($sample_style, 'setting');

  // .....................
  // .....................

  // This displays the widget.
  $button_form  = ctools_ajax_sample_ajax_button_form();
  $links[] = l(t('Wizard (no modal)'), 'ctools_ajax_sample/nojs/animal');
  $links[] = ctools_modal_text_button(t('Wizard (default modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'));
  // .....................
  // .....................
}


texts: How to edit fields' values in the hook_node_load function?

texts:
In the hook_node_load function I want to alter a field's value.
I printed the node variable and got the following structure for the field:

    [field_myfield] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 1316760775
                        )

                )

        )

So I should write something like $node->field_myfield[und][0]['value'] = 'sth'. My site has 2 available languages, and [und] will be changed when language is changed.
How can I alter the field value for all languages?


texts:
My web hosting provider decided to use the suhosin php extension to protect my websites.

For some Drupal 7 sites, I am now getting tons of errors and can't login:

Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 675 of /home/reseller1/example.com/includes/bootstrap.inc).
Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 678 of /home/reseller1/example.com/includes/bootstrap.inc).
Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 679 of /home/reseller1/example.com/includes/bootstrap.inc).
Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 680 of /home/reseller1/example.com/includes/bootstrap.inc).
Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 682 of /home/reseller1/example.com/includes/bootstrap.inc).
Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 684 of /home/reseller1/example.com/includes/bootstrap.inc).
Warning: ini_set() has been disabled for security reasons in include_once() (line 300 of /home/reseller1/example.com/sites/default/settings.php).
Warning: ini_set() has been disabled for security reasons in include_once() (line 301 of /home/reseller1/example.com/sites/default/settings.php).
Warning: ini_set() has been disabled for security reasons in include_once() (line 309 of /home/reseller1/example.com/sites/default/settings.php).
Warning: ini_set() has been disabled for security reasons in include_once() (line 316 of /home/reseller1/example.com/sites/default/settings.php).
Warning: ini_set() has been disabled for security reasons in drupal_settings_initialize() (line 772 of /home/reseller1/example.com/includes/bootstrap.inc).

Is there an alternative bootstrap without those ini_set statements?
Can we put them on Drupal?


texts: How to stop nodes being automatically added to a simple queue in Nodequeue?

texts: I'm guessing my problem is a configuration error, but every kind of node that is allowed to be added to my (I only have one) simple nodequeue does get added to the nodequeue when a node of an allowed content type is created. I only want specified nodes to be allowed into the queue. Any ideas of where to look?


texts: Content Access for not showing specific Content types on Add Content page

texts:
I am new in Drupal. I have one simple query.

I am trying to create one Editor role for one website. Editor would be able to create, update and delete one specific content type "Documents".

I have given permission using ACCESS CONTROL and also I have checked in Permission page. It only has permission to add "Documents Content Type" but still when I login as an Editor and try to create new "Document Content", it shows all the content types. I want to hide other content types for Editor.

So basically it should show only "Document Content Type" for a user.

P.S. This is bit different question. So don't make it as duplicate question Pls.


texts: How to process a textarea as an html list?

texts: Is it possible to process a textarea line by line and turn it into an HTML list, and how would you go about it?


texts:
Im trying to create a view that will get the following:

Organic group: Name.
Organic group: Members.
Organic group: Number of published nodes.

Its sounds like an easy task but really it isnt.
I got really confused with the type of view, and theres much relationships to be done, And after adding aggregation the view gets huge and frustrating.

I was thinking about creating each one as a separated view and embedding them on a page, but that might sound bad.

UPDATE
here is whats expected of the view to produce.

Organic group: Group A.
Organic group: X, Y, Z.
Organic group: 3 open tasks.

Organic group: Group Alpha.
Organic group: Alpha, Beta, Gamma.
Organic group: 0 Open tasks.

Organic group: Power rangers.
Organic group: Green dude, White dude.
Organic group: 15 open tasks.

Tasks being the content type that belongs to an OG.
Any help is greatly appreciated.


texts: What is the difference between a Drupal session variable and a cookie?

texts:
When you set a Drupal session variable (i.e. a "magic" variable you may set like this):

$_SESSION['mymodule'] = array('key' => 'value');

the value goes away when the user logs out.

If you set a cookie, using the function

user_cookie_save(array('key'=>'value'))

the value saved survives the user session.

However, I wonder if they just two of a kind (i.e. a Drupal session variable is just a cookie, but with the lifetime restricted to the duration of a the session.

Or is a Drupal session variable not implemented using a session cookie?


texts: I work on D8. I Create to custom block with display content and Read More option. The URL alias is about_us of node/2,  I want to add read more link with node/2 and show about_us on URL.


texts: How to securely access the data from another Drupal instance?

texts:
I have a site setup which feels fairly unconventional so please bare with me while I try to explain.

I have 2 Drupal sites based on different servers.

The main site (site A) contains the front-end site and holds user data. The second site (site B) is our internal system and has 2 databases. This is a standard Drupal db and a db that contains other customer data (e.g. sales information, downloads and product info etc).

When a user logs in to their account on the main site, I need to be able to access information on the second database and display this to the user.

I know I can do this without using Drupal with a mysqli statement. However, I need to be able to access this information securely via SSL.

I have very little knowledge of encryption so my initial thought was that if both sites had SSL, the information received would be sent encrypted when using mysqli. However, I think I am very wrong.

My next thought would be to request the information via the second Drupal site perhaps via an API of some sort. However I'm not sure this would offer any more security or if I have missed the point entirely.

Would anyone be able to advise me on the best way access this information please?


texts: Site broken with "Call to undefined function entity_get_info()"

texts:
I am working on a module that uses a custom entity built with eck. I got the white screen of death while making changes to a function. I completely commented the function I was working on when it started. But the white scren persists. /var/log/httpd/error_log reports "Call to undefined function entity_get_info()"

I can only avoid the error by disabling the entity module. (Then the site works normally.)

How can I fix this?


texts: How to make submenu for tabs in Zen subtheme?

texts:
I'm working on my first subtheme for Zen and ran into a problem. The main menu is being display via tabs. Everything shows up fine, but I have no clue how to allow submenus (or dropdowns, whatever you like) for the items.

Here is how the links are being added to the menu from modules:

$items['node/%node/jobs'] = array(
'title' => 'Jobs',
'page callback' => 'job_applications_form',
'page arguments' => array(1, 'node'),
'access callback' => 'job_applications_user_access',
'access arguments' => array('custom_site_owner', 1),
'type' => MENU_LOCAL_TASK,
'weight' => 100,
);

And here is the code from template.php in Zen that converts the menu items to tabs;

function _menu_local_tasks_output($level = 0, $return_root = FALSE) {
static $tabs;
static $root_path;

if (!isset($tabs)) {
    $tabs = array();

    $router_item = menu_get_item();
    if (!$router_item || !$router_item['access']) {
      return '';
    }

    //kpr($router_item);

    // Get all tabs and the root page.
    $result = db_query("SELECT * FROM {menu_router} WHERE tab_root = '%s' ORDER BY weight, title", $router_item['tab_root']);
    $map = arg();
    $children = array();
    $tasks = array();
    $root_path = $router_item['path'];
    $count = 1;
    $paths = array();
    while ($item = db_fetch_array($result))
    {
        //kpr($item);
        _menu_translate($item, $map, TRUE);
        if ($item['tab_root'] != $item['tab_parent'])
        {
            //do nothing
        }
        // Store the item for later use.
        elseif($item['access'])
        {
            if($item['title'] == 'Map Category')
            {
                //do nothing
            }
            elseif($item['title'] == 'Edit')
            {
                //do nothing
            }
            else
            {
                $tasks[$count] = $item;
                $count++;
            }
        }
    }
}
//kpr($paths);
//kpr($tasks);

return theme(array('links__system_main_menu', 'links'), $tasks,
            array(
                'id' => 'main-menu',
                'class' => 'links clearfix',
            ));

}

And finally, the code in page.tpl.php that actually outputs the tabs:

echo '';
echo '
Navigation
';
            if($primary_links == 'tabs')
            {
                echo $tabs;
            }
        echo '';

So, my question is simply this: how can I make it so that when I mouse over Jobs on the menu, a sub menu pops down with different categories? I tried the nice menus module and got it to work with the Primary Links set in the admin panel, but this tabs menu is dynamically created (for each node) by menu hooks in each module.


texts: Is it possible to cancel a delete request for a node or media item?

texts:
I am trying to create a soft delete method and I was hoping to manipulate cores delete method. The plan was to set a flag on the entity to say that it had been deleted and gets moved to a new page for approval before permanently being deleted.

I am aware there are several contrib modules out there but they are either only in beta or don't quite do what I wanted.

I have been trying to use hook_entity_pre_delete() to set this flag, but I am unable to then cancel the request to delete the entity.

Does anyone have any bright ideas?


texts: How to create a list of vocabulary names for a widget?

texts:
I would like to create a customizable filter widget that can be used to filter a view on a page.  One type of filter uses taxonomy terms. While I can easily create a list of terms, I find I cannot create a list of vocabulary NAMES to choose from for the filter.

Ultimately, I'd like to iterate through the terms of the chosen vocabulary name and display that list of terms.  So, in summary, create a widget that users can choose from a list of vocabulary names.  Once that is selected, display the list of terms of that vocabulary name on the page.  Is this possible?

I've tried so many different ways using views, entity references, etc but cannot get a list of vocabulary names in a field.


texts: Dynamically create fields based on integer value

texts:
I have a requirement that I need to dynamically create x number of fields based on a supplied int value from a text box.

Example: There is a software content type. A user goes to add a new piece of software into the system. They received 11 keys/licenses with their purchase. The users enters 11 into a textbox, and then 11 license key fields display. The users enters in the 11 license keys and saves.

Hopefully that makes sense? Just looking for help deciding which fork in the road to take..