texts:
I've been developing this phonegap app and I'm stuck with a few things and one of them is multiple checkboxes - I hope you can help.

I've got the below code

HTML

<input type="date" id="date" />
<input type="hidden" id="hidden">
<fieldset id="oyuncuKategori">
    <legend>Kategori</legend>

        <input type="checkbox" id="oyuncu" name="kategori" value="oyuncu" class="squareTwo" />
        Oyuncu

        <input type="checkbox" id="yardimci_oyuncu" name="kategori" value="yardimci_oyuncu" class="squareTwo" />
        Yardımcı oyuncu

        <input type="checkbox" id="cocuk_oyuncu" name="kategori" value="cocuk_oyuncu" class="squareTwo" />
        Çocuk oyuncu

        <input type="checkbox" id="stand_hostesi" name="kategori" value="stand_hostesi" class="squareTwo" />
        Stand hostesi

</fieldset>

JavaScript

$("input[type='date']").on("change", function () {
    // var checkbox = $("#oyuncuKategori").serialize();
    var checkboxes = '';
    $('input[name=kategori]:checked').each(function(i, e) {
        checkboxes += '&node[field_kategorisi][und][value]='+$(this).val();
    });
    console.log(checkboxes);
    monthNames = [
        "Oca", "Şub", "Mar",
        "Nis", "May", "Haz", "Tem",
        "Ağu", "Eyl", "Eki",
        "Kas", "Ara"];
    date = new Date($("input").val());
    day = date.getDate();
    monthIndex = date.getMonth();
    year = date.getFullYear();
    finalDate = day + ' ' + monthNames[monthIndex] + ' ' + year;
    $.ajax({
        url: 'http://www.rejicast.com/services/node.json',
        type: 'post',
        dataType: 'json',
        data: 'node[type]=oyuncu&node[title]=testnomikos456&node[language]=und'+ checkboxes +'&node[field_dogum_tarihi][und][0][value][date]=' + finalDate +',
        success: function (data) {
            console.log(JSON.stringify(data));
        },
        error: function (xhr, status, message) {
            console.log(xhr);
            console.log(status);
            console.log(message);
        }
    });
});

The thing is, this code works for creating a node but and inserts values for field_kategorisi overwriting other values, thus always the last checked box is there, while trying with [und]['+i+'][value] gives me 406: An illegal choice has been detected. Please contact the site administrator. and something like Illegal choice Array in field_kategorisi (I don't remember the English wording) on the server side. I'm really stumped. Can you give me any ideas?

UPDATE: When I make an ajax call, my POST looks like this.

  http://www.rejicast.com/services/node.json?node[type]=oyuncu&node[field_kategorisi][und][0][value]=stand_hostesi&node[field_kategorisi][und][1][value]=yesilcam


texts: Access from different Network, one allow admin roles the other not

texts:
I have a Drupal 7 site on a server wich can be accessed by 2 differents Network (A and B).
On both Network I use SAML to authentificate the users and affect them their roles (including back office roles) with SAML attributes.
When an user logs in from network A to my site he must have his back office options but when he logs in from network B he must not have them.

I want to block any administration feature, not just back office access so blocking urls will not be enough.
I don't want to see the edit/view tabs on content in the front office.
I don't want them to have access to content that is not published (even if they have access to it on network A).
Like the users had no back office role at all when they are on network B.

I am able to detect wich network the user is using on each visit and I have some code that allows me to affect the back office roles only if he comes from network A.

But if the user logs in first on network A then on his mobile access the site from network B and logs in he will lose his back office role on A unless he logout/login again.

Is there a way to disable all back office (admin) features on each visit if coming from network B? And not on each login? Aka a solution not involving removing his back office roles so he keep them when on network A.


texts:
I have the following code to load a different node into my homepage:

<?php $node = node_load(2); ?>

      <button class="close" data-dismiss="modal">×</button>

<?php echo $node->title; ?>

      <?php render( $node->content ); ?>

      Close

The title displays, but the content doesn't. I get the error Notice: Undefined property: stdClass::$content in include()

Based on what I read here I feel this should work. What do I need to do to make the node content display? (it's just a basic page w/ title and body)


texts:
This is the error I am suddenly getting.

Additional uncaught exception thrown while handling exception.

Original
PDOException: SQLSTATE[70100]: Unknown error: 1317 Query execution was interrupted...my query

Additional
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away...my query

After doing some research it sounds like a custom module, which I have made, is attempting a query which is too big. A solution that seems to work for a lot of people is this:

Open my.ini
Change "max_allowed_packet" from "1m" to "16m" (or larger)
Save my.ini and restart MySQL

However, I am on a shared server, so I cannot edit my.ini, and although my provider has confirmed to me that the value is set to 1M, they won't increase it.

I also tried adding this: ini_set('mysqli.reconnect', 'on'); to settings.php. It didn't solve the problem.

Does anyone know of a another solution, or work around?

Thanks.


texts: MiniOrange SAML SSO Drupal Module – Multilanguage Support

texts:
This is my first post at Drupal StackExchange. Please feel free to redirect it to the proper forum if this is the incorrect one.

How do I configure Apache Server so that MiniOrange SAML SSO Drupal module does not conflict with my Drupal multilanguage settings?

Here is my problem:

I determine the language from the URL as a Path prefix:

URLs like https://example.com/en/contact set language to English (en) - Default

URLs like https://example.com/fr/contact set language to French (fr)

My default language is English.

If I configure my Drupal multilanguage settings to other detection methods such as session, user, browser then the SAML SSO Drupal module works fine but some (not all) of my Clean URLs no longer work with my current modified Drupal and Apache settings. I’d like to retain my multilanguage settings.

All this happens because of the SAML Drupal module ACS, Recipient and Destination URLs are configured in such a way that the language negotiation happens before reaching the ACS, Recipient and Destination URLs.

ACS URL https://example.com/?q=samlassertion

Recipient URL https://example.com/?q=samlassertion

Destination URL https://example.com/?q=samlassertion

Drupal then prepends the default language code, English (en) in my case, to the ACS, Recipient and Destination URLs as follows breaking the module.

ACS URL https://example.com/en/?q=samlassertion

Recipient URL https://example.com/en/?q=samlassertion

Destination URL https://example.com/en/?q=samlassertion

I know Apache Server 2.4 very well but by no means I’m an expert. I strongly believe this issue can be fixed with a simple and magic Apache configuration set of rules.

What I've done to fix all these issues is by restructuring my existing Drupal Clean URLs to work with the SAML module by using other detection methods such as session, user, browser and by creating rewrite rules to redirect existing URLs to the new structure. I wish I could say that I have completely and 100 % fixed all the problems. But that’s not the case. As I mentioned, some of my URLs break.

Any help is greatly appreciated.

Thanks,


texts: Using user role information with hook_user_logout()

texts:
I want to give users a custom logout message based on their role, but on logout the $user variable is no longer available.

How can I achieve this?  I figured the key might be with $_SESSION, during login, but I am not sure exactly how to store user role in the session.


texts:
I assumed that, since migrate is now in core, migrating nodes from a Drupal 8 site to another Drupal 8 site would be baked in. However, it seems not so.

I have already exported all the node configuration: fields, storage, etc. How can I get the actual node content from a Drupal 8 site to another Drupal 8 site?


texts: Is it possible to force redirection from PayPal to the website after successful payment?

texts:
I'm using PayPal WPS with Ubertcart, and want to track the conversions using Adwords.

Is there any way to force true redirection back to the website within Ubercart?
The redirection in PayPal settings is already set to "On", however the users are still being asked to click to go back, or proceed to their PayPal settings page.

This results in losing the conversions.

Any ideas how to force the clients back directly to the website via Ubercart / custom module?

Thanks!


texts:
I enabled SSL over all my pages in order to increase security, and I kept receiving "Access Denied" Pages.

However, using google PageSpeed Tests, the page now has two redirects:

http://arpbookstore.com/cemevents
http://arpbookstore.com/cemevents/
https://arpbookstore.com/cemevents/

How do I avoid having multiple redirects using drupal when enabling SSL via .htaccess redirect?


texts: How can I add meta tags for pages created with views in Drupal 8?

texts:
I need to add meta tags for pages created using views in Drupal 8, I tried to use Metatag module. but it seems like there is no views integration on D8 version of this module. I also tried to install Meta tags Quick but it's not working!

is there any other alternatives? please advice.

Edit: I've already seen the answers for this previous question but all of them are recommending using the modules that I've already tried: Metatag currently doesn't support adding meta tags to pages created with views, and Meta tags quick doesn't work with current Drupal version 8.0.5


texts: During migration D6->D7 I get an error message "Integrity constraint violation"

texts:
I use Migrate and Migrate_D2D in my process of migrating from D6 into D7 and I get this message for each an every node when using "MigrateFileUri":

    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://instrument/instrumentbilder/63379742-s_1.jpg' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri … and so on…

The strange thing is that on another computer with the same development environment (WAMP) most of the nodes are imported without problem with exactly the same code. Something must be different though… Some mysql setting in WAMP maybe?

I have searched for the "duplicate files" in the table "file_managed" and I can confirm that these files are not present in that table. So the duplication must happen during the import. For some reason the node must be saved twice?

I should mention that when importing all files in a separate migration and using MigrateFileFid as file class, there is no problem. The thing is that I need to use urlencode to clean file names and also I want to decide where different files from different node types are to be saved (different destination_dir for different file types), and as far as I understand those options are not available with MigrateFilFid.


texts:
I am trying to create a field  in hook_install() using the
following code.

$field = array(
  'field_name' => 'unit_count',
  'type' => 'text',
  'cardinality' => FIELD_CARDINALITY_UNLIMITED,
);

field_create_field($field);

$instances = array();

$instances['unit_count'] = array(
  'field_name' => 'unit_count',
  'label' => $t('unit_count'),
  'description' => $t('unit_count'),
  'widget' => array(
    'type' => 'text_textfield',
  ),
  'required' => TRUE,
  'settings' => array(
    'text_processing' => 0,
  ),
);

foreach ($instances as $instance) {
  $instance['entity_type'] = 'node';
  $instance['bundle'] = 'first_example_bundle';
  field_create_instance($instance);
}

I am getting the following error:

  Notice: Undefined index: id in field_create_field() (line 173 of /Library/WebServer/Sites/Dev/Public/Peirce/modules/field/field.crud.inc).

What is wrong with the code I am using?


texts: Rule to update referenced node after customer completes checkout

texts:
I've got a rule which fires on "Customer completes checkout".

When it fires I would like to update a field in a node which is related to the one which was "checked out".

The node which is "checked out" has an entity reference field which relates it to another node, of a different content type.

So I have my Rule Event: "Customer completes checkout"
And the condition: "Entity has field" which checks for the entity reference field

Under Actions, I have: "Fetch entity by ID" to fetch the referenced node.
And I have provided a "Variable name" for the Fetched Entity.

I know this much works because I can print the Title of the referenced node as a status message on the site at this point. I can even print the contents of the field that I want to update using the token [the-fetched-node:field-name]

But when I add an Action: "Set Data value" and look for the field to update, the-fecthed-node:field-name is not available.

I can see things like the-fetched-node:body and the-fetched-node:title, but none of the fields of the node seem to be available to Set Data values on...

How can I get access to set the data in my required field?

I'm using the Rules (7.x-2.9) and Ubercart (7.x-3.9) modules.


texts: How to get the field values with EntityQuery?

texts:
I am working on a query filtering form that lists entities. I have various 'range' fields and I would like to display the min and max values. Is it possible to retrieve field values with EntityQuery?

For example I want to filter nodes whose NIDs are between 10 and 50 but I would also like to see which NID is the lowest and which is the highest so I can change my input accordingly.

Or better, imagine a commerce product price. I would like to see products whose price is between 10€ and 50€ but I would like to see what is the range that I can operate with(ie. from 0.99€ for the cheapest product, up to 150€ for the most expensive product).

I am thinking that with EQ this is possible only by having two queries - one for the min value and one for the max value, sort it by desired field, load a single entity and retrieve the value from the entity object. This solution is very ineffective(< performance) and since I am already using EQ I don't want to move back to basic queries just for this since that would make EQ obsolete for me.


texts: Theming links in blocks using twig templates

texts:
I have a block for the language switcher. I want to override the links in it. I can override a specific language switcher block's markup, and I can override the links markup in all language switcher blocks, but I can't override "$links markup in language switcher block delta 1".

Do I have to use a template suggestion to do this? If so, how should I approach this? With the core templates, I've tried to dig down with: blocks, into links, but only get as far as {{ content }}; and go up with  links into blocks, but I can't be specific and target a block that way.

Current templates I've got:

block--languageswitcher.html.twig (targets block with delta 1, but can't theme links)
links--language-block.html.twig (targets links in all switchers, unspecific)

Use case: Specifically, I'm trying to override the switcher so I can have country codes in an inline list instead of country names in an unordered list. e.g. EN | FR | IT
Obviously, I could overwrite all the switcher blocks but it doesn't seem right; it's certainly inelegant.


texts:
I have a sample site running Drupal 8.1.x, I want to add icons to the taxonomy term.

Example.

I have a term called Animals with the following list in it

Cats
Dogs
Fish

i want to assign an icon for each terms, a picture of a cat for Cats and so on and will be using it as exposed filter. So i want the pictures/icons instead of the the words Cats - Dogs - Fish.

I have looked into template_preprocess_field(&$variables, $hook). I dont know how to go about it, also tried assigning an image filed for each term but the pictures are not showing up on the exposed filter menu.

Please help.


texts:
I'm new to drupal, so forgive me if my question will be silly :)
I've a little problem with my first custom content on a drupal 6 installation. My content "biography" is listed in admin/content/types page, but when i click on my type, page reloaded instead of loading /admin/content/node-type/biography

If i force the url in the browser, i'll be redirect to /admin/content/types page again.

Do you know why? I've implemented both the node_info and form hooks, but with no luck.

Thank you in advance and sorry for my english! Have a nice day!

UPDATE

I cant reply on my own post because i still have low reputation, but...

Bingo..Thank you ARUN! I had been deceived by the fact that it had appeared in content type's list without clearing cache!

have a nice day!


texts: Module Views automatically replace underscores in css classname to hyphens?

texts: The situation is like this: I created an article list block with Views, and I want give the list row a custom css classname, ex it's called "focus_img", but when I saw the output, "focus_img" was converted to "focus-img" automatically. How can I turn off this annoying feature? I don't get it, why it made this change, I just need it output what I want..


texts:
I want override the region default template. I did that with a hook theme from my module.
I want override the region custom template but only for the front page. How can I do that?


texts:
I'm working on an existing Drupal 8 site. I'm changing anything in routing.yml.

In a routing.yml file I have the following.

user_profile_update.callback:
  path: '/user-update'
  defaults:
    _controller: '\Drupal\user_profile\Controller\ProfileUpdateController::updateUser'
  requirements:
    _user_is_logged_in: 'TRUE'
    _permission: 'access content'

I want to change the controller's method to
\Drupal\user_profile\Controller\ProfileUpdateController::updateUser123(), but after editing the route definition, the ProfileUpdateController class is still using the updateUser() method.

I removed all the cache tables from the database with the following SQL, but the controller is still not using the updateUser123() method.

TRUNCATE cache_config;
TRUNCATE cache_container;
TRUNCATE cache_data;
TRUNCATE cache_default;
TRUNCATE cache_discovery;
TRUNCATE cache_dynamic_page_cache;
TRUNCATE cache_entity;
TRUNCATE cache_menu;
TRUNCATE cache_render;
TRUNCATE cache_toolbar;

How can I fix the issue?


texts: How to Embedd youtube video in body field (converts URLs into embedded players)?

texts:
Is there a simple way to insert youtube video in body field like other CMS where you copy a youtube link in the article body and it is automatically converted into a video player in front end.

I’ve search here and some topics talk about modules but there are not drupal 8 yet.

Is there a module that can do that or Drupal 8 maybe can do that natively ?


texts: Get a node using the same category (taxonomy term) the current node is using

texts:
I have two types of nodes: News and Page.
Every News node can be assigned to a category (taxonomy term), which is used also from the Page nodes.

I would like to get in a view all the News nodes that have the same category the current node has.

How can I achieve this?


texts: Drupal content type node not overwriting the default node.tpl.php

texts:
I have a content type with a machine name of 'school' after reading the documentation I should be able to just create a node-school.tpl.php to toy with the output of this in my theme.

Yet it does not seem to be overwriting it. I am trying to hack something together and I am using the twitter bootstrap Drupal theme.


texts:
I am using the Date module together with a view to display dates, and I need to get the date timestamp. The problem is that $fields['date_in_timestamp'] content comes wrapped in HTML.

<span class="date-display-single"> 1468473300 </span>

I need only the value and no HTML.

PS: my field "date_in_timestamp" will apply a "U" format for the timestamp.

One possible way I found is described in https://www.drupal.org/node/423870, comment #9. The problem is that this applies to all those who have a certain format, and I don't know how to distinguish them from other similar formats.

Is there any way to get the machine name of the date format?


texts: How to backtrace a variable in php template

texts:
Currently I am in a .tpl.php file, and have the following piece of code:

  <?php if ($rows): ?>

    <?php print $rows; ?>

  <?php elseif ($empty): ?>

    <?php print $empty; ?>

  <?php endif; ?>

It seems extremely difficult to figure where the $rows variable comes from. Any good idea?


texts:
I have a Drupal 8 site using the OpenSocial profile. It's a social profile and users can follow other users. This is implemented using the Flags module.

In the site, I created a view for users to see contents of the users they are following and it uses  a relationship to user entity, and lists the content of user flagged by the current users.

As the site the content differs for each users, it can't be cached. What will be the best way to scale in this case? Is there a different method to follow other than a relationship?

Is there a way we can use a search_api based index view for this purpose?


texts: Simplenews automatically send out email notifications when new content is published

texts:
I'm trying to figure out a way to allow anonymous users to subscribe to my blog and receive email updates whenever I publish new content.

I've tried a couple of solutions, but none of them seem to work the way I would like them to. This page (http://drupal.org/node/983184) says that I should be able to use Simplenews to do it, but I can't figure out how.

That module seems to be based around creating a Newsletter content node and which gets sent to the subscribers. However, what I want to do is post a new Article and have the system automatically send an email to all my subscribers containing something like a Teaser.

At the least, I'd like to send a simple email with the Content Title and a link to the node.

How do I configure Simplenews to work like this?


texts: Change picture module image style programmatically

texts:
I am using Views, display suite and picture module to display a page containing products (teaser) and I have 2 layouts: with 3 columns and with 6 columns.
Based on the layout, I want to change the image style (I have 2 image styles... say "Product thumbnail small" and "Product thumbnail large"), so the images are bigger when using the 3 columns layout and smaller when using the 6 columns layout.

I tried using hook_picture (the code below) to alter the picture array and use the original theme_picture function to render the image, but it seems it has no effect.

I also tried to change the image style from the ds page for the teaser, but again, it has no effect.

function vine_picture($item)
{
    if ('product_thumbnail' == $item['style_name']) {
        static $view;

        if (empty($view)) {
            $view = views_get_current_view();
        }

        if (!empty($view) && 3 == $view->style_plugin->options['columns']) {
            $item['breakpoints']['breakpoints.theme.vine.medium']['1x']['image_style'] = 'product_thumbnail_large_breakpoints_theme_vine_medium_1x';
            $item['breakpoints']['breakpoints.theme.vine.small']['1x']['image_style'] = 'product_thumbnail_large_breakpoints_theme_vine_small_1x';
        }
    }

    return theme_picture($item);
}


texts: How do I access node body from template.php?

texts:
Here is my code so far:

if (!empty($page['content']['system_main']['nodes']) && is_array($page['content']['system_main']['nodes'])) {
    foreach ($page['content']['system_main']['nodes'] as $nid => &$content) {

        // Blog
        if ($content['#node']->type == 'blog') {
            $description = ???;
        }

    }
}

I can't figure out how to access the node's unformatted body field, I can't believe it's so difficult to achieve such a simple task..


texts:
I'm using ajax to submit core's user_login_block which is displayed in a popup. I'm using ajax_command_replace to show the error message if login fails. (If login is successful, I reload the page.) For some reason, it doesn't run and the error message doesn't show. Any reason why? Or is there a better way to show the errors via ajax response?

In my hook_form_alter

$form['#prefix'] = '
';
$form['#suffix'] = '
';
$form['#submit'][] = 'my_theme_login_block_submit';
$form['actions']['submit']['#ajax'] = array(
  'wrapper' => 'form-login-popup',
  'callback' => 'user_login_submit',
);

And in my_theme_login_block_submit

$commands = array();

$messages = drupal_get_messages(NULL, FALSE);

if(!count($messages) || !isset($messages['error']) || !count($messages['error'])) {
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  $commands[] = ctools_ajax_command_reload();
  print ajax_render($commands);
  drupal_exit();
}

$commands[] = ajax_command_replace(NULL, theme('status_messages') .   render($form));
return array('#type' => 'ajax', '#commands' => $commands);


texts: This is all weird, I am unable to open the modules page, I don't understand why. I am trying to update the drupal so disabled some of the none core modules and pressed on save configuration.And now I am unable to open the modules page.Any help is really appreciated.


texts: Attaching files from a Private folder with Mandrill

texts:
I have working code that will send attachments programmatically through Mandrill .

I'm changing the folder to 'private' now ; since doing so the attachment doesn't work.

this is what the code was

$cvpath = 'sites/default/files/cv/'.$cv_filename;

$message['attachments'][] = drupal_realpath($cvpath);

this stopped working .

I've tried

$cvpath = 'private://sites/default/files/cv/'.$cv_filename;

$message['attachments'][] = file_create_url($cvpath);

but this didn't work.

The email send with no errors, but also no attachment.

On testing the file_create_url creates a full url like 'http://example.com/system/files/filename.php'

the folder 'system/files' doesn't exist.

In administration > config > media > file system

for private folder I have.

/sites/default/private-folder

Any ideas on a way around getting mandrill to send from a private folder welcome.


texts:
Sorry for asking such a question, but I'm still new in Drupal. I want to show sub menu via main menu.

Ex:
- Top menu
1) Home
  a. Report
  b. Comment
2) Shopping
  a. Audi
  b. Honda

In this case, I would like to see 'a. Audi, b. Honda', or go back Home and see 'a. Report, b. Comment'.
What should my module's hook_menu implementation look like ?


texts: Duplicate value fields when creating relationships field collection of views

texts: I have a problem need help. I created one field collection (unlimited value) for content type. Then I create 1 views to ren value fields in tables. I created relationship field collection for the that views and have a problem that the fields of the node duplicate value by the number of the field collection values. How can I remove duplicate of the field value in that content type.


texts: How to troubleshoot an Ajax HTTP Result Code 200 Error?`

texts:
I am receiving the following Ajax error when on any Views page. The Drupal logs (/admin/reports/dblog) don't have any corresponding events. I've tried disabling all custom and view related modules and adjusting jQuery versions with no success.

I'm running Drupal 7.57-dev and Views 7.x-3.18

I know there are several other questions about this error but their solutions are specific or not relevant to this specific response text.

How do I begin drupal shooting this error?


texts: drupal_add_js is adding .js file to footer despite me adding 'scope' => 'header'

texts:
I want to add an external file to the header. To that affect I copied what others have done and used drupal_add_js();:

  drupal_add_js('somefile.js', [
    'type' => 'external',
    'scope' => 'header',
    'defer' => TRUE,
  ]);

But the link still appears in the footer. Of course I've cleared cache and theme registry, but no changes.

How can I add the file to <head>?


texts: How to delete the cache files when the file cache module is installed

texts:
You have a site with the filecache module that saves the cache in files instead of the database.

The filecache directory to date has a size of 30 Gigabytes. You want to disable the module filecache and tell the Drupal system to save the cache in its corresponding database tables. Does anyone know how to do these two processes?

Thank you for your cooperation


texts: boolean function to determine whether an commerce order id exists?

texts:
is there a boolean function that exists OOTB that allows you to determine if a commerce order id exists?

I'm trying to pass an order id and check if is actually an existing order regardless of order state.


texts: I need to reference a custom field I created in User Profile

texts:
I used Drupal 7 computed fields to calculate weight loss. This is what I current have. Which works in a sense but only where the user inputs their initial weight and subtracts their current weight to track the total weight loss at the time of the input. But I need it to reference their initial weight from their user profile so that they only have to enter their current weight. One step process versus having to always enter the data that already exists. How can I achieve this?

Current Code which works great but two fields have to be filled in. Needs to reference field in user profile.

$entity_field[0]['value'] = ($entity->field_iweight['und'][0]['value']) - ($entity->field_current_weight_['und'][0]['value']);


texts:
I have 4 Drupal sites that have nothing to do with each other, except that they all run on Drupal and they're all managed by me.

The modules each site needs will vary, but they probably share some small subset of modules.

Is this situation a good candidate for using multi-site configuration?

What if I want to add a fifth site? How would I upload the new one, or how would that work?


texts: Trying to get property of non-obJect Custom Module

texts: Notice: Trying to get property of non-object in speakerdetailblock_preprocess_block() (line 42


texts: How do you add a comment form on your user profile in Drupal 7? I have installed panels but I don't know how you add the comment form on the users profile


texts:
I was trying to get the path alias using for nodes using the following code.

\Drupal::service('path.alias_manager')->getAliasByPath('/node/' . $nid);

It works for nodes that are already created, but it breaks when a new node is being added. I get the following error.

  Uncaught PHP Exception Symfony\Component\Routing\Exception\InvalidParameterException: "Parameter "node" for route "entity.node.canonical" must match "\d+" ("" given) to generate a corresponding URL.

Is there an alternative way to get the path alias for nodes that have not been saved yet?


texts: How to create user profile theme hook suggestion for custom template?

texts: I'm using the Chaos tools display suite module to create a 'mini_teaser' view mode for my user profiles, but I can't seem to get drupal to read a custom template 'user-profile__mini_teaser.tpl.php' in my theme folder. In my user preprocess function, I'm adding theme suggestions, but they don't seem to work. Any ideas?


texts: PHP to create text field with default content from PHP command?

texts:
We have a block containing the code:

<?php print token_replace('[current-page:url]'); ?>

which does most of what is needed, which is just to mirror the URL of a unique views page containing user-populated content. [The purpose is for sharing the user's list selections. But in this case, general "sharing" modules/functions are not appropriate and it's better to provide the URL for the user to copy into an email.]

As a useability improvement to make it easier to copy this URL, we want to generate a live-text field which has this value as its default content.  What PHP code would do that?

Is is also possible to have that value (the resulting URL) automatically highlighted, so it's ready to copy?  To go a step further, what would be required to add a "copy" button which would grab all of what's in the field, even if the URL is too long for full display?


texts: When using Rules to set a value on a taxonomy term reference field, I get choices like "field:0", "field:1", etc. What do these numbers mean?

texts:
When I add a "Set a data value" action for my taxonomy term reference field, Rules allows me to choose from the following:

field-age
field-age:0
field-age:1
field-age:2
field-age:3

What are these ":0" ":1" etc. fields?

EDIT: These appeared when I changed the "Number of values" for field-age from "1" to "2".  However, since I only changed the number of values to 2, why did 4 things appear?


texts: Select form, write selected item to database

texts:
I'm using Drupal 7 and Form API.

My Problem:

I want to load rows from my Database and put them in a Select Form(Form API). After this form is submitted I want to write the selected option in my database.

The first step works fine but I don't know how to get the selected option for writing it into my database.

Load values from database:

$result = db_select('color', 'c')
->fields('c', array('ID', 'color', 'name')

->execute()

foreach($result as $row) {
     $options = $row->color . ' ' .$row->name;
}

Add options to form:

 $form['colors'] = array(
   '#type' => 'select',
   '#options' => $options,
 );

When form is submited:

db_insert() //Add ID of selected item to database

How do I get the ID of the selected color? The options of this select form is a name combination(color+name)


texts: Is it possible to give a language prefix to all the nodes without third-party modules?

texts:
I have a site with about 500 pages (nodes, taxonomy pages, and some views) which are all in Hebrew.
I want to make all paths from, for example, /node/example1 or /taxonomy/categories/term1 to /he/node/example1 or /he/taxonomy/categories/term1.
I want it for all the pages, as a first stage in turning this site to be a sub-site (with a sub-domain).
Is this possible without third-party modules?


texts:
Is it possible to import data from CSV file and insert all in two different entities
for example I have created two different entities, cadidates and exams entities, once I import data to exam entity i would like to make candidat entity updated also referencing to some field, i have tried many solution possible but in vain


texts:
WHile the Printer-friendly and PDF versions work without any issues (that I can see), I am having issues with the Send by email option. The email gets sent but consists of nonesense. Any ideas as to why this might be happening?

Eg.

normal; } */ /* * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units * http://clagnut.com/blog/348/#c790 * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ */ html { /* * To use a 14px font size on the page, delete the 16px and 12px declarations. * To use a 12px font size on the page, delete the 16px and 14px declarations. */ /* Use a 12px base font size */ font-size: 75%; /* 16px x 75% = 12px */ /* Use a 14px base font size */ /* font-size: 87.5%; /* 16px x .875 = 14px */ /* Use a 16px base font size */ /*font-size: 100%; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ -ms-text-size-adjust: 100%; /* 2 */ /* Establish a vertical rhythm. */ line-height: 1.2em; } /* * Instead of relying on the

The following settings enable the send by email function to work Site-wide default - DefaultMailSystem HTML Mail module class - HTMLMailSystem Mime Mail module class - DefaultMailSystem

However, the simplenews newsletters don't get sent.

Changing the Site-wide default to HTMLMailSystem instead, makes the newsletter work but then the send by email feature breaks (sends all sort of random stuff)

How should I configure the settings so both the newsletters and send by email features work correctly?


texts: Displaying alternate text for a taxonomy term in node

texts:
I have a taxonomy term called 'price'. I'd like it to display on the node page if it exists. But I don't want the taxonomy value to appear on the node page, I want the label to appear 'Price:' followed by hard-coded text that says 'see website.'.

Is this possible, and if so, how?

I don't want to use String Overrides because I'm using the value for the taxonomy term elsewhere. Perhaps some sort of code-based method (no pun intended) would work better :)


texts: Handle formatting of longtext value for entity wrapper

texts:
So I have a working setup where some code pulls in the latest Wikipedia extract of a page.  I then use Entities to handle a node creation, adding the contents of the extract to the longtext value of the generic body field:

$body = array();
$url = 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles='.urlencode($item['name']);
$result = @file_get_contents($url);
if ($result){
  // Oh yes!
  $decoded = json_decode($result, true);
  foreach ($decoded['query']['pages'] as $page){
    if (array_key_exists('extract', $page)){
      $body[] = t($page['extract']);
    }
  }
} else {
  // Boo, nothing found.
}

// Doesn't exist, we have to make it first. (Using Entities)
$node = entity_create('node', array('type' => 'article', 'uid' => 1));
$entity = entity_metadata_wrapper('node', $node); // $node->nid is probably better here
$entity->title->set($item['name']);
if ($body){
  $entity->body->set(array('value' => $body[0]));
}
$entity->save();
// Woo got our nid!
$nid = $entity->getIdentifier();

The problem is, I can't seem to control the output of the body at all.  It renders surrounded with paragraph tags, using html line breaks for each paragraph.  I want to surround each paragraph with paragraph tags.  I've tried using preg_match to catch newlines (\r\n) but anything I replace it with just gets rendered exactly - making paragraph tags show up in the extract text when viewing the node.

What's the best method of doing some formatting to the extract?


texts:
I am creating a document library. I've made a custom content type of "document" and a taxonomy for document categories. I've added the categories as a field in the document view. I want to display the document list, and at the top, have a dropdown menu where you can choose a category, and then have the view update to show you just the documents in that category.

I know that you can create a filter and then "expose" that filter to the user, but when I do that with this example, it makes a text entry box, not a dropdown box.


texts: Listing all entries of a specific content type within a panel

texts:
I've been tasked with adding a page to an existing Drupal (version 7.15) site.  I know next to nothing about Drupal or PHP so I've been struggling a bit.

I've created a page with 2 panels and am trying to use the "custom content" option to display the title field for each entry of a specific content type in one panel. And in the other panel, I would like to display all the fields for each entry.

For instance, the first panel thus far contains:

Open Positions:

And I'd like to know what PHP code I'd need to use to make each
 tag contain the titles for my content type.  The other panel would be somewhat similarly formatted in that there would be markup enclosing each field, but I do not know how to get the entries from the database, and then display specific fields from that entry.

Thanks.


texts:
I am attempting to get a views page into a taxonomy term page using this solution to no avail.

My taxonomy page is at [URL]/menu-tags/resource, so I made the Views page URL [URL]menu-tags/resource/resource-hub. The page doesn't show up despite having the settings set up in the pathauto config and the taxonomy checks out. I'm not sure where to go from here.


texts: Access Drupal7 Database Nodes without actually having anything installed (simple php + mysql)

texts:
The last days I got some trouble with the drupal database schema. I don't know anything about Drupal7 except that database entries are saved in several fields.

I need to read out all the different nodes and their attributes of a mysql server in Drupal Scheme (in the best case without actually using the Drupal environment) with a simple .php page. Is there any chance to do so?

Example: Car Entries - what I need are

field_data_field_speed

field_data_field_weight

and more.

Would be grateful for help!

UPDATE:
Database Drupal relationship between tables,  to get a node schema and node data.


texts: Placeholder working, but giving Notice: Undefined variable: value and Notice: Undefined index: #type

texts:
This is what my code looks like:

foreach ($form["submitted"] as $key => $value) {
    if ("textarea" == $value["#type"]) {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    }
    if($value['#type'] == "webform_email") {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    }
    if($value['#type'] == "file") {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    }
}

Why are these errors there and what is the solution? A detailed explanation and working code wouldn't hurt, I am a beginner with Drupal! :-)


texts:
I want to add smoothstate script to my pages.
I have to call 2 files at the bottom just before closing body-tag. Smoothstate.js and Functions.js. How can I call those 2 js in my html.tpl.php

<script src="js/jquery.smoothState.js"></script>
<script src="js/functions.js"></script>

Smoothstate.js


texts: Drupal overlay is not working for content links

texts:
I have installed my own custom theme in Drupal 7.29.
Overlay is not working for my content links such as

http://localhost/node/add#overlay-context=.
http://localhost/node/add
http://localhost/node/add/page
http://localhost/node/add/article

But for other links overlay works just fine

http://localhost/node/add/page#overlay=admin/structure
http://localhost/node/add/page#overlay=admin/structure/block
http://localhost/node/add/page#overlay=admin/structure/types

Overlay Working

Overlay not Working for content links

Please help me solve this problem. Any help is appriciated

thanks


texts: How to update parent price dynamically of product attribute?

texts:
I'm using Drupal commerce, Product attribute and Product Bundle. Each attribute (which is a product bundle) has it's own price, After selecting an attribute on a dropdown list it does not update the price of the main product, it also doesn't show the price on the dropdown list. How do we show the price on the dropdown list and also update the parent product price before adding it to the cart?

Example:

Main - 10,000

Attribute 1.1 - 1,000 (selected)
Attribute 1.2 - 2,500

Attribute 2.1 - 5,000 (selected)
Attribute 2.2 - 8,000

What's currently showing for the main is: Main: 16,000 (because of Attribute 1.1 and Attribute 2.1)

But if I select the other attributes, the Main/parent price won't update anymore. How can I make this work?

Just like the Commerce Pricing Attribute. The problem with my case is I don't use the Commerce pricing attribute because I don't use the commerce product option.

If it's hook form, rules, ajax, or a view, can you give me an example on how this will be done?

Thank you in advance.


texts: Set value of a webform field programatically

texts:
I am using a custom block in which all nodes of a specific type are loaded and then a webform is loaded and attached to each of these nodes.
The webform has a hidden textfield field which I am trying to programatically set to the id of the parent node:

class CustomBlock extends BlockBase {

  public function build() {
    // Load all nodes
    $query = \Drupal::entityQuery('node');
    $query->condition('status', NODE_PUBLISHED);
    $entity_ids = $query->execute();
    $nodes = \Drupal\node\Entity\Node::loadMultiple($entity_ids);

    // Loop through all nodes, connecting the webform.
    foreach ($nodes as $node) {
      $form = \Drupal\webform\Entity\Webform::load('MYWEBFORM');

      // Set the value for the hidden field pointing to the 'parent' node.
      $form->setElementProperties('node_reference', [
        '#type'=> 'textfield',
        '#wrapper_attributes' => array(
          'style' => 'display:none',
         ),
        '#webform_id' => 'mywebform--node_reference',
        '#webform_key' => 'node_reference',
        '#value' => $node->get('nid')->value,
      ]);

      // Render form an assign it to each node.
      $rendered_form = \Drupal::entityManager()
        ->getViewBuilder('webform')
        ->view($form);

      $node->form = $rendered_form;
    }
  }

}

If I look at the generated markup for each nodes form it see different values in the node_reference field, but when I submit the form and then look at the submission all forms have the same node_reference value?
Can anyone help me figure out what I am doing wrong here or perhaps this could be solved in a much easier way?

It seems like the the value always are set to the nid of the first node in the array? Perhaps this is some kind of strange caching issue?


texts: Group by parent terms from indexed node in views

texts:
Based on this question, I've obtained an "Indexed Node: Taxonomy Name" field in my view.

How can I group the results by parent terms? When I group by the term field (Format > Settings > Grouping field Nr.1), no parent terms are displayed.


texts: Force users to add Organic Groups content only to their group(s)

texts:
When a group member try to add group content, how come this user can still choose to witch group this content belongs to?? I was expecting that group members adding content could only add content for their specific group, not for all groups...
In the event a member is part of several groups then there should be a way to detect from witch group the edit content as been trigger and then only modify the content for that specific group ..

Anyone have such experience to share ?

Thanks,


texts:
My twig file is adding line breaks in the HTML which results in white spaces, as shown in this picture:

In the browser inspector:

When I remove the line breaks in the inspector, the white spaces disappear.
The default code in the file views-view-field.html.twig is:
{{ output -}}

I have researched the problem quite a bit and tried the following already, without success:
{{ output|replace({"\n":''}) }}
{{ output|trim }}
{% spaceless %}{{ output }}{% endspaceless %}
{% spaceless %}{{ output|render|trim }}{% endspaceless %}

I'm working on Drupal 8.7.6.
Any help would be appreciated.


texts: hook_modules_enabled called before hook_menu

texts:
(Note: the code and module names have been simplified for demonstration)

I have a number of custom modules in a Drupal 7 site. One of the modules (a 'base' module enabled during site installation) creates a custom menu (operations-menu) along with a hook (hook_operations_menu()) for customizing the menu. Other custom modules (I'll refer to them as implementing modules) with a need to add menu links into the operations-menu can simply implement hook_operations_menu() and return the appropriate menu item definitions.

Example:
Assuming my base module is called 'base' and my implementing module is called 'implements'.

base.module

/**
* Implements hook_modules_enabled()
*/
function base_modules_enabled($modules) {
  $links = [];
  foreach ($modules as $module) {
    $module_links = module_invoke($module, 'operations_menu');
    if(is_array($module_links))
      $links = array_merge($links, $module_links);
  }
  foreach ($links as $link) {
    menu_link_save($link);
  }
}

implementing.module

/**
* Implements hook_operations_menu()
*/
function implementing_operations_menu() {
  $links = [];

  // Define menu links here

  return $links;
}

/**
 * Implements hook_menu()
 */
function implementing_menu(){
  $items = [];

  // Define menu callbacks, etc.

  return $items;
}

This strategy works well to maintain a modularized custom menu with one exception. For some reason, when enabling the implementing module, base_modules_enabled() is called before implementing_menu(). This is a problem since some menu links defined in implementing_operations_menu() depend on routing established in implementing_menu().

I've checked the source code, and module_enable() invokes hook_modules_enabled() at the very end. I don't understand how hook_menu() is getting called after hook_modules_enabled() and not before.

Any assistance is greatly appreciated!


texts: Audio File Field is empty (null) on drupalgap app

texts:
What i want to do is create/view podcast node type inside DrupalGap App in Android.
I am using drupal 7 on Centos 7.
drupal module: audiofield (https://www.drupal.org/project/audiofield)
drupalgap module added on www\app\modules: audiofield (http://drupalgap.org/project/audiofield)
I am using HTML 5 player (default). But also tried before jplayer.

On content type named podcast i have fields:
title, body and
audio file with File (as type) and Audio Upload (as widget).

Permission given:
Audio: Download own files
Audio: Download All Audio Files
Media->Use the media browser
Podcast: Create new content
Podcast: Edit own content
Podcast: Delete own content

even i gave:
Add and upload new files
View own private files
View own files
Audio: Edit own files
Audio: Delete own files
Audio: Download any files

In browser i can listen and download and create new Podcast. All work well.
In my android app (drupalgap) when viewing, i can see a player but nothing happens when i press play or download button. And when i try to create a podcast in the audio file field, DrupalGap shows Null and nothing else below.

P.S. I can provide test account if need be

Any suggestions?

Thank you


texts: Ubercart entries in menu_links table causing performance issues

texts:
Drupal 6:
I have found around 130 entries in the menu_links table such as:

user/123/order
user/5a9689f90da4d0d012de104d7da67a8b/order/
user/123/order//invoice

These entries cause a user_load to happen which seems to be irrespective of which user is logged in.

Deleting these entries results in around 1000 less queries being run on a page load.

My question is, is it safe to delete these entries and how would they have ended up in the menu_links table in the first place?


texts: How to use multiple content types in a "Calendar" View sorting by the field type of "Date"?

texts: I am using a module called "Calendar" that puts a calendar on the sidebar, and allows you to add events using a cck, which will be displayed on the calendar so that you can click the date, and it will bring you to the event (along with any other event that day.) the problem is, that i don't want to have to create all new content using the cck that was part of the Calendar module. when installing the module, it added a field type called "Date", which is what the calendar events are sorted by. this allowed me to add other cck events that had that field, into the calendar. The problem is, that it puts in onto the wrong date. instead of putting it onto the date that it is set at, it is put onto the date that it was created. is there a way to fix this?


texts: In the File Entity module, what is the purpose of multiple "Enabled displays" and "Display precedence order" for a single display mode?

texts:
In the File Entity module, what is the purpose of multiple enabled displays and Display precedence order for a single display mode? Or what is the use case where I would need to provide multiple ones and define precedence of one over another?

There is little to no documentation on File Entity (understandably as it is still under heavy development), and I am trying to wrap my head around it a bit more. I just can't think of a use-case where I would need more than one "display" for a single "display mode", where the first would not "validate" and therefore look at subsequent ones that are defined.


texts: How to add custom class to a  fileds on the renderable array of user_profile_form

texts:
I have a requirement to add a class to  ul  li  on the user_profile_form edit page on admin side.
Using Hierarchical Select Taxonomy module regions are listed on this form.The purpose is to modify  the listing of the regions by adding different classes for the regions based on the taxonamy id.


texts:
Im trying to send an HTML mail through SMTP, Im currently using the modules:

MIME mail
PHPMailer
Mail System

On a Drupal 7 site.

The problem is that when I check the mail header that I have recivied it does not say Amazon SES which I have configured PHPmailer to do so but my hosts information

Following is my code.

function mail_subscribers($email_body, $email_subject, $subscribed_users) {
  $module = 'my_module';
  //$key = microtime();
  $key = 'mymodule_mailer';
  //$subscribed_users = get_subscribed_users($feed_nid, $users_type);
  $params['headers'] = array(
    'Bcc' => $subscribed_users,
  );
  $to = 'welcome@mysite.com';
  $subject = $email_subject;
  //$params ='';
  $body[] = $email_body;
  $send = FALSE;
  $mail_message = drupal_mail($module, $key, $to, language_default(), $params, $send);
  $mail_message['subject'] = $subject;
  $mail_message['body'] = $body;

$mail_system = drupal_mail_system($module, $key);
  $mail_message = $mail_system->format($mail_message);
  $mail_message['result'] = $mail_system->mail($mail_message);
}

and my hook_mail

function mymodule_mail ($key, &$message, $params) {
  switch ($key) {
    case 'mymodule_mailer':
      // Set headers etc

      $message['send'] = FALSE;

      break;
  }
}


texts:
As a contractor one jumps between different installations of drupal for different clients. Often the architecture is baked in and needs to be maintained.
My experience tells me caching solution used are, in order of frequency, 1) memcached  2) memcached and varnish.
Drupal + redis as a caching solution is not prevalent even though it is free, opensource and more feature rich.
I like to know why?
Were Memcached and varnish available before redis?
This is the answer I come up with talking to collages but seems too simple.


texts: Trying to get a date image inside my block

texts:
I am trying to get a date image inside my block. For some reason, doing updates broke it.

I'm looking around and trying to change different settings, and look for different settings that may have been affected, it appears like there's something called "Content: Date(s)" in the area in question, however nothing I change in regards to it works.

Here's an image:

Any idea how to fix it?


texts: Displaying Empty Option in Multiselect box

texts:
This might be a really trivial question but it is driving me nuts.  I have looked at similar posts but they all address a single-select drop-down box.  What I need is to get the '-None-' to show up in a multi-select box.  For some reason, despite verifying my code a million times, it is not showing up.  Hope someone can point out what I am doing wrong.

$form['add']['add_drop_down'] = array(
  '#type' => 'select',
  '#title' => t('Select all that apply'),
  '#options' => $options,
  '#multiple' => TRUE,
  '#required' => FALSE,
  '#empty_option' => '-None-'
);

Basically, this only shows the options in $options in the select box and doesn't add the '-None-' as the first item. It works fine if I change it to a regular single-select.  The moment I turn #multiple to TRUE, the '-None-' disappears.  I have tried a number of different ways, but with no luck.  Hope someone can help.  Thanks.


texts: Views Exposed Filters do not accept null as 0

texts:
I have 4 filters for a travel site that I've made into sliders. They are all supposed to go from 0 to whatever number, but for all of them I also have "Accept NULL as 0" activated.

This seems to be fine if you are only talking about one filter, but it doesn't seem to apply to all of them. I looked at the SQL query that Views puts out and it's only applying the NULL as 0 argument to one of the filters, even though it's activated for all.

I even looked in the database and the null value is on there. Is this a bug, or is there a way to fix this?

I have some objects that have NULL for 3 or even all 4 filters, but I still want them to show up in the list.


texts:
Ok, I know there is a tutorial out there somewhere for this, I used it once before. Now, no matter how I search, I can't find it. Basically, I want to create this:

In other words, an admin landing page with sub menu items.

I have Panels and Page Manager installed and can create the admin page to the point where it shows on the path, but the sub-menu items don't appear. Instead I get this:

I've cleared the caches, made sure that sub-menu item is under this page, made sure that all the proper permissions are set . . . You know all the stuff that good Drupal developers are supposed to do.

So my two questions are this:

What am I doing wrong?
Can any one give me the step by step for creating what's on the first image with my own custom menu items? Or at least point me in the direction of some tutorials?

Thank you in advance for any help you can provide.


texts: Send Email to user after click submit button

texts:
Currently I am doing a recruitment system using Drupal 7 where the applicant can apply the job and HR admin can shortlist the applicant.

I have created a "shortlist button" in the content type to let the HR admin change the applicant status from pending (by default) to shortlisted. I put some rules to change the user status.

So my question is: How can I send the email to notify the user after the HR admin clicks the "shortlist button" to inform the user that they has been shortlisted?


texts: Creating a drupal-composer/drupal-project gave me an outdated version of core

texts:
When I ran

composer create-project drupal-composer/drupal-project:8.x-dev mysite --no-interaction

it installed drupal/core:8.8.0-alpha1.  Then to see what was wrong, I ran

composer prohibits drupal/core:8.8.5

and the output was

drupal/core-dev 8.8.0-alpha1 requires drupal/core (self.version)
drupal/core 8.8.5 requires zendframework/zend-diactoros (^1.8)
drupal-composer/drupal-project dev-master does not require  zendframework/zend-diactoros (but 1.7.2 is installed)

What should I do next to get the most recent stable version?
Was I supposed to run composer create-project drupal-composer/drupal=project:8.8.5?


texts: Alter behavior of Next Page > button on a multipage webform page

texts:
In a multipage webform (the webform module), there is the Next Page > button. It has 2 handlers,

webform_client_form_pages
webform_client_form_submit

How do I add another one? This is because I want to change the behavior of the Next Page > button. It's behavior should depend on the value of a checkbox on the page. Or should I have to do it in another way?

Thanks,

Eric J.


texts:
Does anybody successfully authenticate against AD global catalog? I've got the following configuration:

LDAP server:
ldaps://service.mydomain.com
LDAP port:
3269
Binding Method:
Service Account Bind
Base DNs for LDAP users:
DC=service,DC=mydomain,DC=com
DC=otherdomain,DC=mydomain,DC=com
AuthName attribute:
userPrincipalName

The module successfully authenticates users, which are members of parent domain called "service", but LDAP search can't find any user from "otherdomain", which is connected to parent domain inside AD domain forest. I´m able to test LDAP search using ldp.exe and using this tool I can find any user from any domain.

Also, there is the following error message in the Drupal watchdog:

  ldap_search() function error. LDAP Error: Referral, ldap_search() parameters: ldap_search() call: base_dn: DC=otherdomain,DC=mydomain,DC=com, filter = (userPrincipalName=somebody@otherdomain.mydomain.com), attributes: , attrsonly = 0, sizelimit = 0, timelimit = 0, deref = , scope = 3

Any help will be greatly appreciated.


texts:
Could anyone tell me how I can hide a field after user login? For example, at the top of my front page I have:

  login | register

However, upon successful login, I would to hide this field.

The above 'login | register' field is just a 'div' block with 'href'.
One good example is the hiding of the default Drupal login block after login in.

I am using Drupal 7.


texts: How to add class to specific TD in view table?

texts:
I have a view created /admin/structure/views and it is a table.

How do I add a class (f.ex. "bgred") for a specific TD (f.ex "title")
in this table without using JavaScript ? I mean I have some hidden field
(f.ex. "Status") and want to add class for field "Title" only when Status==1,
is this possible ?

I want to add class to TD element not some div inside TD...

<td class="bgred">


texts: Translate strings that are not in default language TO default language?

texts:
I have a Drupal site running in English by default but also supports French, however some fields are input from a feed and I need to translate those values into English.

It's about 4-5 values that are in the feed, that get used in one field for a couple node types.

Is there any way to translate "non-default" language strings to their "default" language versions?


texts: Module for enforcing mandatory minimum number of tags in content type field?

texts:
The built-in tag field functionality allows definition of a maximum number of tags, but not a minimum number.

Is there a contrib module to enforce a minimum?


texts:
I'm loosing my head. This is the function for generating my admin form:

function section_description_and_images_settings() {
  $form = array();

  $form['images_style'] = array(
    '#type' => 'radios',
    '#title' => t('Set default images style'),
    '#options' => array(
      0 => t('Bootstrap columns'),
      1 => t('Slideshow'),
    ),
  '#default_value' => variable_get('section_description_and_images_images_style', 0),
);

  dsm(variable_get('section_description_and_images_images_style', 0));
  return system_settings_form($form);
}

And variable section_description_and_images_images_style does not store the desirable value. It's always 0, whether I set 0 or 1.

Any ideas what might be wrong?


texts: Node specific template with custom html header

texts: From time to time I have pages within the Drupal architecture that I don't want to use the standard page.tpl.php.tpl and html.tpl.php.  I want to create a template for specific nodes that uses a unique one for each.  It cannot have any drupal code in it.  Is this possible?


texts: after ajax callback, how to alter views exposed form

texts:
Look at my code is there any other way to do this. I tried to change my form element type in my exposed view filter after selecting any dropdown menu and my dsm($form_state) not showing any [values] index.

function loan_details_filter_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'hundy_users_detail') {

    // Unset the title and body filter info so that it doesn't print any label.
    /* unset($form['#info']['filter-status']);
    unset($form['#info']['filter-first_name']);
    // Unset the title and body filter
    unset($form['status']);
    unset($form['first_name']); */

    //$updated_form_element_type = !empty($form_state['values']['search_within']) ? 'textfield' : 'hidden';
    $select_options = array(
      'name' => 'Name',
      'loan_status' => 'Loan Status',
    );
    $form['search_within'] = array(
      '#type' => 'select',
      '#title' => t('Search Criteria'),
      '#options' => $select_options,
      '#default_value' => !empty($form_state['search_within']) ? $form_state['search_within'] : '',
      '#prefix' => '
',
      '#suffix' => '
',
      '#ajax' => array(
        'event' => 'change',
        'callback' => 'ajax_filter_form_callback',
        'wrapper' => 'views-exposed-widget',
      ),
    );

    $form['search_box'] = array(
          '#type' => 'textfield',
          '#title' => 'Search',
          '#prefix' => '
',
          '#suffix' => '
',

    );
  }
  dsm( $form_state );

}
function ajax_filter_form_callback(&$form, &$form_state){
  $form['search_box']['#type'] = 'radio';
   //echo $form['search_box'];
  return $form;

}


texts: Is there any way to access the user tables on drupal?

texts: I want to ask where the information about users is saved in the database, since I could not find any corresponding entries in the sql file. I would like to share the user tables with another CMS, namely question2answer.com, so I do not have to maintain two user databases.


texts:
How can we add an external javascript library that relies on jQuery by calling $(document)??

As Drupal 7's jQuery needs to be encapsulated, adding the library just generates errors:

  $(...) is not a function

I don't understand the point of not being able to use $ directly anymore.
And adding jQuery as an external library seems to conflict with the Drupal's one

Thanks for the help


texts: Where can we store 3rd party application passwords?

texts:
I've written a Drupal 8 custom module that communicates with 3rd party APIs which need authentication. I have an application username and password for those APIs which I need to store somewhere. I can think of the following two ways to achieve that.

I can store the credentials in the Drupal database as configuration. But the password then becomes visible in plain text to all the site admins, and we don't want all the site admins to see the password (I also am aware that we can set up roles and permissions, so we can disable access to a particular configuration for all the site admins, but still the password is saved in plain text in the database).
I can also store the credentials in the settings.php file.

Is there any other way we can store these credentials? What is the best, secure and preferred way to store 3rd party account credentials in Drupal 8?


texts: Entity Reference + Views + Profile 2 | User Filtering

texts:
As the title is kinda vague (couldn't for the life of me think of something more creative) here is the case.

I have an Entity Reference field on one of my Content Types that's limited to Users.

The field searched through the users via a dedicated view.

I've installed Profile 2 and added first and last names to the users of my site.

I've added all the view's fields as search parameters in the views settings (username, first name, last name, email) but only the username and email (core drupal 'fields') seem to be able to be searched for whereas the first and last name are the ones I need mostly.

Am I missing something?


texts: Does "drush dl" allow to download a module from a site that is not drupal.org?

texts:
I have created a Drupal test site on Openshift, and I got Drush 6.2.0 installed. Reading the online help for drush dl, I see the following:

  Download Drupal core or projects from drupal.org (Drupal core, modules, themes
  or profiles) and other sources.

Looking at the rest of the help text, I don't see any option to say to the command the module I want to install is not hosted on drupal.org.

Can drush dl really download a module from a site that is not drupal.org, e.g. my git repository on github.com?


texts: Where to find all possible keys for BaseFieldDefinition -> setSettings()

texts:
I am a noob to Drupal. I am trying to create a module and am currently in the process of creating a content entity and defining its base fields. Can anyone tell me where I can find a list of possible keys for the setSetting method? In other modules I have seen things like:

 BaseFieldDefinition::create('entity_reference')
  ...
  ...
  ...
  ->setSetting('target_type', 'commerce_store')
  ->setSetting('handler', 'default')

How is it that the module creator knew to use target_type and handler??
Any help is much appreciated. I am very confused.


texts: How to send an email after a specific node field gets updated by an admin?

texts:
I need to send an email notification to the node editor (reviewer/moderator) when an admin changes a (custom) field.

I've added the list of editors as a field in node form.

The nodes will be created by users and unpublished by default.

The nodes will be assigned to editor for review by admin, the editor should be able to view records assigned to the editor.

When admin assigns a node to editor, the editor should be notified by email.

How can I notify editors when they are assigned a node by admin?

Rules requires data comparison, conditions to trigger action. But I need to trigger action when a particular field gets changed.

I would like to use Drupal hooks like hook_node_update, by that way we can get the email id of the editor (in my scenario) and notify the editor.

Programmatically where and how I use hook_node_update() to achieve this? Or can the Rules module be used? If so please explain in detail how to create a rule for this.


texts: How to send system mails in html format (with Swift Mailer)?

texts:
At Account settings page (/admin/config/people/accounts) I can edit system mails Drupal is sending (Welcome, Account activated, Account blocked and so on).
I also installed and configured Swift Mailer module. At Message settings page (admin/config/swiftmailer/messages) I selected HTML for message format.
Then I edit some message template and enter html content there like:
<!DOCTYPE html>
<html>
  <head>
    <title>Your account at [site:name] has been activated.</title>
  </head>
  <body>
[user:display-name],

Your account at [site:name] has been activated.

You may now log in by clicking this link or copying and pasting it into your browser:

[user:one-time-login-url]

This link can only be used once to log in and will lead you to a page where you can set your password.

After setting your password, you will be able to log in at [site:login-url] in the future using:

username: [user:account-name]
password: Your password

--  [site:name] team
  </body>
</html>

However in mail I receive I still got Content-Type: text/plain; and I see it as plain text.
At that Swift Mail Message settings page it says:
"You can set the default message format which should be applied to e-mail messages."
But I don't see that option anywhere? How to change this default message format (to "text/html")?
An update:
I found out that if I uncheck "Respect provided e-mail format." on SwiftMails Message settings page I do get text/html content type in mail header. However all the tags I enter in mail template are stripped out and new rows are automatically converted to paragraphs?
I expected that there will be "HTML email" text format at Text formats page (/admin/config/content/formats) where I can set filters, but there aren't any.


texts: Is cache_form table making a site faster by any way?

texts:
Drupal Commerce refuses to flush the cache_form table when cron tasks run. I know it is most likely a known bug and it has tens of solutions. (I will probably just set cron task to flush it somewhere in the midnight every day.)

Does it speed up Drupal in any way?

It is part of a cache obviously, but I did not noticed any better performance whether the table size. More or less I experience slowdown, but it might be related to something else.


texts: Comment author name = user name by default?

texts: My website can only be accessed by authenticated users. How can I automatically make the author's name the user's name without giving users the option to input anything else in the name field?


texts: Users field manually delete from database cache problem

texts:
i manually remove  a column of field_data_field_about in database belongs to some users. and this field is user field. And after in admin panel i edit this user which i delete this user column from database. But this user about value is shown there. Then i Clear All Caches then i come back to edit this user the about value is gone.

How can i disable cache for users fields?


texts:
We have a Standard Drupal site with lots of custom configurations ad custom modules. We would like to put this in a GitHub repository so that anyone can clone this repository and install the Drupal 8 site along with custom configurations on their server.

What we have tried is - we exported the configuration of the current site using the UI and tried to import it into a new Drupal installation. But then we understood that configuration can be synced only between clone sites, not a new installation.

How can we move the entire site into a git repo, without having to put any SQL dump in the repository?


texts: Store token replacement values in the database rather than tokens themselves

texts:
Is there a way to store the token replacement values of tokens put in a form field in the database rather than the tokens themselves?

I have a text field in a custom content type that has a token as default value (using Token Filter), [current-user:uid], so on node creation the replacement value is inserted into the node. In the database, it's stored as '[current-user:uid]', rather than as the replacement value. What is one way of storing the replacement value rather than the token string in that table?


texts: How to add css to a form according to the user's role?

texts:
I know how to add css to individual form types using:

function theme_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'formtype_form':
      global $theme;
      $form['#attached']['css'] = array(
        drupal_get_path('theme', 'projectname') . '/css/new.css',
      );
    break;
 }
}

but how can I restrict this attached css to users with a single role?


texts: $form array in views-exposed-form.tpl.php has #printed set to true?

texts: I'm not doing anything to it in any other functions, but every #printed is set to TRUE when it reaches the .tpl. Any ideas why this is?


texts: Commenting on each paragraph of node body

texts:
I want to provide this option in Drupal that users be able to put comment on each paragraph of an article beside putting comment on the whole article.

I use explode command to make an array which contains paragraphs:

$paragraphs = explode("<p>",render($content));

In order to put comment for the whole article I write:

print render($content['comments']);

I am trying to find the file where $content is defined, so I can add another array like $content[]['paragraphcomments'] for comments for each paragraph of an article. Does anyone know in which file $content is defined. Also does anyone have any suggestion?


texts: How do I skip validation for node form element?

texts: I have a content type having 10 fields that are all required. How do I skip validation for some fields? Is there any hook/function that allow me to do this?


texts:
I've been hired by a firm as an entry level developer/seo/content marketing person and part of my responsibility includes their Drupal (6.X) CMS. I'm working my way through the 'The Definitive Guide to Drupal 7' and I've been making only small iterative changes so far while I'm getting the hang of everything. Today though, I have a bit of an issue which I could use some help on.

Some of the content links are breaking and it is due (I believe) to the way they have Drupal configured as well as my own green-ness. For example, the site's content area (the <front>) is called www.drupal.com/blog but the name of the server that hosts Drupal is server.drupal.com. Newer content and some of the older content is being automatically aliased to server.drupal.com and so is only viewable when a user (admin) is logged in. So, when a video node is posted, it is aliased as, for example, server.drupal.com/videos/awesome-video but when www.drupal.com/videos/awesome-video is entered into the URL as an anon user it throws a 404. No bueno.

The URL Alias module automattically sets server.drupal.com as the default base pathway and only allows me to set the /videos/awesome-video part of the alias.


texts: How to check the value from data sheet during Feeds import?

texts:
I am trying to import some data by using feeds importer. I want to check if there is any information under "equivalent" Source in the sheet. If there is no value, just skip the import. If it has, continue and finish the import process.

I saw there is an event called "Before saving an item imported via Recommended Product Import(importer name)."

Does anyone have any idea about how can I set the condition and action parameter for implementing this rule?

This is one column from my sheet and rule sheet (you can see some products have equivalent, some do not have):


texts: How to get name, price and image of product using EntityFieldQuery()

texts:
Right now i am using this which doen't give me the name of the product or the price or location of the product image.

    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'commerce_product');
    $query->fieldOrderBy('commerce_price', 'amount', 'ASC');
    $result = $query->execute();

which give this result

Array
(
    [commerce_product] => Array
        (
            [56] => stdClass Object
                (
                    [product_id] => 56
                    [revision_id] => 55
                    [type] => product
                )

            [50] => stdClass Object
                (
                    [product_id] => 50
                    [revision_id] => 49
                    [type] => testcamera
                )

            [28] => stdClass Object
                (
                    [product_id] => 28
                    [revision_id] => 28
                    [type] => cameras
                )

etc...


texts: How to add a "read more" link on User profile teaser display?

texts:
I'm using Drupal 8 and I want to have a "Read More" Link on my User profile, that links from the Teaser display to the Full display. How can I do that?

Content types for nodes bring the "Links" field out of the box on the teaser display.


texts: Can I get the relationships of a node using node_load()?

texts:
I want to load relationships from the node_load(). So for example  getting the article content type and loading the author information with the same query.
How would I go about doing this?

The end goal is to make a computed field for Drupal Search API so that I can convert the field's name. The relationship fields are currently in the form table_name:field_name but I am indexing into Algolia and therefore need the field name to just be field_name.


texts: Force an image to display as block (not inline)

texts:
I have a field of type image that I would like to display in a column alone, with all following content displaying beneath, even if the image width is narrower than the width of the display.
Even when using the layout builder, the following content always flows inline with the image.  The image is in a block in a single column section.  The following content is in a two-column section.  Instead of a single column showing the image followed by two columns with other content, the resulting display appears as three columns: Image of 1st section, 1st column of 2nd section, then 2nd column of 2nd section all in a single row.
Drupal version: 9.1.4
Any assistance in solving this?


texts: Edit display of commerce kickstart shopping cart

texts:
How can I display the output of a view in a menu?

I made a views that displays the information I want correctly but I don't know how to display the  as a block in a menu. I've tried Menu attach blocks and Menu Views but couldn't get it to work.

Is there another option?


texts: Why node object loses data after using workbench_moderation_moderate?

texts:
I'm using Workbench Moderation module because it matches my needs. I have a front-end form that initiate the node with some fields. Editor should review the node and fill all the required fields remaining.

So, I need to make sure that all fields are now filled with data then the state should be changed to Needs Review.

I implemented hook_workbench_moderation_transition to trigger the state change. If the next state was Needs Review, then I would make sure that all required fields were filled with data otherwise I would change the state back to the previous one and redirect to the node edit form.

What I've done so far

    function workflow_handler_workbench_moderation_transition($node, $previous_state, $new_state){
        if ($new_state == 'needs review'){
          //check if node was not reviewed before , then redirect to form
          $instatnces = field_info_instances('node',$node->type);
          //should check first if conditional_fields module is existed
          $CFS = conditional_fields_load_dependencies('node',$node->type);
          foreach ($instatnces as $key => $field_options) {
            $field = field_get_items('node', $node, $key);
            if ($field_options['required'] && !$field && !array_key_exists($key, $CFS['dependents'])) {
               //set workbench state to previous one
               workbench_moderation_moderate($node, $previous_state);
               drupal_set_message(t('Please make sure that all required fields has been reviewed'),'error');
               $url = url("node/$node->nid/edit");
               header("Location:$url");
               drupal_exit();
            }
         }
      }
   }

Problem exists when using workbench_moderation_moderate in the context above. For some reason, when I got redirected to the form to edit, and after saving, my edits were not saved on the node object and so if I opened the edit form again, I couldn't find my edits. Any ideas?


texts:
I have a custom form in Drupal 6 and every thing works perfectly except I want the form submit to open in new window.
I tried using the following code as per form api for drupal 6 but it does not work

$form['save_and_print'] = array(
      '#type' => 'submit',
      '#value' => t('Save and Print'),
          '#attributes' => array('target' => '_blank'), // this does not work
);

Was anyone able to achieve this? Please help!


texts: Which Views template file to override to display fields in formatted table?

texts:
I have some hierarchical content and I am trying to customize the output. I am trying to output a table something along lines of

Lesson Title    Description

 Exercises in Lesson    Exercise1
                        Exercise1 Description
                        Exercise2
                        Exercise2 Description

I looked at the existing display output template, expecting it to generate the view output. But that is not the case. I need to find the right file to edit, to add the PHP code to build my customized table.

Any ideas?

Thanks


texts: windows task schedule to run Drupal site cron keeps on creating COM surrogate instances

texts:
I have a simple Windows task created via task scheduler to open IE (to run Drupal site cron). I have been running this task every 30 minutes and noticed it creates multiple COM surrogate instances in task manager. The problem is that these instances never get removed. For an instance, if I run my task for 2 days, I get to see a 50 plus COM surrogate instances.
Have any of you experienced this issue? I guess running cron never returns a response once the service is completed, which could be a reason?


texts: How to allow users to add images to an existing node?

texts: How to allow users to add images to an existing node without giving them access to the whole node edit page. In Drupal 7 i used the Block Upload Module but it's buggy in the drupal 8 version. Do you have any approaches to get this functionality?


texts: I can't get the correct current language in node URLs

texts:
In D8, I have a website set up with 5 languages, using file path, like so:

 website.com/en/link
 website.com/en-us/link
 website.com/fr-ca/link
 etcetera.

I've made a view of blogs and resources. It includes a filter to current language selected for page and Not Specified-- this is to include articles that are intentionally set to Not Specified, so they show up for ALL languages. ( I don't want to have to turn 1000 blog posts into 4000 duplicates)

Problem is, the view is showing the link to items ONLY in the default language (EN)
Regardless of what language I view the website in.

I'm using a hidden "Link to Content" field within a custom field for each item. I've UNchecked 'use absolute url'.  I'm not sure what else to do. It doesn't make sense to me that it would be ignoring the site's current language.

If it's relevant, the link within the custom field is written like this:

 {{ title }}

I also added in a "Content: Translation language" field, to verify I was looking at the correctly filtered language. the URL uses default language regardless of whether the item's language is specified or not.

Update: I've also ensured the bottom middle column in Views is set like this:

 Rendering Language:Content language selected for page

This did not solve the problem. As a further test, I've also unchecked 'not defined' in my filter. While filtering to only nodes of the current language selected for page, I Still get URLs to the default language.

Also, the view has been translated into all relevant languages. Not sure how to change how the {{ view_node }} renders though. I assume it should be programmically pulling the current language when generating a URL. This {{ view_node }} is where the language is appearing. It seems like it should not be, though. The node alias shouldn't contain the language, I thought.


texts: How to create a custom resource with Services-3.x

texts:
Drupal 7.9

I have installed Services 3.x module and can successfully access nodes etc using the rest server e.g. http://api.domain.com/api/rest/node/6.xml. I now wish to create a custom resource and am having difficulty understanding how to do that correctly. I have followed the much-quoted tutorials on this which all seem to be based on the same example: http://drupal.org/node/783460 and am struggling to understand hook_services_resources. For example:

   'note' => array(
     'retrieve' => array(
       'help' => 'Retrieves a note',
       'file' => array('file' => 'inc', 'module' => 'noteresource'),
       'callback' => '_noteresource_retrieve',
       'access callback' => '_noteresource_access',
       'access arguments' => array('view'),
       'access arguments append' => TRUE,
       'args' => array(
         array(
           'name' => 'id',
           'type' => 'int',
           'description' => 'The id of the note to get',
           'source' => array('path' => '0'),
           'optional' => FALSE,
         ),
       ),
     ),

Where are the available values for these arrays? For example what are the valid options for source in the args array? I've seen the following: array('path' => '0'), 'data', array('param' => 'page'), 'param'. Where can I find a reference for how this needs to be defined?

To give a bit more information about what I want to achieve, we have a custom form that accepts a series of parameters and returns a set of html-formatted data. The form calls this function:
  return account_manager_search_accounts($billing_party, $other_party, $date_from, $date_to, $billing_id);
}

My idea is to allow users to retrieve the appropriately formatted data (e.g. json, xml) RESTfully and it seemed Services was the right way to do that.

Something like:

function account_manager_services_resources() {
  return array(
   'records' => array(
     'retrieve' => array(
       'help' => 'Retrieves records',
       'file' => array('file' => 'inc', 'module' => 'account_manager'),
       'callback' => '_account_manager_records_retrieve',
       'access callback' => 'user_access',
       'access arguments' => array('view records'),
       'access arguments append' => TRUE,
       'args' => array(
         array(
           'name' => 'billing_party',
           'type' => 'varchar',
           'description' => 'The billing party',
           'source' => what should go here,
           'optional' => FALSE,
         ),
         array(
           'name' => 'other_party',
           'type' => 'int',
           'description' => 'The other party',
           'source' => what should go here,
           'optional' => FALSE,
         ),
       ),
     ),
   ),
  );
}

Then I'm not even sure what the URL would be for this. Would it be something like: ./api/rest/account_manager/records

Any suggestions or advice appreciated.


texts:
I have an image field in my content type and I want to make a slideshow using the Views Slideshow module to show one image at a time.

If I put each image in a node of its own, the slideshow works fine. But can I have a slideshow using multiple images from the same field in the same node?

The point of this is that it is easier / quicker to create one node with 10 images than to create 10 different nodes. So far the slideshow seems to load all 10 images at the same time, but I want it to display only one image at a time.


texts: When should I use the "node_view" cache tag?

texts:
When should I use the node_view cache tag?
$build['#cache'] = ['tags' => [
    'node_view',
    // ...
]];

Drupal core uses the following code, in the EntityViewBuilder class.
public function getCacheTags() {
  return [$this->entityTypeId . '_view'];
}


texts:
After figuring out that tokenizer was breaking up a search phrases into individual keywords and turning that off in the UI, searching for a phrase actually brought the expected page onto the first page of search results. This was a huge improvement. However, a page that does not have the exact phrase, but does have more mentions of keywords in the phrase, will actually rank higher in the results. Via the Search API interface, using Type-specific boosting, you can boost a given bundle, but how does one boost exact phrase to have more weight than multiple instances of keywords?

Note that Solr is provided by the hosting provider, who also provides a pre-configured schema.xml file. The file is well commented but the research I've done thus far suggests that I would likely do more damage than good if I modify it.

All guidance appreciated at this point as I have experimented with this extensively and I think I've hit the limit of self discovery. I don't want to resort to hidden text to fix local search as I'm concerned with getting dinged for that by the major search engines.


texts: how to add custom font files to template

texts:
I like to add my custom font to my custom theming. All the font-files are in the file FONTS. And I also have a fonts.css file.
Where do I have to declare all this stuff?


texts:
I am using TB Mega Menu in header.

The setup is Drupal 7.35 + Oracle + Apache2. Theses are all the items which takes more execution time.

How can I cache menu items path and all Js and CSS files.


texts: module's local *.tpl.php, defined in $theme_registry, "not found or invalid" when referenced later in module

texts:
I built a custom login module for my Drupal7.26 install.

Extending it, I've added a *.tpl.php locally

ls sites/all/modules/custom/jl_login/templates/
    user-login-member-form.tpl.php

To get the tpl.php into theme registry, in "my_login_mod.module" I added

function jl_login_theme() {
    return array(
        'user_login_member_form' => array(
            'render element' => 'form',
            'template' => 'templates/user-login-member-form',
        )
    );
}

After module  disable/uninstall/enable, and clear all caches, I load my site/page.

Checking output with

<?php print '<pre>'; var_dump(theme_get_registry()); print '</pre>'; ?>

I see the form in the registry

 ["user_login_member_form"]=>
  array(6) {
    ["render element"]=>
    string(4) "form"
    ["template"]=>
    string(76) "sites/all/modules/custom/jl_login/templates/user-login-member-form"
    ["type"]=>
    string(6) "module"
    ["theme path"]=>
    string(43) "sites/all/modules/custom/jl_login"
    ["preprocess functions"]=>
    array(1) {
      [0]=>
      string(19) "template_preprocess"
    }
    ["process functions"]=>
    array(2) {
      [0]=>
      string(16) "template_process"
      [1]=>
      string(14) "ctools_process"
    }
  }

Later in my .module, I use the form:

function _jl_login_login_block_view($delta='') {
    $this_user_login_form    = drupal_get_form('user_login_member_form');
    ...

But on load I see in drupal logs,

Feb 24 16:32:16 dev d7: http://dev.loc|1393288336|php|127.0.0.1|http://dev.loc/||0||Notice: Undefined index: user_login_member_form in drupal_retrieve_form() (line 771 of /home/jl/d7/includes/form.inc).
Feb 24 16:32:16 dev d7: http://dev.loc|1393288336|php|127.0.0.1|http://dev.loc/||0||Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user_login_member_form' not found or invalid function name in drupal_retrieve_form() (line 806 of /home/jl/d7/includes/form.inc).

What do I need to change to be able to use/reference the local form?


texts: menu_router empty after module crashed site

texts:
Like an idiot, I installed an alpha module without backing my stuff up. Now I can not get to any pages on my site. They are all not found. The menu_router table is empty.

I have verified my .htaccess is working correctly
I have tried to run a "rebuild.php" file with this code:

<?php
error_reporting(E_ALL);
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

menu_rebuild();

I have enabled update.php from outside the admin site and ran it with no luck.

I removed the modules from my server. Deleted the table entries for them. Still no luck.

Any idea how to go about fixing this? Any help appreciated.

Thanks!


texts: Why can't I find any pages after migrating a site?

texts:
I need to migrate a drupal site from one host to another. I didn't create the original. I tried using "Backup & Migrate", and I also tried to export the sql database in phpmyadmin from old site, import into new site, and move the file manually with ftp. My new host is GoDaddy. I can change that if GoDaddy causes issues!

Here is the problem, The theme used in the old site appears as an option, I can choose it, and the site works, but no content is there at all. All the modules show up in the new environment, still no content. I go to search for content, still no content. I can't find any pages anywhere!!!

Any help?


texts: Rendering an image field in page.html.twig with a custom image style

texts:
I'm trying to set up a slideshow that's unique to each page. The code for this needs to be in page.html.twig. I've got the slideshow mostly working, but I can only call the full image URL, not a custom image style of a specific size. How can I modify this code to call a specific image size?

{% for key, item in node.field_slides %}
{% if node.field_slides[key].entity %}

    {% if node.field_slides[key].title %}

            {{ node.field_slides[key].title|striptags(",
,
,
,
,
,
,
,
,
,
")|raw }}

    {% endif %}

{% endif %}
{% endfor %}

The bit where I'm calling the URL is:

{{ file_url(node.field_slides[key].entity.uri.value) }}

I've tried doing {{ dump(node.field_slides[key]) }} to see if there was any data I could use, but every time I do that, I just get 500 error.

Any help would be greatly appreciated; I'm very new to Drupal, coming from WordPress. I think this is the last major hurdle before I can finish up this theme for my client.


texts: Programmatically add fields to content type

texts:
I have created a content type in Drupal 7 using the following code.

function module_node_info() {
  return array(
    'module' => array(
      'name' => t('module'),
      'base' => 'module',
      'module' => 'module',
      'description' => t("You can add a content for module from here."),
    ),
  );
}

This seems to be working fine: I see the content type and I can add fields. When I create fields for this content type through code, the fields show up when I click on 'add content' but they are not showing in my content type. When I add nodes of that specific content type, the nodes are not showing and the fields are empty when I edit them.

I miss something, but I have no idea what that could be. I use the following code to create the fields.

function module_form($node, &$form_state) {
  $form = array();

  $form['module_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Enter the name of your module'),
    '#required' => TRUE,
    '#description' => t('This name will be visible on the website'),
  );

  return $form;
}


texts:
I'm facing issue with Admin toolbar. Every time I create theme and define default style guide for typography eg.:

...
h2 {
  font-size: 3rem;
}

p {
  font-size: 1.2rem;
}
...

Admin toolbar's CSS is taking these style rules. I've tried to look for patch that would fix Admin toolbar CSS styles so it's more nested that my style guide will not override it but I didn't find anything.

My theme's libraries are restricted only to theme so they should not affect admin pages (and yes I understand that Admin Toolbar is also part of my theme and it's not categorized as an admin page)

Is there a way to define default typography h1, h2, h3, ... h6, p ... (like when you do website without CMF/ CMS) and do not affect Admin toolbar's CSS styles?


texts: Get taxonomy term ID from standard URL and then pass it to a View as a contextual filter

texts:
is a simple question, I whant get the term ID (tid) from standard drupal taxonomy url taxonomy/term/167 ou 167 is my tid and use as argument on views.

I found this code to get the tid:

$term_path=drupal_get_normal_path('position/'.arg(1));
$tid = basename($term_url);
$$here_is_my_tid = taxonomy_term_load($tid);

How to get taxonomy by URL alias?

I try also :

$here_is_my_tid = drupal_lookup_path('source', 'taxonomy/term/'.$tid);

$here_is_my_tid = drupal_get_path_alias('taxonomy/term/' . $tid);

But I try many combination without success.

Here is my views with the tid from url I try to pass "$here_is_my_tid"

$view1 = views_embed_view('mavue','page',$here_is_my_tid);

 if(arg(0) == 'taxonomy' && arg(1) == 'term') {
            $tid = (int)arg(2);
            $term = taxonomy_term_load($tid);

      }
    $view1 = views_embed_view('mavue','page',$term);

By advance thanks