texts: Changing the confirm delete message for comments

texts:
I have a website where I have comments on certain content but I am not allowing any replies to these comments. When deleting a comment the confirm delete message shows as

'Any replies to this comment will be lost. This action cannot be undone.'

This is not ideal because obviously there will never be any replies.

I have found the function which creates the text for the message on line 257 of comment.admin.inc

function comment_confirm_delete($form, &$form_state, $comment) {
  $form['#comment'] = $comment;
  // Always provide entity id in the same form key as in the entity edit form.
  $form['cid'] = array('#type' => 'value', '#value' => $comment->cid);
  return confirm_form(
    $form,
    t('Are you sure you want to delete the comment %title?', array('%title' => $comment->subject)),
    'node/' . $comment->nid,
    t('Any replies to this comment will be lost. This action cannot be undone.'),
    t('Delete'),
    t('Cancel'),
    'comment_confirm_delete');
}

How would I go about changing this text. Could I use template.php? If so how would I find the correct preprocess function. And then what is the way in which I could best find the variable in its current state in order to change it?


texts: How to add filter criteria by current date in views

texts:
I am using Drupal 9 and have a content type with a field "Publish until" (datetime).
I want to add a filter in views that it will compare the date in this field with current date.
I found a solution here for Drupal 8
Views filter criteria date field is greater than current date
However, my screen looks a bit different:

To be more specific, I don't have a "Value type" which seems to be necessary in my case.
Am I missing any module that should be enabled?
Or is it related to the Drupal 9 itself?
If there is any another approach to solve this problem with filtering I will be glad to know it.


texts:
I'm working on a site at the moment that has exposed filters for a search view using the Facet API. When a facet is selected it reloads the view with a GET parameter appended like in /recipes?f[0]=field_recipe_difficulty%3ABeginner.

Now, the results view is in a block about halfway down the page. Can I append an anchor like #results-area to the generated URL? I've looked into using AJAX but it's not really an option at the moment unless there's no way to use an anchor.

I am using Drupal 7.52 and the Views module version 7.x-3.15.


texts:
I have 2 functions in a custom AJAX callback which are really confusing me, one returns an image from a single node, the other retrieves a list of nodes first, then loops through them and returns images from each of them, even though the code which returns the image HTML is shared by both functions, the multiple node return wraps everything in a div.

Single AJAX callback

function _append_thumb_to_deck($node) {
    if (!empty($node)) {
        if ($node->field_image) {
            // Load the image as a thumbnail
            $thumbnails = get_thumbnails($node);

            // Prepare an ajax command to insert the node html into our ajax wrapper.
            $commands = array();
            $commands[] = ajax_command_append('#thumbs', $thumbnails);
            $commands['effect'] = 'fade';

            // Render the commands into JSON and print them.
            print ajax_render($commands);
            exit;
        }
    }
}

Multiple AJAX

function _append_multi_thumb_to_deck($node) {
    if (!empty($node)) {
        if ($thumbs = get_thumb_list($node->nid)) {
            // get_thumb_list is just a function to return an array of Node ID => Node object
            // Load each image as a thumbnail
            foreach ($thumbs as $nid => $node) {
                if ($node->field_image) {
                    $thumbnails .= get_thumbnails($node);
                }
            }

            // Prepare an ajax command to insert the node html into our ajax wrapper.
            $commands = array();
            $commands[] = ajax_command_append('#thumbs', $thumbnails);
            $commands['effect'] = 'fade';

            // Render the commands into JSON and print them.
            print ajax_render($commands);
            exit;
        }
    }
}

HTML callback

function get_thumbnails($node) {
    $img = image_get_info($node->field_image[LANGUAGE_NONE][0]['uri']);
    $vars = array(
        'style_name' => 'thumbnail',
        'path' => $node->field_image[LANGUAGE_NONE][0]['uri'],
        'width' => $img['width'],
        'height' => $img['height'],
        'alt' => t(''),
        'title' => t(''),
        'attributes' => array(
           'data-nid' => $node->nid,
        ),
    );
    $thumbnail = theme_image_style($vars);
    $thumbnail = "
nid}'>{$thumbnail}
";
    return $thumbnail;
}

This returns something like

I can even inspect the HTML which is intended to be returned by the multiple function and it appears to be correct, it's just a long string of multiple li tags containing images, properly formed HTML, no hanging tags, no opening or closing divs etc, and yet for some reason, the function to append multiple thumbs wraps everything in a div, whereas the other one doesn't.

Is there some kind of character limit or something which is causing it to be added in a div?


texts:
How can I get the ID of a taxonomy term with only a path alias, using PHP?

I have a vocabulary with some taxonomy terms with a path alias like [vocabulary]/[term] (e.g. car/model) and I have repeated model terms. (So I think that using titles is not an option.)

I created a view with a path (car/%); if I want to make another view with an extra argument and car/%/% as path, I can't get the content unless I use the taxonomy ID like car/123/1 instead of car/model/cat.

Is there a way to make this?


texts: How can I remove the hardcoded menus from the Navin subtheme?

texts:
I'm using Navin, a subtheme of Omega. I'm trying to hide the main menu, so that I can add a superfish menu, but I don't know where it's been hardcoded. It's not in a block (admin/structure/blocks). I've checked the theme settings page (admin/appearance/settings/theme_name) The region--menu.tpl.php looks like this:

<?php
  $main_links = menu_tree_page_data(variable_get('menu_main_links_source', 'main-menu'));
  $main_links = menu_tree_output($main_links);
  $secondary_links = menu_tree_page_data(variable_get('menu_secondary_links_source', 'user-menu'));
  $secondary_links = menu_tree_output($secondary_links);
?>
<div<?php print $attributes; ?>>
  <div<?php print $content_attributes; ?>>
    <?php if ($main_links): ?>
    <nav class="navigation">
      <?php print render($main_links); ?>
    </nav>
    <?php endif; ?>
    <?php if ($secondary_links): ?>
    <nav class="navigation-secondary">
      <?php print render($secondary_links); ?>
    </nav>
    <?php endif; ?>
    <?php print $content; ?>
  </div>
</div>

I appreciate any help or suggestions.


texts: How to allow users to moderate their own forum threads?

texts: In Drupal 6 forum, I want to give certain thread initiators the permission to edit/delete the thread posts that they find unsuitable, but only on their own threads. How can I do so? Thanks


texts:
I want to use the "data" attribute in some of my tags, and I have been searching for a way to include it.

For Example: I am adding JavaScript code to my form. I use hook_form_alter() and the #attached property.

$path = drupal_get_path('module', 'mymodule');
$form['#attached']['js'][] = array('data' => $path . '/js/custom_values.js','type' => 'file');

How do I add a "data" attribute to the <script> tag generated? I want to use it for arguments to the JavaScript code.


texts: Trying to turn on theme debug, but getting an error: Drush command terminated abnormally due to an unrecoverable error

texts:
I'm new to Drupal and Drush and so am hoping someone can shed some light on this.

I tried to turn on Theme Debug with Drush:

drush vset theme_debug 1

But I keep getting an error I don't entirely understand:

Drush command terminated abnormally due to an unrecoverable error.
Error: Declaration of Drush\Command\DrushInputAdapter::hasParameterOption() must be compatible with
Symfony\Component\Console\Input\InputInterface::hasParameterOption($values, $onlyParams = false) in
phar:///usr/local/bin/drush/lib/Drush/Command/DrushInputAdapter.php, line 27

I tried drush status too and got the same issue, so I think drush is probably broken across the board.

I tried deleting and reinstalling drush and reprovisioning my virtual box to no affect.

Would anyone know what could've gone wrong here?

(I am running Drush 8.1.7. on Drupal 7.5)


texts: Accessing custom taxonomy term fields in a rules loop

texts:
I am building a rule that on node save will loop through taxonomy terms added to an entity reference (taxonomy term) field, build up a list of users from an entity reference (user) field in those taxonomy terms, and e-mail those users.

The problem I'm having is that my data selector won't give me the tokens for the user reference field in the taxonomy term loop.  This rules issue tells me that I need to have the "entity has field condition" condition applied or the "content is of type" condition.  Unfortunately all my conditions are referencing the node that is being saved.

I'm guessing that the answer would be to build the loop into some type of component so I can do a second condition check, but I'm not sure what the right approach for that would be.  How can I let rules know what kind of entity I'm looping through, so it will give me access to the custom fields on that entity?


texts: Rewriting a link field to link to 2 different places depending on what's given

texts:
I have a content type which contains a website field of type "link." I am creating a view that should have the title which links to the content for each piece of content, unless a link is provided in the website field - then the title should link there.

This is what I am currently trying:

title field is hidden
website field results rewritten so that [title] is the text and it is outputted as a link to [field_website-url].
website field no results are set to go to: [title]

However, this method is not working. It works when there is actually a website URL specified in the website field, but for all others, clicking on the titles links to ".com/link].

Any help figuring this out would be greatly appreciated!


texts: How do I add options from a module page to  list in CKeditor dialog?

texts:
I'm trying to get list values from drupal .module page to ck-editor Plugin.js file iam getting this error
https://snag.gy/ah3Poz.jpg

in my module.module page i have written

function agilecrm_getConfig(Editor $editor) {
  return [
    'pluginName_options' => $this->buildOptions()
  ];
}

in Plugin.js file

CKEDITOR.dialog.add( 'simpleLinkDialog', function( editor )
{
    return {
        title : 'Page',
        minWidth : 200,
        minHeight : 150,
        contents :
        [
            {
                id : 'general',
                label : 'Settings',
                elements :
                [
                   {
                        type : 'select',
                        id : 'style1',
                        label : 'Landing Pages',
                        items: editor.config.pluginName_options,
                        required : true,
                        commit : function( data )
                        {
                            data.style1 = this.getValue();
                        }
                    }
                ]
            }
        ]
    };
});

Please any one help me


texts: Multipart Form Fields - Taxonomy Included

texts:
I'm starting out a new project and I think I've come across something like it before but I can't think of the right search terms or something along those lines...

What I'd like is a module to add multiple fields to one node field. So like a text field and a taxonomy field where I can add multiple of both the taxonomy value and the combined row of the text and taxonomy fields.

I'm near certain I once dealt with something like this once before but I cannot think of it for the life of me.

I have found this: https://www.drupal.org/project/multifield but the problem with this is that it only allows for only ONE value in each field (aka ruining my chances for using it with taxonomy).

So if anyone's run into something similar or can think of a solution to my predicament I would be incredibly grateful for some help. Thanks!


texts: Change title of a node programmatically before displaying it

texts:
I am a newbie at Drupal tweaking. I have copied Bartik theme into sites/all/themes and am modifying it as per our requirement.

One such requirement now is to programmatically modify the node title by appending value of some other field in the node to it before displaying the node. I have identified that the right way to achieve it is by updating the variables in hook_process_page() or hook_preprocess_node() function in template.php file of the theme.

For testing purpose I have done the following change:

/**
 * Override or insert variables into the page template.
 */
function MyThemeName_process_page(&$variables) {
    // Raj: Experimenting
    $vars['site_name'] = 'New title';
    drupal_set_title('Test changed title');
    echo "<script type=\"text/javascript\">alert('MyThemeName_process_page');</script>";
.
.
.
}

I could see that none of the changes are affected. Since I am just beginning to tweak, I have no idea how to debug a php function as it is a server side script. For the same reason I have tried to display alert which fails to display too!

I thought that the function is not being triggered at all, so I intentionally induced error in the 'echo' line by removing a character:

ech "<script type=\"text/javascript\">alert('MyThemeName_process_page');</script>";

The interpreter complains with this error:

  Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /Applications/XAMPP/xamppfiles/htdocs/MyWebsite/cms/sites/all/themes/MyThemeName/template.php on line 48

This means that the interpreter is triggering the function, but why does not it echo and put out the alert?

Also, what is the approach to update the node title? I am assuming that there is some variable which I should be interested in the array "&$variables" and conditionally update it, am I right?

Awaiting help!


texts: How do you create a variable from hook_preprocess_page() that will be available to a node template?

texts:
I have this in my module "spot":

function spot_preprocess_page(&$vars) {
  $vars['social'] = 'hi';
}

Other things I set in this function come through fine. But my node--spot.tpl.php template is complaining that the variable does not exist:

  Notice: Undefined variable: social

I have cleared the cache.

What am I doing wrong?


texts: Show all users in Views that show Content only

texts:
I have created a view wherein it shows content.
But in my view, I wanted to show some contents and the list of the users(dropdown arrow for filtering)

My problem is that, the "USER:" is not available.How can I add user fields in my views that shows Content fields only?
Is there any module I can use for it to become possible?Thanks!


texts:
I know that there are a lot of topic concerning the famous error 500 but i didn't find my answer in one of them.

Actually i have an error 500 when i load admin/people/permissions or when i'am trying to save new permissions. It's not all the time but i will say that it happens 80% of the time.
This permission page is very slow to load and when i haven't this error, it takes my navigator between 30s to 1m to display it.

I used google developper tools for this page and the result of the audit was:

36 requests  ❘  138.40KB transferred  ❘  27.57s (onload: 27.27s, DOMContentLoaded: 25.58s)

I edit my post and follow the trick that gave me H.NiK and i have impressive result for now

38 requests  ❘  17.09KB transferred  ❘  2.34s (onload: 1.76s, DOMContentLoaded: 1.42s

I have a lot of fields on the permission page more than 150 i think (because of the module fields permissions).

I watch the log of my server and i just have the same information:

Premature end of script headers: index.php, referer: http://blabla.com/admin/people/permissions

I have 25 lines of this today on this page.

Have you any idea why i have this error only appears on this page?And maybe how i can track this error and resolve my problem? Is it possible that a module or a js file trigger this error?

ps: i'm on a shared hosting, so i can't touch any configuration on my server (php.ini,my.ini)

Thanks,


texts: View block not accepting contextual filter argument

texts:
I have a Basic Page node and on it I have View block that displays another content type.

The View takes a Contextual Filter Taxonomy term: Term ID with the following settings:

When the filter value is NOT available:
Provide default value - Raw value from URL;Path component: 2;Use path alias

When the filter value IS available or a default is provided:
Specify validation criteria - Validator: Taxonomy Term;Filter value type: Term name converted to Term ID

So if my node has a path of /foo and my term name is bar then if I browse to /foo/bar I'd want to see my Basic Page node with my View filtered by the term bar.

When I test this in the preview widget the view works as expected; only returning the data that is associated with the term bar. When I actually browse to /foo/bar I receive a Page Not Found error.

Any suggestions?


texts: Date Field shows different times in Frontend and Backend

texts:
I have a date field applied to a node. When I set the time in the date field to i.e. 10am and render that date to my website like so:

echo  date('d.m.Y H:i', strtotime($variables['field_date'][0]['value']));

The output is 9:00am. There is only one single timezone set for the whole website, no individual timezones for users are activated.


texts:
I have a view content page. I want to filters its content on the base of a custom form data.
So how we can pass or filter a view content using custom form data there?

View is built on node. In this particular node we have a field type select list.
The same select list we have created in our form. Now what ever option is selected in form, we want to use it's value in view.
We also do not have idea how to use its value.


texts: Views Rewrite return html string instead of rendering them

texts:
I am using Drupal 8.1.3 and in simple views I want to use rewrite feature of views, and I put {{ totalcount }} in rewrite section and on out put I see

Where is the problem and why view template engine not render HTML in rewrite section?
UPDATE
Exactly it that views I try rewrite title field and for it works correctly is seems problem is with statistics total view field !!!


texts: Translate the allowed values list of an entity access field?

texts:
I have a field of type: Entity access field.

In my allowed values list I have:

public|Public
community|Community

I have all of the core translation modules enabled:

Configuration Translation
Content Translation
Interface Translation
Language

I cannot find where in the administrative interface to translate these. Can they be translated in the interface?


texts: How do I remove container div from a specific view?

texts:
I have tried for a few days now, to figure this one out on my own, but have had next to no luck getting a working solution.

The issue:
I have a view that displays a list of images, where all wrappers have been removed, so that it only contains the images themselves. I have also overwritten templates for this view, so that any additional wrappers from templates are also removed.

The issue is that views automatically adds <div class="views-element-container"> around the entire views. Normally this would be fine, but I have no need for it for this view, it's just cluttering the markup.

I know that it in some cases is used for additional functionality, such as the contextual links, but this has also been disabled for this view.

What I have tried:

I have tried to figure out if views also adds a template suggestion to container.html.twig, but sadly found no indication anywhere on what that might be (even if I used normal views template naming convention, it didn't override)
I have tried to access the views render array in a preprocess function, to unset #theme_wrappers, in hopes that this would prevent views from using the container. Sadly this also didn't do anything. Code example below.

function rodekors_preprocess_views_view__paragraph_gallery(&$variables) {
  unset($variables['view_array']['#theme_wrappers']);
}

I simply want to remove the wrapper div from my specific view, yet have found no information on how to do that.

Does anyone know how to achieve this? Preferably without having to install a module for what should be such a simply thing to do.


texts: Cannot export theme settings to the .info file

texts:
I am using Drupal 7. After modifying a setting for my theme in the Appearance menu, I get the following alert message on my site's homepage:

The settings for this theme are currently served from a variable. You might want to export them to your .info file. This is optional and can be done the Drush command 'drush omega-export'.

However, when I try to run the drush omega-export command, it fails:

$ drush omega-export
The drush command 'omega-export' could not be found.  Run `drush           [error]
cache-clear drush` to clear the commandfile cache if you have installed
new extensions.
A Drupal installation directory could not be found                         [error]

This happens even if I run as root. I ran the drush cache-clear drush command successfully, but that unfortunately did not fix the issue. How do I fix this?


texts: Different 'Items Per Page' on different pagination while using 'views_infinite_scroll' module

texts:
I am using views_infinite_scroll module to load more nodes with 10 nodes on every click and views AJAX is enabled.
I am working on a requirement like as, I have 100 total nodes and getting in a view page. On first load, I need to show 3 nodes and on load more load next 10 nodes.
  if(!$view->getPager()->getCurrentPage()){
    $view->setItemsPerPage(3);
  }

I know above code should work in such case. But the problem is "next page doesn't include 4-10 nodes while it will show nodes from 11-20 (next 10 nodes). I need to load ignored 7 nodes (4-10) should also appears on next page (?page=1) along with next 3 nodes (11-13).
I have tried hook_views_pre_render, hook_views_post_render, hook_views_pre_build, hook_views_post_build, hook_views_query_alter etc. but no success to load ignored nodes on next page (?page=1) while load more using AJAX.
Any kind of help or suggestion would be appreciated.


texts: How to rename uploaded file using form API and Drupal managed_file field

texts:
I make a Drupal Form using FAPI (Drupal 7)
in this form I used managed_file field

$form['image_fid'] = array(
  '#title' => t('Image'),
  '#type' => 'managed_file',
  '#upload_location' => 'public://',
);

I want to rename the uploaded file (make the filename = filename+date)

How can I make something like that


texts: How to send notification when node similar to flagged one is posted

texts: I want to send notifications to the user when a new node similar to one he has flagged is posted.


texts:
On my drupal 6 site, from time to time, for no obvious reason, all caches gets cleared. Native caching is enabled (normal caching mode, minimum lifetime 1 day). Cron is not setup to run automaticaly. No rules are created regarding flushing of cache. In meantime I do not do any website manipulation like editing content, editing taxonomy or installing new modules.
What I can see in recent log entries is that users keep logging in and out, users make orders (ubercart 6) and several not found errors probably caused by bots.
What can trigger such automatic/unwanted cache clearing, what logs should I check or how to fix that? Thank you.


texts: How to resend simplenews content for many times - Simplenews module

texts:
I use drupal 7 and simplenews module.I want to send a simplenews for several times.by default simple news module support onetime send to user.but i want to send simplenews to user for several times by UI .
Is any way for resending support in simplenews module ?

Is any other module for edit contents before sending by mail and send it for several times to subscribers?


texts: How to proceed after update.php fails due to memory limit?

texts:
Sometimes i have a "Fatal error: Allowed memory size exhausted" on certain drupal installations with low php memory limit during module or core updates. After such an error i regularly increase this value with the help of my webhoster to avoid this for future updates...

But on the drupal side i'm lost a bit. The system report shows no indication that the update has to be done again and doing it manually shows that there's nothing to update. But this process failed before...

How do i find out if something went wrong during the update.php process?


texts:
I have a taxonomy of devices, I want to add a loop so that when you add new items in the taxonomy came out in the corresponding content:

I don't know how exactly to implement, but thought something like this code:

<?php foreach ($childTaxonomiesArray as $taxonomy): ?>

            <?php print render($taxonomy->field_image); ?>
       <?php print render($taxonomy->title); ?>

<?php endforeach; ?>

could not tell what to write in foreach order to capture the picture and the caption under the categories...
For clarity, you can see the site itself: http://shifonur.2d.uz/medicina


texts: Term reference field: Checkboxes with add new textfield

texts:
I need to change the presentation of a Term reference field. Drupal 7 has 3 widget types:

Select list
Check boxes/Radio buttons
Autocomplete term widget

I need to display check boxes to select 1 or many terms when adding a node, but I also need to display a textfield to allow adding new term.

The autocomplete term widget allows to choose existing terms and add new ones, which is the functionality I need, but what I exactly need is a list of checkboxes with the existing terms and the textfield below that allows adding a new term.

I've searched modules, but I can't find one that allows me to do this. Is there a module that performs this? If not, how do I do this in code? Is there any way to customize the widgets to create that functionality? Thanks.


texts: Drupal 7 Webform settings: how to change the default text in button "next page"?

texts:
I have created a webform with drupal 7 with two pages with "pagebreak" field, but when i go in mysite webform and i view the webform at the bottom of the page there is the button "next page": i have to change the text in this button... and also probably set an image at the place of simple text "next page"..
Thank you !


texts: Moving password change from user/%/edit to another existing tab

texts:
I am using the Authy module. I would like to put the Password change form on the Authy page and then I can rename it to something like 'Security Settings'.

I have learn how to change the tab names in template.php, I know how to unset the password fields from the normal page (using password_tab module as learning guide), but I am stuck on how to actually insert the form into the Authy page.

Any pointers would be welcome.


texts: Calling menu in a certain way from page.tpl.php

texts:
My menu structure looks like the structure in the left part of the image. I want the output to look like the right part of the image when I'm in the 'oranges' page for example. This works great if done from Drupal's admin panel, but is there any way I can code it in my page.tpl.php?

Currently, I'm using the code below to output my menu, but I can't seem to get it to look exactly the way I want.

<?php
  $main_menu = menu_navigation_links('main-menu', 2);
  print theme('links', array(
  'links' => $main_menu,
  'attributes' => array(
  'id' => 'main-menu',
  'class' => array('links', 'clearfix'),

),

  'heading' => array(
  'text' => t('Main menu'),
  'level' => 'h2',
  'class' => array('element-invisible'),
),
));
?>

Any ideas?


texts: Where are the result and facet summaries for a search api view?

texts:
I had a solr search api search view all set up and working with the results showing properly, and an area at the top showing how many results had been found and what facets were applied with little links to cancel those filters.

Unfortunately I had to rebuild the entire thing because of a change in the content types in use.

Now I cannot figure out how to get that results/facets summary bar back.  How do I get that?


texts: Is there a way to dynamically apply a CSS to a menu that includes the taxonomy term of the current page

texts:
For example, if I have page nodes with a vocabulary called "issues", which has terms, such as "budget", "education" and "foreign policies", and there's a menu titled "Information", I want to be able to add a class to that menu link for each page, such as "budget-info", "education-info" and "foreign-policies-info", dynamically.  I assume I can throw in a JS behavior, but if there's a module that does this so the user can manage the class names assigned to each menu, especially that handles tokens and/or PHP so you can throw in part of the current url, that would be better. Note that I don't want to create a menu from taxonomy terms, but a standard item in the main menu with a custom class name applied which is comprised of a combination of a manually supplied name, and a taxonomy term that comes from current node.

Thanks!!


texts: How to restrict editing some node properties (like title / URL) for some users (roles)?

texts:
I would like to know how I can restrict editing some property of nodes (like title / Url) for some users (roles).

So if I give -moderator access- to some users, they don't start messing with urls and I have to make 301.


texts:
Using Drupal 8 and Bootstrap sub-theme.

I see that classes are being added to my divs in the page template file using the following:

<section{{ content_attributes.addClass(content_classes) }}>

That's great. But what if I wanted to add additional classes to these div tags. How would I do that...in my .theme file somehow?


texts: The getBundleInfo method returns only the machine name and label for bundles.  How do I get the UUID of each bundle, or of all bundles?


texts: How to create a view of nodes *without* comments from currently logged in user

texts:
I'm trying to create a view that lists nodes that don't have any comments from the currently logged in user. The nodes may have comments from other users, but if there is no comment from the current user then it should be listed.

I can show nodes with comments from the currently logged in user but not nodes without comments.

Almost like a "to-do" list of nodes that need to be commented on by the current user.

I'm a fairly advance views user (I've tried all I know by way of contextual filters, relationships, different content approaches like listing comments or users and connecting them through relationships... ) but all to no avail.

Anyone else come across this or have ideas where I can make more progress?


texts: Why is my view showing multiple rows despite setting multiple values to display in same row?

texts:
I am using Drupal 8 and have a simple data model that relates Content types of Children, Parents, and Family. The Family content type aggregates Children and up to 2 Parents with entity relationship fields:

I am trying to create a view that displays 1 row per child and lists any parent names in the same row. I am able to create a view (with the content type set to children) and configure the family and parent relationships. Then I added the Child's name and the parent(s) entity relationship field to the view. I had (perhaps incorrectly) assumed that the "Multiple field settings" on the parent(s) field would allow me to emit only a single row per child, and list the parents in that row. I configured the field as shown below, checking the "Display all all values in the same row" option:

While this does list the parent(s) next to each other in the resulting view, it still duplicates the results for each parent item (see how each child has the child name & parents listed twice):

Am I misunderstanding what the "Multiple field settings" option is for? Is there something additional I have to do to get a single row per child content item? I see there is a caveat listed by the multiple field settings option that says "be sure to group by EntityID for this setting to have any effect", but have not been able to deduce where this setting is via forum searches. I have tried grouping by the child id with no luck, and would rather not resort to putting a "unique" filter on the query, as this can be computationally expensive and my system will have large numbers of items. Any advice appreciated, thanks in advance!


texts:
I installed the Token module, and it produced a bunch of errors. I accidentally navigated away from the page displaying the errors, and now I'm left wondering what future problems these errors might cause.

Is there any way to find out what went wrong with the install?

I am using Drupal 7.


texts: How can I make a page with only blocks but without node content ?

texts: I simply removed the $content variable from the tpl.php file and placed only some blocks in several regions. Then the blocks are displayed fine but the message "Page not found" appears. So I suppose this is not the right way to achieve this.I know that for example Views and Panel can make pages with paths defined by their own without node content. But can I still have a page which has its own path and with only blocks but no node content without using Views or Panel?


texts: How to prevent users to go to ?q=user to try to log in?

texts:
I have so many warning messages in my "Reports" that show something like:
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /home/myAccount/public_html/mysite.net/includes/entity.inc).

The details of the reports are:
USER: Visitor (not verified)
LOCATION: http://mysite.net/user
REFERRER: http://mysite.net/?q=user
SEVERITY: warning
I'm thinking that this Visitor is a spammer and tries to get in my website via ?q=user
when I have Clean URLs enabled.
Is there something I'm missing here?
Is there anything I can do about this?


texts: Calling user/token and system/connect through CORS returns anonymous user

texts:
I have two Drupal sites set up. On site A, I'd like to authenticate myself as the currently logged-in user on site B (the remote site) so that I can view and edit nodes on the remote site using the Services module.

The two sites are on different domains, so I'm using the CORS module on the remote site. My CORS config is as follows:

*|http://MY-SITE-URL|*|Content-Type,X-CSRF-Token,Authentication, Origin, Cookie|true

Calling user/token against the remote site gets me a valid X-CSRF-Token. However, when I send the X-CSRF-Token with system/connect, the remote server returns the anonymous user.

I'm trying to authenticate against the remote server with the following code:

$base_url_api = variable_get('tnb_sync_base_url'); //URL of the remote server

            $options = array(
              'headers' => array(
                'Content-Type' => 'application/json',
              ),
              'method' => 'POST',
            );
            //Step 1: grab the authentication token from the remote server
            $response = drupal_http_request($base_url_api . '/user/token', $options);
            $data = json_decode($response->data);

            // Check if login was successful
            if ($response->code == 200) {
              // Add the token to the request headers:
              $options['headers']['X-CSRF-Token'] = $data->token;

              //Step 2: pass along the token and check who we're logged in as
              $response = drupal_http_request($base_url_api . '/system/connect', $options);
              $data = json_decode($response->data);

              kpr($response);

              return $options;

            }

            else {
                return NULL;
            }

The response for the system/connect call looks like:

stdClass Object
(
    [request] => POST /sync/system/connect HTTP/1.0
Content-Type: application/json
X-CSRF-Token: 74xWvd5I5l1ad1WmrIjqZoACo9r7f30YtJx_uCFot_g
X-NewRelic-ID: VQQAU1JbChACUldTBgUFVw==
X-NewRelic-Transaction: PxQBVFRUXQJUUVQGVQkFBVIEFB8EBw8RVU4aVA0KA1cCAQxUVQMLUAcAAkNKQQgKVVAEUgEEFTs=
User-Agent: Drupal (+http://drupal.org/)
Host: dev.tnb.plus
Content-Length: 0

    [data] => {"sessid":"7u8CZ98Gvb1P3ZuKSnK85g2FMkyu8OlqbOp8mnsy7OM","session_name":"SSESS4be586c0dc3085a3ca4f49c7acb4e7d1","user":{"uid":0,"hostname":"2001:4801:7827:0104:be76:4eff:fe11:ccd8","roles":{"1":"anonymous user"},"cache":0,"timestamp":1492095786}}
    [protocol] => HTTP/1.1
    [status_message] => OK
    [headers] => Array
        (
            [date] => Thu, 13 Apr 2017 15:03:06 GMT
            [content-type] => application/json
            [connection] => close
            [set-cookie] => __cfduid=dc62becfa48db03b7f5e40b426d0f587c1492095786; expires=Fri, 13-Apr-18 15:03:06 GMT; path=/; domain=.tnb.plus; HttpOnly
            [access-control-allow-credentials] => true
            [access-control-allow-origin] => http://dan-northern-portal.pantheonsite.io
            [cache-control] => no-cache, must-revalidate
            [expires] => Sun, 19 Nov 1978 05:00:00 GMT
            [surrogate-key] => AuKS06yStxtoXZf2mZvq kFG3DJ+3z7Lu2WK6wNkS
            [surrogate-key-raw] =>
            [vary] => Accept-Encoding, Accept
            [x-content-type-options] => nosniff
            [x-drupal-cache] => MISS
            [x-pantheon-endpoint] => a9463df4-67b3-47b9-ad41-148336613222
            [x-pantheon-styx-hostname] => styx94699a92
            [x-styx-req-id] => styx-e58976d158f4a1f2e669efc5205db167
            [x-styx-version] => StyxGo
            [xkey] => AuKS06yStxtoXZf2mZvq kFG3DJ+3z7Lu2WK6wNkS
            [x-varnish] => 952125076
            [age] => 0
            [via] => 1.1 varnish-v4
            [server] => cloudflare-nginx
            [cf-ray] => 34ef4f698acf2513-ORD
        )

    [code] => 200
)

How can I properly authenticate myself on the remote site using Services and CORS?


texts:
I've created a content type that contains a form. In this form, there is a textfield that i want to make only readable + a specific value on it (if user A is editing this form, he can write on all textfields except this textfield that will contains : user A)

In the other side, I've a custom module that deals with users, so I have users with users ID, usernames..ect the username is the text that I want to automatically set on the content types textfield

I can't show you any code because as I said, it's a content type

Any help is great


texts: Permission to submit webform only for the author of the node

texts:
I'm using webform 8.x for a personal project and I'd like to know if it possible to enable only the author of the node to submit the form.

In my project each node is an aquarium, and I am using webform to collect the all the daily data for that specific node ( aquarium ), like temperature, pH, KH ecc.
I was able to create a view related to the node (aquarium) where you can see the data submitted daily for that specific aquarium, but the problem is that everyone can submit the form, while I need only the author of the node to be able to submit the webform.

Can you please give me some ideas? I'm stuck..


texts: Value or label inside a exposed search form and change input form

texts:
I've created a three exposed filters:

Search
Choose location
Choose category

Instead of using a label "Search", in input field I want to have a "enter keywords to search" and when the user clicks on that input the letters will disappear. I've seen this in many websites.

Choose location has a label "Choose location" and in drop down menu the first option is "All". Instead of using label, I want the first option (All) to be "Choose location".

Choose category to be exactly like the location desired method.

I'm using Drupal 7.


texts:
I'm using the FAQ module on my Drupal website; I noticed that, on one of the questions, the answer has been completely cut off.

I've tried changing input format (e.g. full HTML instead of WYSIWYG), but I'm still having the same problem.

Is there any problem with the module, or am I doing something wrong?


texts: How to display user form and hide some fields?

texts:
I'm building a website which has a member section. People subscribe and complete the "user" form (username, email, password and some other fields).

For an additional fee, they can be part of the "dating" part of the website, where they can meet new people.

After paying, I would like them to complete a form about them (height, eyes, etc.). Those fields are already in the user form.

I'm displaying the user form this way :

global $user;
module_load_include('inc', 'user', 'user.pages');
return drupal_render(drupal_get_form('user_profile_form', $user));

How would i go about hiding some fields that I don't want them to see/modify?

Thanks!


texts: Is it better to hard code everything or use the ui?

texts: Is it better to hard code everything or to use the ui?  For example, is it better to field and entity with the UI or to add fields/instances programmatically?  Does it really matter?  What is the 'best practice'?


texts: I have set up Google custom search module. It shows to search forms, how to remove one?

texts: I have set up Google custom search module. It shows two search forms, how to remove one?


texts: How to check if field is empty and hide a css class in render array?

texts:
I am new to drupal core development any help will be much appreciated.
I have a tab group from content type hidden from anonymous users (by default) when the field content within the tab is empty, how do I hide this tab when login in editors are viewing the same content.

This is what I have done so far in my node.inc using template_preprocess_node

function template_preprocess_node__event(&$variables, $hook)
{
//  kpr($variables);
$node = $variables['node'];
//  kpr($node);
$custom_tab = field_get_items('node', $variables['node'], 'field_route_text');
$custom_tab = (!empty($custom_tab)) ? kpr ('not empty from node') :  kpr('empty from node');

// jQuery UI accordion lib
drupal_add_library('system', 'ui.accordion');
}


texts: Custom module administration page template not working

texts:
I've been trying to load a custom template for a custom module page in the administration section, but the template isn't being loaded. This is the code so far:

custom_theme.module

/**
 * Implements hook_menu().
 */
function module_custom_menu() {

    $template_path = drupal_get_path('module', 'module_custom') . '/templates';

    $items['admin/module-custom'] = array(
        'title' => 'Turnos',
        'description' => 'Custom module functionality',
        'position' => 'right',
        'weight' => -15,
        'page callback' => 'system_admin_menu_block_page',
        'access arguments' => array('administer site configuration'),
        'file' => 'system.admin.inc',
        'file path' => drupal_get_path('module', 'system'),
    );

    $items['admin/module-custom/availability'] = array(
        'title' => 'Captación de disponibilidad',
        'description' => 'Users availability functionality',
        'page callback' => 'user_availabity',
        'access arguments' => array('administer site configuration'),
        'type' => MENU_NORMAL_ITEM,
    );

    return $items;

}

/**
 * Implements hook_theme()
 */
function module_custom_theme($existing, $type, $theme, $path) {

    $template_path = drupal_get_path('module', 'module_custom') . '/templates';

    return array(
        'user_availability' => array(
            'variables' => array('users', NULL),
            'template' => 'module-custom-admin',
            'path' => $template_path
        )
    );

}

/**
 * Load user availability
 */
function user_availabity() {

    $users = entity_load('user');
    return theme('user_availabity', $users);

}

module-custom-admin.tpl.php

Template subtitle

    <?php foreach ($users as $key => $user) : ?>

            <?php print_r($user); ?>

    <?php endforeach; ?>

But the template's code isn't shown:

Thanks for any advice.


texts:
I need to grab referer and save it for the first time (I save it to sessions) and when the user gets to a specific page forward it. My problem is that after opening page with the same referer few times, I am not getting referer anymore. I tried it with few different browsers in private/incognito mode but after a few tries it gets cached and does not return anymore. My Code :

function HOOK_template_preprocess_default_variables_alter(&$variables)
{
    $request = Drupal::request();

    var_dump($request->headers->get('referer')); //stops dumping after few times

    $_SESSION['referer']['url'] = $request->headers->get('referer');
    $variables['#cache']['contexts'][] = 'headers:referer';
}

Is there a way to save referer for every anonymous user that comes to website?


texts:
I've got a column of links to files in a table. They're displayed via file-fields with  'Output this field as a link" enabled in Rewrite Results. It's works great with fx images but width pdf's the table only shows the filename, not the path to it.

Any ideas on how to always show the complete path to a file no matter the file type?


texts: In a view, how can I link a field to the node?

texts:
In a fields view, the "title" field has a check box "Link this field to the original piece of content". But this check box isn't available for other fields. How can I achieve this functionality for other fields?

E.g. in my case I have a custom "subtitle" field, and I would like to list the nodes subtitles. The subtitles should be links that point to the node.


texts: Problem with text format and base64 inline images

texts:
I am using Drupal 8.6.13 text field with Full HTML text format for a field where we want to have content with inline base64 images (due to the synchronization with Gather Content).

Synchronization works well and images content is being saved in a Drupal text field but "data:" part is somehow filtered out - most probably by the Text format filter.

Long text field's source content:

becomes

after saving.

Limit allowed HTML tags and correct faulty HTML is active for Full HTML text format. We need this to limit heading types. If I disable "Limit allowed HTML tags" option then it works as expected.

Allowed tags are:

 <s>

 <button>

Any idea how to prevent data: from being filtered out of the src attribute of an image tag and keep "Limit allowed HTML tags" option active?


texts: When I click on the "Delete comment" link, I get redirected to a page that tells me to confirm the action. How can I avoid this redirection, as I have build a pop-up that asks for confirmation?


texts: Unable to get the column of a custom table in the views table using hook_views_data()?

texts:
I am writing the following code with hook_views_api() and hook_views_data().
I am able to get the fields of table_in table into list of fields
.But after adding the fields view is not saved and it keeps on loading and preview is not displayed and it keeps on loading

Here table_in is custom table and table_nid is the column of table which has nids matching with node nid.

function hook_views_data() {
  $data['table_in']['table']['group'] = t('table_in');

  $data['table_in']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'table_nid',
    ),
  );

  $data['table_in']['def'] =array(
    'title' => t('def Code'),
    'help' => t('Study def code'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  return $data;
}


texts: What will happen if I delete 'page.tpl.php file'? Is there any alternative for this file?

texts: I deleted page.tpl.php file from my current theme, and noticed that all content is still rendering in my Drupal site with a little difference in structure. What is the real use of this file? Can we have any alternative or a replacement for this file?


texts:
I am looking for a way to create a table entry form for an entity type. We are trying to create an invoice form.  I am currently using a field collection for each invoice line.

Order (node)
  Invoice (node)
    Invoice line (field collection)

I am currently using the field_collection module along with field_collection_table.  I am using entity reference to connect the invoice to the order and invoice line This works great except when we have more than roughly 75 rows.  At that point we are unable to add new rows to the table. Users are getting a 500 AJAX error.

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Internal Server Error
ResponseText:

Originally I received an error about max_imput_vars limit of 1000 when we got to about 50 lines.  I have since changed the limit to 100000.  Now nothing shows up in the server error log or the Drupal recent log messages.  My PHP settings are:

memory_limit = 256M
max_execution_time = 120
max_imput_time = 120
post_max_size = 160M
upload_max_filesize = 128M
max_input_vars = 100000

My thought now is to create a custom entity for invoice line.  The trouble is how to display this entity as a table and allow users to edit multiple items at once.  Some invoices could have 500 rows and I need a way for users to be able to quickly move from line to line.  For non-Drupal forms I have used jQuery to dynamically add new rows to a table.  Not sure how this would work for Drupal since each field in the table has an id that is specific to each row (e.g. edit-field-desc-und-31-value).

Any suggestions?  A separate but important issue is a need to regularly autosave.  Users would not be happy if they added 300 rows and lost power, computer froze, or something else happened.


texts:
in /var/aegir/platforms/drupal8-dev/sites/my_site_uri/settings.php

  # Additional site configuration settings.
  if (is_readable('/var/aegir/platforms/drupal8-dev/sites/my_site_uri/local.settings.php')) {
    include_once('/var/aegir/platforms/drupal8-dev/sites/my_site_uri/local.settings.php');
  }

in /var/aegir/platforms/drupal8-dev/sites/my_site_uri/local.settings.php

       <?php # local settings.php

$settings['container_yamls'][] =DRUPAL_ROOT . '/sites/default/services.yml';

in /var/aegir/platforms/drupal8-dev/sites/default/services.yml

 parameters:
   twig.config:
     debug: true
     auto_reload: null
     cache: false

The firebug console comments are working meaning twig debug is activated but dump (twig debug extension ) is not working .  why?
is there anything more to set in services.yml ?

  {{ dump() }}


texts: How to add a Rules Condition to only allow voting for users with at least 30 user points?

texts:
I want to put condition when userpoints>=30, then user is able to vote.

For this, I did following steps-

ON event- "User votes on a node" the condition selected is "Compare current Userpoints" and in the condition part put ">=30".

I am using following modules: Rules, User Points and Vote Up/Down.


texts: All html styling is stripped in mails sent with HTML mail and SMTP Authentication

texts:
I use the SMTP Authentication Support module in combination with the HTML Mail module. I have set it up according to this post (https://www.drupal.org/node/1200142).

After writing the new classes as instructed in the post above, the mails are sent successfully, but all the styling is stripped in the mail.

When I use only the HTML Mail class, and don't use the SMTP class, this does not happen. But then the emails dont get through to many recipients. I need to use the SMTP Authentication to get my emails delivered.

The check box  Allow to send e-mails formatted as Html is checked in the settings for SMTP Authentication Support module.

Also, I use the htmlmail.tpl.php template file in my theme, which works when SMTP Authentication class is not used.

Any ideas about this problem? Why is my template file ignored when using SMTP?


texts:
I have a large csv of nodes that need to be deleted from the database.

I need something like feeds but for deleting. I know this can be accomplished easily via a custom module but I'm just wondering if there's a module or feed extension I can use.


texts:
I have made an ajax request to update the select options based on the first select field selection

but the respond only works fine with the first request despite being seen with firebug

help me solve it please

thanks in advance

here is the code

 function listings_form_alter(&$form,&$form_state,$form_id){
    $governments=array();
  if($form_id == 'place_node_form' && arg(1)=='add' && arg(2)=='place'){
    $vocabularies=taxonomy_get_vocabularies();

  foreach($vocabularies as $vocab){
      if($vocab->machine_name =='governorates'){
          $_SESSION['vid']=$vocab->vid;
          break;
      }
  }
        $options=array(0=>'choose gov');
  $g=taxonomy_get_tree($_SESSION['vid'],0,1,FALSE);
  $x=count($g);
  for($i=0;$i<$x;$i++){
                  $options[$g[$i]->tid]=$g[$i]->name;
  }

   $form['gov']=array('#title'=>'Gov','#name'=>'governorate'
,'#type'=>'select','#options'=>$options
     ,'#ajax'=>array('callback'=>'ajax_callback',
  'event'=>'change','wrapper'=>'replace','method'=>'html'));

 $op=array(0=>'choose city');
$form['city']=array("#title"=>'City','#name'=>'city',
'#type'=>'select','#prefix' => '
',
'#suffix' => '
','#options'=>$op);

function ajax_callback($form_state,&$form){

$childs_obj=  taxonomy_get_children($_POST['governorate'],$_SESSION['vid']);
foreach($childs_obj as $child_item){
    $op[$child_item->tid]=$child_item->name;
}

$form['city']=array("#title"=>'City','#name'=>'city','#type'=>'select','#prefix' => '
',
        '#suffix' => '
','#options'=>$op);
return array(
'#type'=>'ajax', '#commands'=>array(ajax_command_html("#replace", render($form['city'])),
ajax_command_alert($_POST['governorate'])
    )

);
?>


texts: How can I remove the title in a specific node?

texts:
I am working in Drupal 7.

How can I remove or hidden the title in a specific node (not in the content type of the specific node)?


texts: How to get Views Criteria Filter arguments inside Views API hook?

texts:
My question is related to:

https://drupal.stackexchange.com/questions/70551/how-to-sort-view-by-taxonomy-multiple-value-field-with-a-range-of-only-selected

I have an idea, but I didn't manage to find a way to get arguments passed to Views Filter Criteria.

I would like to get them inside hook_views_pre_render

Could someone give me any advice?


texts: I need to add support for importing either kml file or shapefiles, preferably using feeds.  The idea is that each record relates to a single node, and the file uploaded could contain hundreds of new nodes.  I've tried Spatial Tools, but the feeds import only works in Drupal 6.  I've also tried GDAL, but it requires the php gdal extension, which has to be compiled.  I'm using windows (not by choice!) and don't have easy access to the compiler and tools necessary, so this is not really an option.  Does anyone know of a way to get either of these to work, or if there is a better way to support importing spatial data?


texts: Duplication of files when using Acquia Dev Desktop

texts:
I am creating a Drupal site using Acquia Dev Desktop. I have noticed that there seems to be duplicate files located at

C:\Users\Sam\Sites\devdesktop\columbiablooms-dev\docroot\sites\all

and

C:\Users\Sam\Sites\devdesktop\openoutreach-7.x-1.19\sites

"Sam" is my Win 7 logon. Columbiablooms is the name of the site I'm building. Using Acquia Dev Desktop I pushed the site up to Acquia. What is the relationship between the two file paths?

Does the C:\Users\Sam\Sites\devdesktop\columbiablooms-dev folder have anything to do with multisite or is it necessary for Acquia Dev Desktop? Having stuff duplicated seems a waste and causes confusion for a newbie like myself.


texts: How to add one entity reference field that can reference either a node or a user?

texts: I'm looking to create an entity reference field that can reference either nodes from a specific bundle, or users. Is their a way to do this either with a module , or programmatical,y?


texts:
I'm converting some old Drupal 6 code. Some template files for custom content types use code similar to the following.

if (some_parameter) {
  header(/* Set the MIME type for the image type */);
  readfile($image_file_name);
  exit();
}
else {
  // return HTML markup.
}

This used to work, although it is very ugly.

With Drupal 7, it does not work anymore. I believe it applies some templates when I just need the raw image file output with the MIME type I set.

What is the way to properly do this in Drupal 7? I already have the image as a file, but that is done in code, so I could put the image file anywhere, maybe even in the database. However it's not a user-uploaded file.


texts: Bibliography module url search as anonymous user

texts:
I have a problem with the Bibliography Module module and its filter/search functionality.

Via URL it is possible to search for specific keywords:

/biblio?f[search]=Smith%2C%20S.

would search the publications for Smith, S.

If I am logged into D7 as an admin, this works perfectly. But if I change to another user or log our completely, this is not working anymore and shows me:

  No items found Modify or remove your filters and try again.

I tried to change some permissions, even gave user all the permissions an admin has (just for testing). And it works just, if I enable the ultimate permission:  Bypass content access control.

So obviously it is a permission issue. Any ideas, how to solve this issue?


texts: How to theme the taxonomy add/edit term form?

texts:
I would like to change the design of the taxonomy add/edit term form, how do you create a template for the taxonomy "Add Term" / "Edit Term" just like creating a node form template? Not creating a custom module because I already have some custom fields for my term.

As of now this is the code on my template.tpl

'admin/structure/taxonomy/type_of_category/add' => array(
        'arguments' => array(
            'form' => NULL,
            ),
       'template' => 'templates/type-of-build-your-event-category-taxonomy-form-term', // set the path here if not in root theme directory
       'render element' => 'form',
    )

These are the filenames I've tried for my template file:

taxonomy-term--type_of_category-taxonomy-form-term.tpl.php
type_of_category-taxonomy-form-term.tpl.php
taxonomy-form-term.tpl.php
type_of_category.tpl.php

None of it works.

Does anyone have any suggestion on how to make this work?

Thank you in advance!


texts: Adding autocomplete to title field of node form

texts:
I created a small custom module to help users while creating a specific content type.  Basically the module just adds the autocomplete feature to the title field to show possible duplicate nodes to the user while filling out the form for "on-the-fly" feedback.

The problem is that the autocomplete only works for users with the permission 'Administer nodes'.  Is this normal or am I doing something wrong?  If it is normal, is there another way to achieve these results without handing out that permission?

Custom module:

<?php
/**
 * Implementation of hook_menu()
 */
function duplicates_menu() {
  $items = array();
  $items['duplicates/check'] = array(
    'title' => 'Check for duplicates',
    'page callback' => 'duplicates_check',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
}

/**
 * Implementation of hook_form_alter()
 */
function duplicates_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'company_node_form') {
    $form['title']['#autocomplete_path'] = 'duplicates/check';
  }
}

/**
 * Check for duplicates
 */
function duplicates_check($check) {
  $duplicates = array();
  if ($check) {
    $results = db_query('SELECT title FROM {node} WHERE type = "company" AND LOWER(title) LIKE LOWER("%%%s%%")', $check);
    while ($dupes = db_fetch_object($results)) {
      $duplicates[$dupes->title] = check_plain($dupes->title);
    }
  }
  print drupal_json($duplicates);
}


texts: How can I use View modes for entity without bundles?

texts:
I have an entity that has no bundles(ie. it has itself as a - 1 - bundle) and I need to be able to use View modes for it.

My understnading is that the Field UI needs the 'bundle of' entity to exist in order to attach itself to it.

Is somehow possible to get around this?

Should I file an issue on d.org?


texts: Drupal 6 Module Storing configuration setting in file

texts:
I have built a module that uses encryption and I need to store the encryption key somewhere so that it is configurable.

I would like to put it in a file (the equivalent of web.config of .NET website) so that it can be altered but is safe.

Assuming the web server will take care of restricting access to the file, where should I put this file? Is there an existing file for adding configurable settings to per module or even per website (and how can I read these)? Do I have to do something on module install, or in the module info file?

Any help would be appreciated.


texts: How to remove language indicator in content region?

texts:
It took me a while to figure out how to remove the language switches from the bottom of each page. Eventually the switch was in a somewhat logical location (Multilanguage settings > Article options). (Oh, new question. I translated those menu items myself, because - mysteriously - my "backend" is in German. I don't remember how that happened. Everything I can find, default language, user language, is set to English. Where can the "backend" language be set?)
But what I've come here for:
There still is a language indicator at the bottom of each page ("Language: English"), and I cannot find how to get rid of that. CSS would be fine, but it does not have a specific class/id, so I cannot grab it.


texts: How can I keep logs of all outgoing emails?

texts: I am using SMTP Authentication Support module to send emails with drupal 8.When I see watcdog mail-log from admin it shows only emails sent for registration or password reset, that is also with single line like registration email send to... I did not found any logs related to email sent me for orders status. I have installed devel_mail_logger to keep logs but than I did not received those email which are listed in devel_mail_logger log list, any suggestion how can I keep all email logs with content & errors(if any).


texts: How to create a user with custom fields?

texts:
On my drupal site, using the User module, I have added extra fields to the user registration form such as 'Organization'. I notice that this has created a mysql database called 'user__field_organization'.

I am trying to write a custom module which involves creating new users.

At the moment my module creates a new user, with a username, password and email.
The code for this (which works fine) is:

$user_data = ['name' => 'John', 'mail' => 'email@me.co.uk', 'pass' => 'examplePassword','status' => 1,];

$this->user = $this->user_store->create($user_data);

(where $this->user_store = $etm->getStorage('user'); )

But I also need to update the extra fields such as Organization but can't work out how to do this.

I have looked at this question: How to programmatically create new user with custom fields?

And I have tried adding custom_field_organization or user__field_organization into $user_data but it doesn't work.

I have been trying to find out where in the User module a user is created once the registration form is submitted. If I could find that then I could copy what is done there.


texts: Which module should I use to visualize my Google Analytics Data using the Google Charts engine?

texts:
I would like to import Google Analytics data of my site into my site, so that I can visualize them with the (interactive) Google Charts API.

Which module(s) should I use for this?


texts: Template override from sub-sub-theme does not work

texts:
I try to override a specific content type node template. Let's say node--some-type.tpl.php. I use the mothership as a base theme based on that I defined a sub-theme let's call it A.

Overriding the template in A works perfectly fine. Now I like to create another sub-theme based on the A sub-theme let's call it B.

Overriding the same template (node--some-type.tpl.php) doesn't work anymore. It always takes the overridden template file from sub-theme A instead of B.

Is there any special thing I have to respect when I like to override a template file in a sub-sub-theme?

I deleted theme registry multiple times and cleaned the whole cache using drush cc.

Any ideas why this does not work?


texts: Drupal 7 views admin redirecting to json returned after changing jquery version

texts:
I have installed the seven theme on the admin side and blocks theme on the user side...
after getting alot of errors from multiple files adding jquery library, i have removed the extra files and upgraded the jquery in the misc directory to 1.9 with migration plugin.

the main problem was that wysiwyg and hierarchical select didnt work on the front end,
so after removing the extra jquery libraries it is working now.

the problem after all that is that now when i try to edit a View, each time i edit something in the view and click on save, it redirects me to the json returned from server instead of just closing the dialog and showing the View edit panel.

In short the problem is that the ajax doesn't work.

So What Should I Do??


texts: D8 - Paragraphs - Multilingual - Content Erasing

texts:
I'm running into an issue on my D8 site where Paragraphs (module) content is erasing from a replicated node when I change the language of the replicated node.

I am using Paragraphs 8.x-1.1, Replicate 8.x-1.x-dev, Replicate UI 8.x-1.x-dev, and Drupal core is a little behind at 8.2.3.

I understand there's some issues with Paragraphs and translating and I found that others seem to have this working, but I'm wondering if there's something small (hopefully) that I'm missing in order to get this working.

A similar thread to mine can be found here regarding deleting the cloned nodes.

Thank you in advance!


texts: How do I display taxonomy content from taxonomy category?

texts:
I have fields in taxonomy under category taxonomy. Attempted views but couldn't find taxonomy fields to add as fields :(

Do not want node fields.

What I did is:
1. Create taxonomy, category
2. Add terms, dog, cat, etc
3. Add fields such as image, description, etc

So on view, all terms under category taxonomies appear in a view with description, images and more.

How do I display all taxonomy terms' content under category?

Updated

Vocabulary: Categories
Taxonomy: Body Contouring for example.
Inside, it has the description and image.

So wanted to list taxonomies with their details in grid layout. Attempted views, but it is only all content type related to taxonomies' id.

I only need content from taxonomies. How do I display taxonomies' content?


texts: mapping of menu Name "Main Menu" with variable name: primary_nav

texts:
I am new to Drupal and would like to  know the details of constant/global variable:  $primary_nav
 Observed this variable is pulling list of links from a Menu with Title : "Main Menu" .
 I try to see the mapping of these in UI and DB, but could not find.
Can you please help me to find out the mapping of this menu Name (  "Main Menu" )  with variable name : primary_nav  and where is it defined.


texts: Save a new value with entity_metadata_wrapper to an entity field which is an array

texts: I need to save a new value to a field on an entity and I was wondering if it was possible to use entity_metadata_wrapper or is it only possible to set an existing value?


texts: Webform with Content Access module not allowing access for the authenticated user role

texts:
I've run in to an interesting problem that I've not been able to solve yet.

I've got a webform that is restricted to only be able to be accessed by users with a certain role, called "member".

But upon testing I see that users with this 'member' role are not allowed to access the webform unless I have the content access per node allow for anonymous users to access it as well. When I allow "anonymous" access to the webform,  I can actually get it to come up for the member role.

When a logged in "member" tries to access the webform I'm getting the "accessed denied" page.

On the actual form itself under webform > Form  settings I've got the "submission access" set to allow my "member" role, but not anonymous users.

I've looked at the general user permissions too, and everything seems to be in place:

checked: view published content
checked: Access own webform results
checked: access own webform submissions

I've enabled access control on the webform content type itself, and allowed anonymous as well as authenticated (and "member") access to all webforms generally.

I'm using the Content Access module to attempt to restrict access to this particular node/form to authenticated "members". Both authenticated and member roles are checked so as to allow access.

That role is assigned upon a user completing their checkout, and I've double-checked to make sure it's appropriately assigned and it's in place. This part works fine.

I cannot have this webform open for anonymous users.

Any ideas as to what's keeping this node from being able to be accessed?


texts: Get body summary in field's replacement pattern

texts:
Is it possible to get the body's summary within a view field's replacement pattern?

What I am doing right now is this:

{{ field_icon }}

<div class="description">
    {{ title }}
    {{ body }}
</div>

As the body text is too long I tried using {{ body.summary }} instead of {{ body }} but that didn't work at all..

Could you tell me whether there is a possibility to do this inside of a replacement pattern?

Thank you!


texts: How to filter published content using view with REST

texts:
I'm using Drupal 8 and I've created a view with REST. I would like to filter my content, so I've created a field criteria and I've added a Published field and exposed.
When I use /my-view-path?status=1 show me published content,
when I use /my-view-path?status=0 show me unpublished content,
those are working good. But I would like to use /my-view-path?status=All and show me published and unpublished content.
This is how I've configured published field:

But I don't know how to do that, any help?


texts: Convert a static query to dynamic one, with a having clause

texts:
i am writing a patch for ubercart 3, for a attribute ignore module i am building.
For this module, i need to be able to query alter the query for the uc_product_adjustments_form.

I need to convert the static mysql query to a dynamic one.

This is what the static query looks like:

$result = db_query("SELECT pa.nid, pa.aid, pa.ordering, pa.display, a.name, a.ordering, ao.aid, COUNT(po.oid)
    FROM {uc_product_attributes} pa
    LEFT JOIN {uc_attributes} a ON pa.aid = a.aid
    LEFT JOIN {uc_attribute_options} ao ON a.aid = ao.aid
    LEFT JOIN {uc_product_options} po ON ao.oid = po.oid AND po.nid = :po_nid
    WHERE pa.nid = :pa_nid
    AND pa.display <> :pa_display
    GROUP BY ao.aid, pa.aid, pa.display, a.name, pa.ordering, a.ordering, pa.nid
    HAVING count(po.oid) > 0
    ORDER BY pa.ordering, a.ordering", array(':po_nid' => $nid, ':pa_nid' => $nid, ':pa_display' => 3));

And this is what i got so far:

$query = db_select('uc_product_attributes', 'pa');
  $query->leftJoin('uc_attributes', 'a', 'pa.aid = a.aid');
  $query->leftJoin('uc_attribute_options', 'ao', 'a.aid = ao.aid');
  $query->leftJoin('uc_product_options', 'po', 'ao.oid = po.oid AND po.nid = :po_nid', array(':po_nid' => $nid));
  $query->fields('pa', array('nid', 'aid', 'ordering', 'display'));
  $query->fields('a', array('name', 'ordering', 'aid'));
  $query->fields('ao', array('aid'));
  $query->condition('pa.nid', $nid);
  $query->condition('pa.nid', $nid);
  $query->groupBy('ao.aid');
  $query->groupBy('pa.aid');
  $query->groupBy('pa.display');
  $query->groupBy('a.name');
  $query->groupBy('pa.ordering');
  $query->groupBy('a.ordering');
  $query->groupBy('pa.nid');
  $result = $query->execute();

So everything works, except for the HAVING clause, which i don't understand to be honest.

Many thanks!

-- Tom


texts:
One of the actions that comes with the Rules module is 'set breadcrumb'.

When trigger this action, however, nothing seems to happen to the breadcrumb.

What is supposed to happen? Does it set the breadcrumb on the page that the user was on when it was triggered, or on the page whose path is used in the action? Why isn't it doing anything, or is it doing something, and if so, what is it doing?


texts: Duplicate / Triplicate inline javascript

texts:
On some pages of my site when inline javascript has been added to page it get added multiple times.

I've looked through my base theme (Zen) and my default theme (custom) for anything that may be messing with the drupal_add_js process but I haven't been able to find anything.

Does anyone have any suggestions for what might be causing this?


texts:
This is my Config entity:

 * @ConfigEntityType(
 *   id = "myentity",
 *   label = @Translation("My Entity"),
 *   controllers = {
 *     "storage" = "Drupal\Core\Config\Entity\ConfigEntityStorage",
 *     "list_builder" = "Drupal\mymodule\Controller\MyEntityListBuilder",
 *     "form" = {
 *       "default" = "Drupal\mymodule\Form\MyEntityForm",
 *       "delete" = "Drupal\mymodule\Form\MyEntityDeleteForm",
 *     },
 *   },
 *   admin_permission = "administer mymodule",
 *   config_prefix = "myentity",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "name",
 *     "url" = "url",
 *     "status" = "status"
 *   },
 *   links = {
 *     "canonical" = "mymodule.myentity_info",
 *     "add-form" = "mymodule.myentity_add",
 *     "edit-form" = "mymodule.myentity_edit",
 *     "delete-form" = "mymodule.myentity_delete",
 *   }
 * )
 */

The MyEntityDeleteForm:

/**
 * @file
 * Contains \Drupal\mymodule\Form\MyEntityDeleteForm.
 */

namespace Drupal\mymodule\Form;

use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Url;

/**
 * Defines a confirmation form for deletion of a custom menu.
 */
class MyEntityDeleteForm extends EntityConfirmFormBase {

  /**
   * {@inheritdoc}
   */
  public function getQuestion() {
    return t('Are you sure you want to delete the myentity %title?', array('%title' => $this->entity->label()));
  }

  /**
   * {@inheritdoc}
   */
  public function submit(array $form, array &$form_state) {
    $this->entity->delete();
    drupal_set_message($this->t('The entity %title has been deleted.', array('%label' => $this->entity->label())));
    $form_state['redirect_route'] = $this->getCancelRoute();
  }

  public function getConfirmText() {
    return $this->t('Delete');
  }

  /**
   * {@inheritdoc}
   */
  public function getCancelRoute() {
    return $this->entity->urlInfo('canonical');
  }
}

The route defined in routing.yml:

mymodule.myentity_delete:
  path: '/admin/config/search/mymodule/myentity/{myentity}/delete'
  defaults:
    _entity_form: 'mymodule_myentity.delete'
  requirements:
    _entity_access: 'mymodule_myentity'

I'm getting this error while trying to delete the entity:

Notice: Undefined offset: 1 in Drupal\Core\Entity\EntityAccessCheck->access() (line 46 of core/lib/Drupal/Core/Entity/EntityAccessCheck.php).
Drupal\Core\Entity\EntityAccessCheck->access(Object, Object, Object)
call_user_func_array(Array, Array)
Drupal\Core\Access\AccessManager->performCheck('access_check.entity', Object, Object, Object)
Drupal\Core\Access\AccessManager->checkAll(Array, Object, Object, Object)
Drupal\Core\Access\AccessManager->check(Object, Object, Object)
Drupal\Core\EventSubscriber\AccessSubscriber->onKernelRequestAccessCheck(Object, 'kernel.request', Object)
call_user_func(Array, Object, 'kernel.request', Object)
Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'kernel.request', Object)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', Object)
Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\HttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

And this message on the page:

Access denied
You are not authorized to access this page.


texts:
In scanning a Drupal 7 site with Qualys, we're getting the issue

  150122 Cookie Does Not Contain The "secure" Attribute

Is there a way to systematically add the Secure vs HTTPOnly flag to cookies? Would Secure Cookie Data serve this? If so, how do I test that Cookies are secure?

Moreover, this site automatically forwards to https. The user spends no time over port 80 but instead is directly shuttled to 443. We have an administrator who wants nothing but to see this test passed; regardless of the previous fact.

The Cookie in Question:

has_js=1

Would the following in settings.php be sufficient:

ini_set('session.cookie_secure', 1);
ini_set('session.cookie_httponly', 1);


texts: Alter main menu button text and URL path depending on OG Role

texts:
I know you can change menu links depending on drupal based roles (authenticated, non authenticated...) and by using Rules module also.

I am using Organic Group roles and I am having difficulties in showing different links on the menu bar depending whether my site's user IS or ISN'T a member of a group.

When he/she signs up a 'join' button is on the nav bar --> after joining a group he can now write content so the 'add' button replaces the join button on the nav bar with the appropriate URL paths.

Can a hook be used to do this?


texts: Which mysql tables contain the URL Alias path data?

texts: Im looking to manually change a node's URL path as my edit button throws me an error upon clicking it since this was due to orphaned data left over from some other uninstalled modules. Which tables contain the URL alias path data in Drupal 7?


texts: Redirect loop, add-{type}-node redirects to add-{type}-node for non-admin users when parent type not availab.e

texts:
Users without admin permissions get a redirect loop error when they try to create a certain (organic group content) content type, when the parent (organic group) content type does not exist.

That is, instead of getting the edit form or a 403 error, they go straight to a redirect loop error. We do not have have any 403 redirect overrides, so that's not the cause. The .htaccess file is the default one provided by the Drupal installation.

Using the "display redirection page" reveals that the add node form is redirected  to the add node form in this situation. I've been unable to find any any Rule or other setting that could be causing this.

I am not using the Global Redirect module (which research indicates is the most common cause of this problem). Putting the site into maintenance mode and turning off all path, url, and indexing related modules, including Pathauto and Rules, (and reverting to the default Drupal theme) doesn't solve the problem.

The problem does not occur for anyone with the "override access permissions" privilege set.

Any thoughts

as to what might be causing this or
next steps I can take trying to debug this problem?


texts: Commerce Multicurrency is not converting the field provided by the Commerce Free Price Formatter Module

texts:
I am using Commerce Free Price Formatter module so that I can show 'request' text if price is zero, but if price is more than 0, then Commerce Multicurrency  is not converting the currency if I go with Commerce Free Price Formatter.

Pls suggest any solution.


texts:
I am using Bootstrap 3 subtheme (7.x-3.1-beta2 ) on Drupal 7 for the administrative backend. It seems that the Bootstrap base theme replaces <input type="submit"> with a <button> element. That breaks the layout of the views backend.

I tried to change this by:

copying button.func.php into the subtheme
renaming the function according to the subtheme name
modifying the output to return <input> instead of <button>

Code in button.func.php

<?php
function bootstrap_subtheme_adl_admin_button($variables) {
  $element = $variables['element'];
  $value = $element['#value'];
   if (!empty($element['#icon'])) {
     if ($element['#icon_position'] === 'before') {
       $value = $element['#icon'] . ' ' . $value;
     }
   elseif ($element['#icon_position'] === 'after') {
     $value .= ' ' . $element['#icon'];
    }
  }

return '<input' . drupal_attributes($element['#attributes']) . '>\n';
}

However, this does not have any visible effect.
Any advise?


texts: How should I link (public) files to nodes?

texts:
I have many resources (mainly PDFs) that need to be imported to my site.  Previously the files would manually be placed in sites/default/files/mydir and linked to the node like this:

Read More

This does work, but I am guessing there are probably strong advantages to actually using the content system - perhaps being able to better organize/track/update files.

How do I place files inside of nodes so the file still appears inline with the rest of the content, while actually being tracked by Drupal?


texts:
I'm trying to change the message users see after creating an account. It currently says:

Thank you for applying for an account. Your account is currently pending approval by the site administrator.
In the meantime, a welcome message with further instructions has been sent to your e-mail address.

What's the best way of changing this? Would the String Overrides module help? A Rule, perhaps?

Many thanks.


texts: Where is the email New release(s) available coming from

texts:
With Drupal 7, we are getting some emails that say "New release(s) available for name of site" , but they are going to someone who doesn't work here any more, and they are bouncing back to me.

Where are these emails coming from, they seem to be from drupal but I can't find where this is configured.

Thanks!!


texts: Images not loading until the page is refreshed

texts:
The links are identical, the path is correct, the image is there,but i have to refresh the page for the image to show, i am suspecting the "itok" parameter might be causing the problem,. It was working fine at the beginning, at some point during the development i started having the problem.

Any help with be appreciated.

Thanks


texts: How to show latest and high price value first using Views?

texts: I am using views to show products in my site. I need to filter my view with high price and latest product . Using expose filter not a sort criteria.


texts: How can I append the node ID to the node title while saving a node?

texts:
When a node is saved, I want to append the NID to the title of the node.

$node->title = "XYZ_" . $node->nid;

If I put this code inside hook_node_presave(), it won't work because NID($node->nid) is not available.

If I put this code inside hook_node_insert(), NID ($node->nid) is available but still won't work because we can't alter $node values inside hook_node_insert() as the transaction is already under way.

Is there a solution to this problem?


texts:
I have looked for the solution for weeks, but I have not found any. It must be very trivial that I missed.

I'm adding a line item field in addition of the default unit price and quantity called "length" in the cart view and Order. I would like to get the new calculated line item total = price * quantity * length.

Solutions that I have found so far change the line item unit price, which is not desirable.

How can I do this?


texts:
I use Date module in D7, and I create new field "decade" (field type is Date).

Also in the settings, I add a custom input format 'Y' (only years). There is increment for time (+/-30 minutes), but I need increments for years (+/- 10 year). In node add form I need selectbox with values like:

1700
1710
1720
1730
....
now
How can I do that?


texts: Running "composer update" leads to errors with coder

texts:
...
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Updating drupal/coder (8.2.12 => 8.3.1)    The package has modified files:
    D coder_sniffer/Drupal/Test/Array/ArrayUnitTest.inc
    D coder_sniffer/Drupal/Test/Array/ArrayUnitTest.inc.fixed
    D coder_sniffer/Drupal/Test/Array/ArrayUnitTest.php
    D coder_sniffer/Drupal/Test/Array/DisallowLongArraySyntaxUnitTest.php
    D coder_sniffer/Drupal/Test/Array/disallow_long_array_d7/DisallowLongArraySyntaxUnitTest.1.inc
    D coder_sniffer/Drupal/Test/Array/disallow_long_array_d7/disallow_long_array_d7.info
    D coder_sniffer/Drupal/Test/Array/disallow_long_array_d8/DisallowLongArraySyntaxUnitTest.2.inc
    D coder_sniffer/Drupal/Test/Array/disallow_long_array_d8/DisallowLongArraySyntaxUnitTest.2.inc.fixed
    D coder_sniffer/Drupal/Test/Array/disallow_long_array_d8/disallow_long_array_d8.info.yml
    D coder_sniffer/Drupal/Test/Classes/ClassCreateInstanceUnitTest.inc

  [ErrorException]
  A non-numeric value encountered

I have tried with errors

$ composer require drupal/coder ^8.3
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package symfony/debug (locked at v4.1.7, required as ^3.4.0) is satisfiable by symfony/debug[v4.1.7] but these conflict with your requirements or minimum-stability.
  Problem 2
    - Conclusion: remove doctrine/annotations v1.6.0
    - Conclusion: don't install doctrine/annotations v1.6.0
    - Can only install one of: doctrine/annotations[v1.2.0, v1.6.0].
    - Can only install one of: doctrine/annotations[v1.2.1, v1.6.0].
    - Can only install one of: doctrine/annotations[v1.2.2, v1.6.0].
    - Can only install one of: doctrine/annotations[v1.2.3, v1.6.0].
    - Can only install one of: doctrine/annotations[v1.2.4, v1.6.0].
    - Can only install one of: doctrine/annotations[v1.2.5, v1.6.0].
    - Can only install one of: doctrine/annotations[v1.2.6, v1.6.0].
    - Can only install one of: doctrine/annotations[v1.2.7, v1.6.0].
    - Installation request for doctrine/annotations (locked at v1.6.0, required as ^1.2) -> satisfiable by doctrine/annotations[v1.6.0].
    - Installation request for doctrine/annotations 1.2.* -> satisfiable by doctrine/annotations[v1.2.0, v1.2.1, v1.2.2, v1.2.3, v1.2.4, v1.2.5, v1.2.6, v1.2.7].

Installation failed, reverting ./composer.json to its original content.

Also tried with errors

rm vendor/ -rf
composer update
....
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package doctrine/annotations 1.2.* exists as doctrine/annotations[v1.6.0] but these are rejected by your constraint.

but always end up with other errors
Any thoughts ?


texts: Access the label for a form element via hook_form_alter

texts:
I have a form with id equal to webform_client_form_3.  I have a particular field that I'm altering by applying a class to it like so:

$form['submitted']['estimated_annual_distribution_of_effort']['sensor_technology']['#attributes']['class'][] = 'span1';

This all works great.  However, I also need to add a class on to the label for that particular element as well.  Looking through the $form array, I haven't been able to find anything that gives access to the labels.  Am I just missing something or are the labels not part of the $form array?


texts: Highlight Field Errors with an Ajax Form

texts:
I'm using a number of Ajax form, and while the I can get the error validation to work, and present the error message using the following:

  if (null !== form_get_errors()):
    return array(
      '#type' => 'ajax',
      '#commands' => array(
        ajax_command_remove('.alert-dismissable'),
        ajax_command_prepend('#myErrorDiv', theme('status_messages')),
      ),
    );
  endif;

However, I am unsure how to highlight the specific fields (usually done by adding a 'error' class to the form item.)

What the best way to achieve this, or is there a better way to handle the form errors that does not take over the normal error highlighting and message display?


texts:
I'm trying to test nginx on Dreamhost following the instructions in the wiki, but going to any page except for the front page results in a 404 error: http://wiki.dreamhost.com/Nginx#Drupal.

Certain things are assumed, and from that assumption I cannot tell if they apply to what I'm trying to do or not. I'm guessing its some kind of clean URL based error.

For example, /home/YOURUSER/nginx/example.com/drupal.conf; my path is /home/YOURUSER/example.com/drupal.conf.

I'm assuming at this point that is not the issue.  I've tried various things including just putting in what appears to be the bare minimum to no effect:

if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}

Any pointers would be helpful.  I'd like to get this working with Boost.

I also attempted to use this: http://wiki.nginx.org/Drupal#Not_So_Simple.

Disabling clean URLs allows me to log in, and Drupal states that clean URLs are not enabled.


texts: Drupal services forbbiden error on put but not on post

texts:
I'm using Drupal Services Module to upload data to my site. It works good on local host, and I can do PUT and POST without problems. But after upload my site to a shared hosting, I can do POST, but PUT always get "Forbidden" errors. For exmple, when I try to update a taxonomy term, it returns "Forbbiden. You don't have permission to access taxonomy_term/2601", where 2601 is a taxonomy term previously created with POST and the same web service's user. And this user has permission to edit this term.
Any suggestion? Thanks.


texts: How do i change date format in View Exposed Date filter?

texts:
How do I change date format in View Exposed Date filter?
By default it's in d/m/Y format, I want to make it Y.m.d format, without changing the query parameter date format (Y-m-d).

Any suggestion, how can I achieve this?


texts: how to empty the first select option with form api?

texts:
I have made two select fields with the form api d7

and i need to make it required and the first option is null to force the user select both

i tried with #REQUIRED #EMPTY_VALUE OPTION  but gives error unsupported operands

i see the validation function may help but my case have an ajax request based on the first select to get the values of the second

so i need to make it required and the first is null

the code answer

 $form['gov']=array('#title'=>'Gov','#name'=>'governorate'
,'#type'=>'select','#options'=>$options,'#ajax'=>array('callback'=>'ajax_callback',
'event'=>'change','wrapper'=>'replace'
  ,'method'=>'replace'));

 $form['city']=array("#title"=>'City',
'#name'=>'city','#type'=>'select'
,'#prefix' => '
',
'#suffix' => '
','#options'=>$op);

also the ajax request only happens one time


texts:
I am adding one argument to the custom service named "streamtype" as follows

function CMODULE_services_resources() {
  $api = array(
    'oidar' => array(
      'operations' => array(
        'retrieve' => array(
          'help' => 'Retrieves All oidar operations',
          'callback' => '_CMODULE_blog_retrieve',
          'access callback' => 'user_access',
          'access arguments' => array('access content'),
          'access arguments append' => FALSE,
          'args' => array(
            array(
              'name' => 'fn',
              'type' => 'string',
              'description' => 'Function to perform',
              'source' => array('path' => '0'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'uid',
              'type' => 'int',
              'description' => 'Number of latest items to get',
              'source' => array('param' => 'uid'),
              'optional' => TRUE,
              'default' => '1',
            ),
            array(
              'name' => 'nid',
              'type' => 'int',
              'description' => 'Posts from the last number of days',
              'source' => array('param' => 'nid'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'counter',
              'type' => 'int',
              'description' => 'counter view',
              'source' => array('param' => 'counter'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'id',
              'type' => 'int',
              'description' => 'node id for display',
              'source' => array('param' => 'id'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'view',
              'type' => 'int',
              'description' => 'view counter',
              'source' => array('param' => 'view'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'title',
              'type' => 'string',
              'description' => 'title',
              'source' => array('param' => 'title'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'body',
              'type' => 'string',
              'description' => 'body',
              'source' => array('param' => 'body'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'type',
              'type' => 'string',
              'description' => 'type',
              'source' => array('param' => 'type'),
              'optional' => TRUE,
              'default' => '0',
            ),
            array(
              'name' => 'iso3',
              'type' => 'string',
              'description' => 'Country',
              'source' => array('param' => 'iso3'),
              'optional' => TRUE,
              'default' => '',
            ),
            array(
              'name' => 'streamtype',
              'type' => 'string',
              'description' => 'Stream Type',
              'source' => array('param' => 'streamtype'),
              'optional' => TRUE,
              'default' => '0',
            ),
          ),
        ),
      ),
    ),
  );

  return $api;
}

But I am not getting streamtype (getting empy) when I try to access that further in code. Please help.


texts:
I have a link in a block and when i click it it brings with ajax a form from another page let's call it contact. In contact page the form uses ajax to submit the data, it works ok. But when i get the form by clicking that link in another page using ajax the form loses the ajax submit. and instead it redirects me to the contact page.

How can i keep the ajax submit even if the form loads with ajax in another page???


texts: How can I restrict users to some parents node with node hierarchy?

texts:
I have the Node Hierarchy module on my Drupal installation, and I am using the following hierarchy:

Main Navigation (menu)

Art & Sciences

Art
Sciences

Economy

News

World wide
Other

What I want is that:

Stephanie can add/edit/delete content any content from "Art & Sciences" section
Stephanie can NOT add/edit/delete any content from other sections
John can add/edit/delete content any content from "Economy  " section
John can NOT add/edit/delete any content from other sections

I tried to install Workbench access; it creates me sections, but users can choose any node for parent, whatever the hierarchy.

Node Hierarchy obviously add nodes to the "Main navigation" menu as menu links. Despite of editors, everyone can add a node in every menu, but I want to restrict each user to their section. I can assign only the section I want to a node, but in the hierarchy it's not correct.

Is there any module (even if I have to use more than one) I can use to achieve what I want?


texts: Views - Filtering nodes by current user profile field

texts:
I have been trying to do this for many days but no luck.

On registration, user has a choice to choose his/her interests - checkboxes with term reference widget.
For example - I have made vocabulary 'Interests' with terms sports, computers, painting etc. Every node is related to terms also.

I need to display only the nodes, that users are interested in. For example, if user checked computers on registration, views have to display only nodes with term computer.

I guess there has to be some way to filter only current users profile_field_interests. I couldn't find a way in Drupal 7.

Any suggestions?


texts: Composer updates .htaccess file when updating

texts:
I am using composer with Drupal lightning. If I update Drupal via composer, it updates the .htaccess file.

Is there any way to prevent the .htaccess file from being overwritten?


texts:
I simply wish to put a link at the head of node, which leads at the beginning of comments.

I did not find clear answer on this subject.

I try this, but does not work :

<?php print l('
title
', '#comments', array('html' => TRUE)); ?>

Is there a solution under drupal?


texts: How to pass a form and other variables to theme functions?

texts:
I wonder how can I pass a form and other variables (an array) to hook_theme(), I know that if you want to render a form in hook theme you have to use 'render element' so now I can't use 'variables' to pass my variable array. here is what I did to render the form:

function example_theme() {
  return array(
    'deductible_form' => array(
      'arguments'      => array('form' => NULL),
      'template'       => 'example',
      'render element' => 'form',
     ),
  );
}

What can I do to solve this?


texts: How to implement view with nodes grouped per taxonomy term

texts:
I have a content type 'Event' which has a 'Category' content taxonomy field (single selection against respective 'Category' vocabulary). If vocabulary has 3 terms, I want to implement a listing where all 3 terms will always be displayed, along with the newest event for each category (sort by publication date in descending order). Something like this:

Category 1

Title of newest event for category 1

Category 2

Title of newest event for category 2

Category 3

Title of newest event for category 3

What is the best way to implement this with views in Drupal 6?