texts: Populate a hierarchical select field programmatically

texts:
I have to create a user, and one of the fields (Profession) is a hierarchical select based on a two level taxonomy, where the first level is "profession", and each profession has different specialities.

I can create a user and save the profession field, but the speciality is not saved, and that's what I want to do. Here is how I save the profession :

$fields = array(
    'name' => $name,
    'mail' => $email,
    'pass' => $password,
    ...
    'field_profession' => array('und' => array(array('tid' => $tid_profession))),
);
user_save('', $fields);

Here, $tid_profession is the id of the profession term. However, when I use the id of the speciality term, the field is not saved.

Any idea how to make this work ? Any help would be greatly appreciated.


texts: Code in URLs despite clean URLs turned on

texts:
The site I'm working on, shows the URL like this: http://www.sitename.com/page-name#.Uad4adKmjoY

It shows "#.Uad4adKmjoY" at the end of url, even though I've enabled the clean urls.

Anyone know why it is showing this? I've not come across this before.


texts: How to show a Select list (dropdown) for state and dependent cities of India?

texts:
I want to show the list of state and city of particular state in dropdown.

I have done it using the Conditional Fields module but not helpful as I have to show the filter for cities in view.

Any suggestions?


texts: Language fallback for unpublished translation

texts:
on our Drupal 7, we have pages in 6 different languages. We'd like to remove the translation for some nodes.

I thought that users would be automatically redirected to the default (English) language when trying to access this unpublished translation, but this is not the case, they have a "not found" page.

I installed the language fallback module and configured all languages to fallback to English, but this did not help.

Is there something else I can do so that all traffic to unpublished translations is redirected to the default node translation ?


texts: Ubercart vs Drupal commerce for french ecommerce site

texts:
This is my first experience with french e-commerce site . I want to know which solution will speed up the developing of the website .

Also is there a module payment for Carte bleu  in drupal commerce, and is it ready for production site ?


texts: Is there anyway create relationship for filter criteria which has vocabularies( state, city and location)?

texts:
list of available Vocabularies in my content type.

Country(Term: US)
State (Terms: CA , CO, DE.. etc)
City (Terms:Fremont, Irwin, Los Angeles, Monument etc..)
Location(Terms: All loacations)

I'm trying to create a view for published content result which uses above vocabularies. I need to expose filters to the users where I added above vocabulary fields. How to create a relationship to select particular state->city-> location
(For ex: State(CA)->City(Fremont)->location(xxx-fremont))
Below is the example filter. Please help. Thank you!


texts: How do I force a new module to inherit the file permissions the modules directory has, after update?

texts:
I'm using Drush 7 on Windows Server 2012 and IIS 8. Whenever I use drush up to update a third-party module, IIS can't access the files because during the update process, when drush is replacing the module files, the entire module folder contains permissions assigned to only the administrator, with inheritance disabled.

I need Drush to replace the module files with inheritance enabled; otherwise, Drupal will complain that it can't read the module files and break my site.

How can I achieve this?


texts: How to generate an url based in title with token and pathauto module?

texts:
I have this pattern in admin/config/search/path/patterns: region/[node:title].

I need in a custom module regenerate the same string this Token/Pathauto does (In fact , I still not get who works in this conversion).

The idea is to create a function in my module like:

    $node2 = node_load(1013); // With the NID given, get node.
    $title_of_node2 = $node2->title; // Extract the title
    $URL = TOKEN_OR_PATHAUTO_FUNCTION_THAT_GENERATE_MY_CLEAN_SEO_URL(title_of_node2)

With the $URL I will construct an url pattern to my new node before I save it, instead of editing the admin/config/search/path one by one, because it is not one page.

I tried to catch the url with drupal_get_path_alias but in the moment I generate everthing with a hook, this does not return the result I see in admin/config/search/path, after the process is done.

The ideia is generate what is going to be generated to put in other place after the all the process is done.

I found _pathauto_set_alias and pathauto_create_alias but could not find a way to call/implement from my own module to find if this does what I am looking for...


texts:
For a new blog, I like to have the post text stored as markdown (or an other suitable format) on github. But I want to have all the nice features of drupal (comments, nodes, captcha, menu syste, categories, etc.) for the whole blog.

What options do I have to make Drupal retrieve the node body from git (path, branch, tag), render it, and show it as it would have been entered directly into the body text field?

I don't mind whether an import task fetches the content every now and then or if this is done online.

I'm actually open for all ideas as long I can have people forking and improoving the content and at the same time not loosing all the nice things of drupal.

Update: If possible I'd prefer a use this module solution. If this doesn't exist coding hints are of course welcome as well.


texts:
i want to combine the two drop downs that the views date exposed filter creates.

ie. [year][month]

i want to know if this can be made into one drop down like [year,month].

Is this possible?


texts: Configuring View output with multiple related nodes

texts:
Real world: Our not-for-profit holds monthly meetings. At each meeting, zero, one, or two people can present.

My site has:

Content type Presenter with fields Name and Description
Content type Meeting with field Date, Topic, and Node Reference (which will allow a maximum of two entries)

I created a View to show the meeting information. What I would like to see is this:

Meeting Date
Meeting Topic
Presenter 1 Name
Presenter 1 Description
Presenter 2 Name
Presenter 2 Description

What I am currently seeing is this:

Meeting Date
Meeting Topic
Presenter 1 Name
Presenter 1 Description
Meeting Date
Meeting Topic
Presenter 2 Name
Presenter 2 Description

I have tried several things to fixed this: Grouping, SQL Distinct (via Advanced->Other->Query Settings), and others, but so far, nothing has worked. This seems like something which should be easy to do - but I have yet to find the proper incantation.

Please help.


texts: How can I loop through Drupal 7 Views to add anchor tags to an alphabetical list

texts:
I'm attempting to create anchor tags for a views 3 rendered list of content where each change in the first character of the title gets an
 or "b" or "c" added to the html output.

The only way I've found to be outside the foreach loop where I can monitor the change in the title is in a preprocess function like this:

function mymodule_preprocess_views_view(&$vars) {
  $alphc = 'a';
  $target = "";

  foreach( $vars['view']->result as $key => $values) {
    $title = $values->node_title;
    $tmp = substr($title,0,1);

    if (strtolower($tmp) != $alphc) {
      $alphc = strtolower($tmp);
      $target = "";
          ...
        }

The problem of course is that Views has already rendered the html output in $rows.
I'm sure I'm not the first person trying to do this since having a series of links A B C D E F G H etc. to long list of content is pretty standard html practice. I'm not sure what the value of a preprocess function is if the html content has already been rendered, a preprocess function seems an ideal place to override the output.

The closest I got to a solution was with the above code and then adding a new $variable to the views->result array but I have no idea how to capture that $variable in a Views theme (display, style, row or field) so that I can append the anchor tag for the title.

Any help will be appreciated.
Thanks
Eric


texts: JS file (drupal.behaviors) that does some simple jQuery works for anon users but not authenticated?

texts:
I have an issue where a JS file I've included with my theme using the .info file works for anonymous users but not authenticated. It has a unique namespace and using the debugger, the contents of the function are skipped when logged in. Here is my JS file:

Drupal.behaviors.wet4_ctasidebar = {
    attach: function (context, settings) {
        alert("it works");
        $(window).resize(function(){
            if ($('.container').innerWidth() <= 751){
                $('#sidebar-aside').detach().insertAfter('.node-body');
            } else if ($('.container').innerWidth() >=752){
                $('#sidebar-aside').detach().prependTo('.node-body');
            }
        })
        if ($('.container').innerWidth() <= 751){
            $('#sidebar-aside').detach().insertAfter('.node-body');
        }
    }
};


texts:
<?php
global $user;
if (in_array($group->nid, $user->og_groups)) {
  print t('Click here to subscribe');
}
else {
  print t('Click here to see other user in this group');
}
?>

I am trying to check if user belongs to a group or not.

I got this code in node--group.php . But it wont work.

I get an error:

Undefined variable: group in include() (line 6....
Trying to get property of non-object in include() (line 6
Notice: Undefined property: stdClass::$og_groups in include() (line 6
Warning: in_array() expects parameter 2 to be array, null given in include() (line 6

Anyone can help me?

Thank you!


texts: I need to have a separate block for a each menu items in my menu (Add item section).Is there any drupal module can help me or i should write the custom module.Please suggest the possible ways to do.


texts:
I have successfully installed Drupal 8 with Composer and I also installed Drush with Composer. When I use Drush, it says that the Drupal root is not found. I am passing the root, but it still says that.

How do I tell Drush where the root directory is?

I am using Drush from vendor/drush/drush/drush. I couldn't get vendor/bin/drush to work.


texts: Create form for image selection from the content

texts:
I have a content type with title and image field in it. Now, I want to show a form to the user which will show the image thumbnail, title and a checkbox below each image with the value of respective nid. So that user can select the image they like and submit it. Which will eventually take the nid and do some actions depending on the selected nid.

My question is how I will create such form from that content.


texts: site slogan in h6 following h2 site name not matching WCAG 2.0 requirements

texts:
Configuration : Drupal 7.26 / Omega 3 / Delta module
An accessibility check made with achecker.ca on a website gives me one result :

  Success Criteria 2.4.6 Headings and Labels (AA)

  Check 38: Header nesting - header following h2 is incorrect.
  Repair: Modify the header levels so only an h3 or any header less than h3 follows h2.
  Error Line 112, Column 7:

for ...

As I understand, it comes from the file : "sites/all/modules/delta/delta_blocks/includes/delta_blocks.theme.inc" The delta for the site slogan is defined as a h6, which doesn't match with WCAG 2.0 (AA) requirement :

  The header following an h2 is h1, h2 or h3

(http://achecker.ca/checker/suggestion.php?id=38).

So I might need to use a hook to change it, but I am such a newbie with hooks. I found this : https://api.drupal.org/api/drupal/modules!block!block.api.php/function/hook_block_info/7 but it seems to hook the core module. Not very sure I want to do it.

Any help?


texts:
I am facing an almost similar problem whereby if I do:

$userCurrent = \Drupal::currentUser();
$name = $userCurrent->getUsername();

I get the site account name instead of the logged in user. Which is the right way to get the logged in username or roles for that matter. I even tried:

$user = Drupal\user\Entity\User::load($userCurrent->id());

But all this does not seem to work.

Any suggestions?


texts: How to list 5 most view nodes without using the Statistic module?

texts:
I am trying to create a view/block of the most viewed node without using a module if possible.

If it's not possible, is it possible to do it without using the statistic module?


texts: How to get remote webpage content with drupal http request?

texts:
Would love to see some examples on getting remote webpage content with drupal http request. I have plenty of examples easily with Google with curl, but yet to find one with this drupal function.

Also, would CURL be better for getting remote content?


texts: How can I assign users different profile pictures upon registration based on gender?

texts:
My setup: I am on Drupal 7 but not using the default user profile pictures; instead, I have a custom image field, profile_picture, which is attached to the user profile.  When users register, they must select their gender (Male/Female/Prefer not to say).

I would like to assign a different default picture to this profile_picture field based on the value each user selects for gender.  I tried using Set a data value with Rules but I can't figure out how to get these three specific pictures (one for each gender choice) to be options.

If it helps, each user also has a role based on their gender.  I'm not committed to using Rules for this; I will accept any solution that allows me to reliably set the picture based on the value of the field in their profile.  There is no opportunity for users to change their gender so this needs only be set once.

EDIT: Users are later able to replace this with their own custom profile picture, so I need to keep this as an Image field.


texts:
In node.twig (output for articles) I want to use the value of boolean content type field like this, but do not know how to realize this in drupal 8.

if boolean content type is true {

   {{ content.body }}

else {

   {{ content.img }}

}


texts: Where and how can I override markup for Quicktabs accordion displays?

texts:
We've run in to an issue where we need to override/revise the output that is created by the Quick Tabs module in order to make the display compliant with the standard from W3C.

I'm sure we're not the only one to have ever run in to this issue, but I cannot find anything from anyone on how they approached handling this with their projects.

We've looked at jquery, we've looked at the structure inside the Quick Tabs module as modules are known to have template files that can then be overridden in the theme. However, I cannot find anywhere to modify/alter the markup for what we need to do in order to make our display, which is one accordion instance with 10-12 blocks associated.

Can you help me find where I can override the HTML display markup that's output from our block and quicktabs so that we can rearrange/modify the structure so that it's compliant with the standard?


texts: Moving a number of fields into a table on D7 node form

texts:
I have a form with three field groups, arranged as horizontal tabs.

On one of these tabs, I have twelve fields. For eight of these fields, I would like to arrange them inside of a table.

These fields are date popup fields.

Each of the fields has its label removed; I'm just trying to have a table where the field labels are in the header and the actual  tags are inside the table rows.

I'm using the code below to remove the labels (it was difficult to figure out, so if anyone can use it)

However, I'm not yet sure how to then place the resulting fields into a table format.

My first thought was a theme function for the entire form, but how would I insert the table into one of the tabs? drupal_render() would not work for that.

Will I just have to go through each item individually?

Thanks for your help.

<?php
function MYMODULE_form_recruitment_process_node_form_alter(&$form, &$form_state, $form_id) {
    $date_fields = array(
        'field_special_1',
        'field_special_2',
        'field_special_3',
        'field_special_4',
        'field_special_5',
        'field_special_6',
        'field_special_7',
        'field_special_8',
        'field_special_9',
        'field_special_10',
    );

    foreach ($date_fields as $field_name) {
        $form[$field_name][LANGUAGE_NONE][0]['#title_display'] = 'invisible';
    }
}

function MYMODULE_element_info_alter(&$type) {
    if (isset($type['date_popup'])) {
        $type['date_popup']['#process'][] = 'MYMODULE_date_popup_process';
    }
}

function MYMODULE_date_popup_process($element, $form_state, $complete_form) {
    // Get the field name and create an array of fields we want to change.
    $field_name = $element['#field']['field_name'];
    $valid_fields = array(
        'field_special_1',
        'field_special_2',
        'field_special_3',
        'field_special_4',
        'field_special_5',
        'field_special_6',
        'field_special_7',
        'field_special_8',
        'field_special_9',
        'field_special_10',
    );

    // If it's not the field we want, return it unchanged.
    if (!in_array($field_name, $valid_fields)) {
        return $element;
    }

    $element['date']['#description'] = "";
    $element['date']['#title_display'] = 'invisible';
    $element['time']['#descsription'] = "";
    $element['time']['#title_display'] = 'invisible';

    return $element;
}


texts: how to use Views Datasource to export view in JSON

texts:
I am new in Drupal. I am using Drupal 7 and i have created a view based on the terms and displaying it as Block to display it in the website. But, I want to export the view data in the JSON format.

I have installed Views Datasource module and enabled it in the Module administration.

But, i can't see the way to export my current view data to JSON through this module.

Can any one please help? is there any settings i am missing?

or is there any easy way like modules or plugins i can use?


texts: I just installed context 3 on my drupal 6 site. I updated ctools to latest version (1.9) as suggested. Everything looks fine and I can enter conditions and reactions. The problem is that nothing happens. I see no reaction at all on the behavior of my site. Any hits to where I should start looking for the source of the problem?


texts: Installing site using custom profile gives error "call to undefined function libraries_get_path"

texts:
I have to change an already made site. It is using a different custom made Profile and not the standard profile. but when I install it, it gives error "Call to undefined function libraries_get_path on line 5 in my custom module."

How can I solve this error?
Thank you.


texts: Help implementing Supersized.js in Drupal 7

texts:
I am trying to add Supersized.js into my Drupal 7 site. I have updated Drupal to use the latest version of jQuery, I added scripts[] = js/supersized.3.1.3.min.js to my .info file, and in my html.tpl.php file i added:
<script type="text/javascript">

        (function($){
            alert('test');
            $.supersized({
            alert('test2');
                //Functionality
                slideshow               :   1,      //Slideshow on/off
                autoplay                :   1,      //Slideshow starts playing automatically
                start_slide             :   1,      //Start slide (0 is random)
                random                  :   0,      //Randomize slide order (Ignores start slide)
                slide_interval          :   3000,   //Length between transitions
                transition              :   1,      //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
                transition_speed        :   500,    //Speed of transition
                new_window              :   1,      //Image links open in new window/tab
                pause_hover             :   0,      //Pause slideshow on hover
                keyboard_nav            :   1,      //Keyboard navigation on/off
                performance             :   1,      //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
                image_protect           :   1,      //Disables image dragging and right click with Javascript
                image_path              :   'img/', //Default image path

                //Size & Position
                min_width               :   0,      //Min width allowed (in pixels)
                min_height              :   0,      //Min height allowed (in pixels)
                vertical_center         :   1,      //Vertically center background
                horizontal_center       :   1,      //Horizontally center background
                fit_portrait            :   1,      //Portrait images will not exceed browser height
                fit_landscape           :   0,      //Landscape images will not exceed browser width

                //Components
                navigation              :   1,      //Slideshow controls on/off
                thumbnail_navigation    :   1,      //Thumbnail navigation
                slide_counter           :   1,      //Display slide numbers
                slide_captions          :   1,      //Slide caption (Pull from "title" in slides array)
                slides                  :   [       //Slideshow Images
                                                    {image : 'http://buildinternet.s3.amazonaws.com/projects/supersized/3.1/slides/quietchaos-kitty.jpg', title : 'Quiet Chaos by Kitty Gallannaugh', url : 'http://www.nonsensesociety.com/2010/12/kitty-gallannaugh/'},
                                                    {image : 'http://buildinternet.s3.amazonaws.com/projects/supersized/3.1/slides/wanderers-kitty.jpg', title : 'Wanderers by Kitty Gallannaugh', url : 'http://www.nonsensesociety.com/2010/12/kitty-gallannaugh/'},
                                                    {image : 'http://buildinternet.s3.amazonaws.com/projects/supersized/3.1/slides/apple-kitty.jpg', title : 'Applewood by Kitty Gallannaugh', url : 'http://www.nonsensesociety.com/2010/12/kitty-gallannaugh/'}
                                            ]

            });

        })(jQuery);

    </script>

I am stuck here. I am not very experienced with Drupal, Javascript, or jQuery.
Edited to include Bob's change to the wrapper.


texts: Is there an easy way to include a Facebook remarketing tag in my D7 site?

texts:
Adding Google Remarketing Script tags to Drupal 7 website shows how to add a Google remarketing tag using a module. Is there a similar solution for adding a Facebook remarketing tag easily?

I would use the drupal_add_js hook if that were so easy, but the issue is that the remarketing tag also includes an <img/> element (the pixel) in a <noscript> tag, so I can't include that easily in the same hook.


texts:
Maybe I am trying to do something simple and I am just blind, but after a day of hard work I am desperate...:

I have view, created using Views 3 module, with source in index of Search API module
I have Profile two custom fields on User Entity, named "Name" and "Surname".
I am using two "Search: Fulltext search" exposed filters in View, grouped using AND. The first with "Contains all of these words" and the second with "Contains none of these words".
I have user with "Name" = Vysakh, "Surname" = Babu

Now:

When is in first "Search: Fulltext search" exposed filter with rule "Contains all of these words" written "Babu" (without speech marks), it founds his profile. Great.

But:

When is in second "Search: Fulltext search" exposed filter with rule "Contains none of these words" concurrently written "Vysakh" (without speech marks), instead of excluding his profile as well (thus showing empty result), view shows all the profiles, except Babu Vysakh...

Any ideas why and what can I do?

I tried all combinations of exposed filters, put them to different groups, switch from "Search keys" to "Search filter"... No luck.


texts: How do I use render() for my custom content?

texts:
I am creating a custom module to read content from text files and generate various custom content types I have defined on a project.  Some will have specialized lists and tables and all will have specific class assignments.  I can easily generate the appropriate markup added to the text and send it to the node->body, but have been researching render().

I understand that render takes an array that encodes the content and styling, but cannot find a framework for the array to know how to structure it for my content.

How does render work?


texts:
I was following this post on drupal.org - https://www.drupal.org/node/3075055
But I'm not getting the same result. I'm not experienced at all in javascript so maybe I'm missing something. Do I need to indicate where is my js file? The name of the js file is important?
My module code below:
function draws_form_alter(&$form, &$form_state, $form_id) {
  switch($form_id) {
    case 'bets_node_form':
      $form['field_possible_returns']['und'][0]['value']['#process'] = array('my_custom_process');
      break;
  }
}

function my_custom_process($element, &$form_state, $complete_form){
  $element['field_possible_returns'] = array(
    '#type' => 'textfield',
    '#size' => 8,
    '#attributes' => array(
      'readonly' => 'readonly',
      'tabindex' => -1,
    ),
  );
  return $element;
}

The name of my module is draws.
My javascript file (in the same folder of the module file):
(function ($) {
  Drupal.behaviors.draws = {
    attach: function (context, settings) {
      alert('Its working!');
      $('.field-name-field-bet-value').on('keyup change', function (){
        var bet_value = $('.field-name-field-bet-value input').val();
        var odd = $('.field-name-field-odd input').val();
        var result = (odd * bet_value).toFixed(2);

        $('.field-name-field-possible-returns input').val(result);
      });
    }
  };
}(jQuery));

Here are the field names of my content type bets:

Thank you.


texts: Exist a Drush command to update all the contents?

texts:
We have a client who was adding content to a separated dev server, the dev server is whitelisted only and doesn't allow incoming/outgoing connections to a lot of services.

The client was adding videos with the video embed field module, which automatically generates a static file on our server.

The firewall config means that this error was produced

Warning: file_put_contents(temporary://fileTjnJTX): failed to open stream:      "DrupalTemporaryStreamWrapper::stream_open" call failed in      file_unmanaged_save_data() (line 1898 of /var/www/user/includes/file.inc).
The file could not be created.

When editing and saving the content drupal tries to regenerate the image if none is available Our sysadmin is working the firewall configuration to allow the connections, but we was wondering if there is any easy way/drush commands/mysql statment to update all content,


texts: "Node: Created day" mismatched, not reflecting the actual created day

texts:
Views Version: 7.x-3.0-alpha1

I was trying to create a blog archive view, like blog/yyyy/mm/dd, where blog/2011/03/10 is  supposed to display all posts created on 2011, March 10th. However, the page blog/2011/03/10 actually displays all posts created on 2011, March, 11th, one day advanced to the supplied day argument.

How to reproduce the bug:

clean install, enable modules.
create blog content type, generate dummy contents.
create a view:

  * Arguments:
        o Node: Created year
        o Node: Created month
        o Node: Created day

  * Path: blog

  * Filters
        o Node: Published Yes
        o Node: Type = blog

The year, month arguments show correctly, just the day is wrong, always one day prior to the day argument.

Can anyone point me to what went wrong?


texts: Setting site name in installation profile

texts:
I'm creating an installation profile. Currently, hook_install() contains only this:

/**
 * Implements hook_install().
 */
function myprofile_install() {
  \Drupal::service('config.factory')->getEditable('system.site')->set('name', 'My Site')->save();
}

Still, after installation is completed (using Drush) the site name is always "Drupal".

The code works if I paste it into Devel's Execute PHP after the site is installed.

Another option I tried is overriding system.site.yml within my profile, which won't load because I wrote uuid: ''. (I don't know how to leave the already-generated UUID.)

How can I set the site name during installation in my custom profile?

EDIT: I found out the following:

The site name gets overwritten when the install configuration form is submitted by Drush, using the values provided by Drush (including site name)
The installation profile must provide a translation of the site information for each enabled language (I have more than one). I assume I'll do this with the core module Configuration Translate.


texts: Url query - using a key with multiple values

texts:
I am trying to build a url with a query using the url() function.

    $options = array(
        'query' => array(
                'parameter1' => 'value1',
                'parameter2' => 'value1,value2',
        ),
        'absolute' => TRUE,
        'external' => TRUE,
    );
    url ('https://somesite.com/', $options);

The URL becomes: https://somesite.com/?parameter1=value1&parameter2=value1%2Cvalue2

So commas become encoded as %2C.

How can I build a query that has parameters with multiple values separated by comma?

EDIT: I have to deal with an old API that does not recognize %2C as comma characters, so actual commas have to be present in the end url.


texts: What is the proper way to handle drupal_get_destination and drupal_goto?

texts:
I am considering the following approach in my controller (the method which corresponds to a given route).

$destination = \Drupal::destination()->getAsArray();
if (isset($destination['destination'])) {
  return new RedirectResponse(Url::fromUri($destination['destination']));
}
else {
  return $this->redirect('acquia_connector.settings');
}

Should I use different code to handle both route based and URL based redirects?


texts: How do I add custom contextual links in a block?

texts:
I want to add more contextual links (e.g. "Edit Block") to my block apart from the existing "Configure Block".

How can I achieve this?


texts: I would like to create a view where I can add tags to content

texts: I am pretty new to Drupal and have not created a module yet. I think the solution I am looking for will have to be a custom module and would like some tips on how to get started. Basically I have a content type of beverages. In that content type I have a term reference field that points to a term called featured. Basically I can check the Featured check box and that content will be displayed in a featured slider. The featured beverages need to be changed periodically. I would like to create a view that lists all of the beverages and from within the view I can change which ones are featured. Can anyone help me with at least a starting point on how to accomplish this? I am using Drupal 7


texts: How to boost relevance of Search API solr with creation date?

texts:
We have replaced Drupal's core search with SolR but we have noticed a recursiveness issue regarding the search results, for ex. when searching “executive committee”, documents created in 2006 and 2007 are listed before newer documents created in 2010. (http://www.etuc.org/search-page)

What we would like to do is to sort the articles by date and by relevance.

We have tried to alter this at the View level (date + Search:relevance) but it short circuits SolR.

We have looked at the search api settings and it seems that one cannot boost date field. Only fulltext fields are ‘boostable’ (?)

We have also found a few articles related to the subject:

http://www.metaltoad.com/blog/date-boosting-solr-drupal-search-results
How to boost relevance of Search API solr with the value of a certain field?

but they weren’t much help.

We are using Drupal 7, SolR 3 and the following modules

Search API 7.x-1.11
Search API autocomplete 7.x-1.0
Search facets 7.x-1.11
Search views 7.x-1.11
SolR search 7.x-1.4

Does anybody has an idea how to fix this issue?
Thank you very much in advance.


texts: Slideshow caption when logged in displays in different location when logged out

texts:
I've got a slideshow displaying on the homepage, and at the bottom of the images, I've got captions. I am using:

.views-field-body { margin-top: 250px; }

To position the caption, but the position is not consistent when logged in and out. For example, the code above displays the caption in the correct location when logged out, but when logged in, the caption is pushed further down.

What is the correct way to position the caption?


texts: views exposed filter: Prevent a user from searching default Paceholder Text

texts:
i have been looking for a solution all day, i need some help. I created a single search box using views combine exposed filters. i am using bartik theme. On the exposed filter, i have added some default text using the following code in my template.php file as per this code snippet:

function bartik_form_views_exposed_form_alter(&$form, &$form_state) {
  if (!isset($form_state['view']->exposed_input['combine'])) {
    // OK to set the default value
    $form_state['input']['combine'] = 'Find Professionals';
  }
}

So far, my default text is showing, but i need to achieve 2 things:

Make default text to disappear when user clicks on the search box
Prevent user from searching default text.

ps: "combine" is the name of my views exposed filter, while "views_exposed_form" is the form id.

Thanks for your help in achieving this.


texts: User Reference field with full list of users, but with current user as default selected value

texts:
Whether I'm using User Reference module or Entity Reference module, I can't seem to create a drop-down list of all users, where the current user is selected by default.

So all users will be in the list, but I just want to the default selection to be the current user.  How can I do this?


texts: Is there a trick to getting Mime Mail to recognize by-mailkey theme templates?

texts:
I have installed Mime Mail 7.x-1.0-alpha1 and got it set up and working for the most part.  The thing I'm having trouble with is getting it to recognize a by-mailkey template. I have been able to copy the mimemail-message.tpl.php into my theme directory, modify it and have it apply to the HTML email I am sending just fine.  I can put that file anywhere in my theme directory and it finds it and overrides the default. I cannot however get it to recognize a by-mailkey template no matter where I put it in my theme directory.

I have an email with the key help_wanted set. I have created a template file called mimemail-message--help-wanted.tpl.php, which I believe is the correct template name to apply to the email with that key.  I have cleared the cache and sent the email, but the default template is still applied.

I have also tried using mimemail-message--help_wanted.tpl.php with no luck.

I know the proper key is being passed because I can set up the mimemail-message.tpl.php to override the default template and print out the $key variable in the template and get help-wanted.

Does anyone have any experience with this and might know what I could be doing wrong?


texts: How to add different GTM snippets per environment?

texts:
We have multiple environments such as Dev, Stage, QA, and Production. Rather than having one GTM snippet that is loaded on every page request in all the environments, we wanted to separate the GTM snippets so that the GTM snippet for Dev is only loaded for Dev, the GTM snippet for Stage is only loaded for Stage, and the production GTM script is only loaded on production.

Currently we add the GTM snippet through the use of our custom theme's html.html.twig template file.

How would I be able to conditionally add different scripts in a Drupal way (e.g. custom module, custom JS)?

We initially thought to create custom modules that would a load mymodule.html.html.twig when enabled per environment. For example, the dev custom module would only be enabled on Dev, Stage custom module would only be enabled on. However that is not working.


texts:
I'm trying to understand Drupal 8 theming, since I want some custom layouts for some of my pages. I've tried Display Suite module, and it gets me some of the way, but non of the display suite layouts offers the exact layout I need.

How do I make my own Display Suite layouts? I have made a copy of the layout template files from ds/templates to mythemename/templates/generated, and renamed the file as Display Suite tells me to. When I open that file, I see Header, Left, Right and Footer "regions". But how would I go about adding new regions to that template? I understand how to add block-regions to a website, but that seems to be something different than the "regions" in a display suite template.

And if I edit a display suite template, would I somehow be able to rename it to, lets say, "mytemplate", and make it appear in the drop-down box from where you select what display-suite template to use?


texts: How to redirect anonymous users to login page using Rules module?

texts: I'm using rules module with drupal 7 in order to redirect anonymous users to the login page, so I created a rule with react on event "Drupal is initializing", condition "User has role" with anonymous user and "Not site login url", then added an action "Page redirect" to site login url. When I tried to test the rule; drupal kept redirecting to the login page over over and over until apache server stopped working. Any recommendations.


texts: Limited fields at registration time and full profile after logged in

texts:
I want to display limited fields at registration time say username email and password
And when user get registered then he can edit his profile with rest of the fields like Phone no., Address, Date of birth etc.

I tried adding field in admin/config/people
But that fields are visible at the time of registration.

How can I do that any help....
I am using drupal 7


texts: Getting session variable in view contextual filter drupal 8

texts: I am new to Drupal 8. I get group_id in session variable just like that $_SESSION['groupbysession']['group_id'] = $path[2];. now i want to get that session variable in view Contextual filters.I have no idea how to do this. I also use view extra module for this but doesn't work for me.Thanks in advance


texts: How to delete a scheduled task using Rules Scheduler?

texts:
I use the rules scheduler module (D7). So far all fine.

What I use it for:

a user registers with username and email
this users then gets 4 emails over the next four weeks, sent by the scheduler

BUT: In case a user wants to unsubscribe from these scheduled emails? How can I achieve it?

It is true that one can delete particular sort of scheduled tasks with the according action (Delete scheduled tasks). But I don't know how to indicate it shall only delete the tasks that are related to a particular?

When I list the schedule with ...
/admin/config/workflow/rules/schedule

... there is one column called "USER PROVIDED IDENTIFIER" - maybe it would help to do it with such an identifier. But I don't know how?

UPDATE TO THE QUESTION:

I tried to import with the suggested changes, this is how my rule looks like now:

{ "rules_user_reminder_after_30_days" : {
"LABEL" : "User Reminder After 30 Days",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_scheduler" ],
"ON" : { "user_login" : [], "node_insert--article" : { "bundle" : "article" } },
"DO" : [
  { "schedule_delete" : {
      "component" : "rules_send_email_notification",
      "task" : "[account:name]"
    }
  },
  { "schedule" : {
      "component" : "rules_send_email_notification",
      "identifier" : "[account:name]",
      "param_user_to_notify" : [ "account" ]
    }
  }
]
}
}

But now I got this error:

  Integrity check for the imported configuration failed. Error message: Missing configuration for parameter date


texts: Hook for when a new content type is created?

texts: Does a hook exist for when a new content type is created?  If so what is it?  I've looked through the API and nothing has jumped out at me.


texts: How to change DB active config storage of an installed site to config file storage?

texts:
The default.settings.php says

/**
 * Active configuration settings.
 *
 * By default, the active configuration is stored in the database in the
 * {config} table. To use a different storage mechanism for the active
 * configuration, do the following prior to installing:
 * - Override the 'bootstrap_config_storage' setting here. It must be set to a
 *   callable that returns an object that implements
 *   \Drupal\Core\Config\StorageInterface.
 * - Override the service definition 'config.storage.active'. Put this
 *   override in a services.yml file in the same directory as settings.php
 *   (definitions in this file will override service definition defaults).
 */
# $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage');

I have added above code to my settings.php and this is the piece of code I have added in services.yml before install.

services:
  config.storage.active:
    class: Drupal\Core\Config\FileStorage
    factory_class: Drupal\Core\Config\FileStorageFactory
    factory_method: getActive
    public: false

How can I change the DB config storage to file config storage after site install? We have config_db.module to change it form file storage to DB storage. Do we have a module to change it from DB storage to file storage?


texts: Date field in FormAPI, remove Day field?

texts: Using a 'date' field in the FormAPI, is there something I can set to hide the day field from showing?


texts: How to fix the core.extension.module list when the currently active profile has been added to it by the system?

texts:
Following the 8.6 upgrade, several of our sites have developed a strange problem. The currently active profile, let's call it foo_profile, is now also listed as a module in config (core.extension.module).

This leads to the backend of the site becoming unavailable at seemingly random intervals, until a cache is cleared. The error that's being logged is:

  The module foo_profile does not exist.

Which makes sense, since it's not a module.

I know there were some updates to profiles in 8.6, but I couldn't find anything that would help to explain. settings.php for all sites contained this prior to the upgrade:

$settings['install_profile'] = 'foo_profile';

After getting the exception, I removed that line from one of the sites, just in case. It made no difference, so my conclusion is that having that line or not doesn't affect this problem.

I tried simply removing the non-module from the list:

$conf = \Drupal::configFactory()->getEditable('core.extension');
$modules = $conf->get('module');
if (isset($modules['foo_profile'])) {
  unset($modules['foo_profile']);
  $conf->set('module', $modules);
  $conf->save();
}

That didn't overtly break anything, but now I have warnings when visiting the status report and similar pages:

  Notice: Undefined index: name in system_requirements() (line 52 of core/modules/system/system.install).
  system_requirements('runtime')
  call_user_func_array('system_requirements', Array) (Line: 403)
  Drupal\Core\Extension\ModuleHandler->invokeAll('requirements', Array) (Line: 112)
  Drupal\system\SystemManager->listRequirements() (Line: 49)
  Drupal\system\Controller\SystemInfoController->status()
  call_user_func_array(Array, Array) (Line: 123)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 582)
  Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 151)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
  Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
  Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
  Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
  Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 665)
  Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Since the problem recurs on its own schedule, I'm not convinced that's done anything to resolve the underlying issue.

So...how do I fix this?

As a bonus, how on earth did this even happen in the first place?


texts: Making sort links on views better exposed filters toggle

texts:
I was able to create sort links on views using better exposed filters. I configured the sort filter sin such a way so I have one link that is ascending and another one descending, based on post date. This works very well. What would be amazing is if I could have one link that toggles achieving the behavior of the previously explained sort links. So for example when  I'm first looking at the view sorted by ascending date I would get one exposed sort link that would sort by descending (most recent ↓). Then when I would be looking at the view sorted by descending date I would only get one exposed sort link that would sort by ascending (most recent ↑).

So in conclusion I want to combine the two views sort links that I have: most recent asc and most recent desc into one link that toggles between most recent ↑ and most recent ↓

Is there a way to do this with jQuery for example?


texts:
Recently i'been assigned to a drupal project already in development. I need to change a view but the site is quite complex. Is there a way to know how many times is a view being used?

Thank you all


texts: "Your site was unable to contact the Apache Solr server"

texts:
We have been using Drupal 6 for 2 years and we wanted to use SOLR to have a better search and index more documents.

I have did everything right with Apache Solr as per the documentation, my Solr was working fine but I am able to access it on http://localhost/solr/admin.

I have different Solr in different servers, and none work with this Drupal. So I think there is an inherent problem within Drupal, which makes drupal not to find the solr properly.

Previously, I had encountered this issue several times configuring different servers, I am used to reinstall Drupal which made solr work fine but I cant do it to this one because its been running for long with lot of content.

Can anyone help me?


texts: A button to delete multi images on one click from imagefield

texts:
In a content type I have an image field. For the upload I use Multiupload Imagefield Widget. So now it is easy to upload 10 images into one field of the content type.

If I want to remove this 10 images, I have to click remove button 10 times. Is there a module which provides a single remove button to remove all images in this field on one click?


texts: Download file from field instead of going to node page

texts:
What I'm trying to achieve is: create a new content of type arquivo, then when accessing the new content url, instead of showing a page with the fields and etc., the file from a field_file is opened/downloaded. Tried to achieve this using a custom template for the content type with no success.
The code for the tpl.php is:

<?php
$items = field_get_items('node', $node, 'field_arquivo');
$filepath = $items[1]['uri'];
$path = file_create_url($filepath);
drupal_goto($path);
?>

Any help is appreciated


texts:
I am using a Green Geeks VPS (CentOS) at the moment and I am new to it. I have found a tutorial on installing Drupal/Apache/Webadmin etc. http://drupal.org/node/743610

What I am wondering is why not just use something like XAMPP instead of all the separate installs? Is there something more I have to take into account here?


texts: Use Condition in Computed Field with Field Collections

texts:
I have an entity with a field colleciton (fc_details), and in that field collection I have fields amount(field_amount) and Type (field_type)

There are several examples to sum up field colleciton values in computed field like:

$sum = 0;
$wrapper = entity_metadata_wrapper($entity_type, $entity);
  foreach($wrapper->field_fc_details as $collection) {
    $sum += $collection->field_amount->value();
  }

$entity_field[0]['value'] = $sum;

But I want to sum up values, where field_type values = "Z".

I tried variations of "if($wrapper->field_type->value()='Z' " inside foreach, but then site gives 500 error.

Any ideas ? Thanks in advance.


texts: Node Title with apostrophes not appearing correctly

texts:
I have a site with titles for events with apostrophes and other special chartacters that are not displaying properly in the node title area but are appearing correcting in menus and other views.

Example: Ricochet Duo's The Woodswoman Project should be Ricochet Duo's The Woodswoman Project

Anything with quotes and ampersands have the same problem


texts: Keeping development database in sync with production database

texts:
Here is my process for developing, this is more of a MySQL question then Drupal.

Have a local dev environment.  This includes a local mysql and a copy of the drupal site.  all under version control.
When the site is ready, I dump my database and set up a production database, I then create a production instance of the site from my repository.

So the issue I am running into is a user is adding content to the production site.  And I am creating database changes on the development version of my site.  The two versions are now out of sync.  One solution for this is every time I want to develop on my local version I dump the production's database and load it.  So I am wondering how this problem is usually approached.  Is there something like mysqldiff that will only load data that is not reflected in the database?? Are there any drush tools that will help with keeping drupal databases in sync?


texts: How to create file repository from which I can link files to other content types?

texts:
I want to be able to "link" files to my content types. Two different nodes in two different content types can link to the same file, so I don't want use file upload field to avoid content duplication.

I also want to have publicly available "repository" where there is a list of all available files and for each file there is a list of articles / nodes to which this file is linked.

What is the simplest way to achieve this. Is there a reference field or something like that?

I would like to have little search field when linking files to content.


texts:
I'd like to create a new field type that can be attached to content (ie an article) via the admin interface through 'manage fields' of the content type. I am unsure of the process and required hooks to achieve this.

At this point I'd like the field to be nothing more than a simple text field. So far I have defined the field in:

hook_field_info
hook_field_schema (in .install file)

What other hooks do I need to get this to:
a) appear in manage fields options.
b) appear in the content editor for the content it has been applied to.

Many thanks


texts: I'm looking for a maintained module that allows to add a geo location to a node of a custom content type. I am looking for something that has integration with Google Map API so that it's possible to query the location using an address, ZIP, or name.


texts: How to switch 'standard' installation profile to 'minimal' in existing site?

texts:
I have built a druapl 8 site with 'Standard' installation profile.

How can I  switch 'standard' installation profile to 'minimal' in existing site?


texts:
The DrupalCommerceEntityController should invoke hook_entity_delete before the records in the database are deleted.

As seen in node_delete_multiple.


texts: Aegir different site folder from site name

texts:
When you create a new site in Aegir it creates the a directory using the sitename in the corresponding platform. So if the site name is example.com the path for the site will be /var/aegir/platforms/platform_name/sites/example.com/.

Is there a way to create the site in a different directory, like:  /var/aegir/platforms/platform_name/sites/my_awsome_path/?


texts: What is a proper way of uninstalling field types provided by the module?

texts:
I have a field type named mymodule_field_type, and we are installing it with
    config/install/field.storage.node.mymodule.yml, which has the following content:

langcode: en
status: true
dependencies:
  module:
    - mymodule
    - node
id: node.mymodule
field_name: mymodule
entity_type: node
type: mymodule_field_type
settings: {  }
module: mymodule
locked: true
cardinality: 1
translatable: false
indexes: {  }
persist_with_no_fields: true
custom_storage: false

This field type has no_ui set, it's supposed to be automatically attached to the chosen content type. But it is also supposed to be completely uninstalled if module is uninstalled.

What is the proper way of solving this? The issue seems to be that whatever I do, I cannot uninstall this module, because there is this message that field type is being used in the field node.[field_name].

The issue is that this problem has to be solved in order to even make the module uninstallable, so I'm effectively unable to uninstall it. What can I do in this situation?


texts: Display contact information for each car owner

texts:
I am trying to view contact information for each user who will be the car owner in this case. so in each car in car content type I want to display user info with each car he post

best


texts: Reestablishing development workflow with GIT after doing it wrong

texts:
At one point, I had the following proper Drupal development workflow: local development environment (using Mamp), dev server for testing and a production server, and I used GIT to deploy the changes from the local to the repository and then I would pull from the repository into the dev or production server. MAMP was causing me a lot of issues so I uninstalled it in favor of setting up a LAMP stack in a more traditional way. But I'm using a Mac and things got really wonky. I basically messed up my local dev environment beyond all repair and wasn't able to use it but I had an aggressive deadline for a project.

I began to make many changes to the website on the dev server and then doubling the work on the live site, no longer using the local environment or pushing the changes up using GIT. During this time, I didn't commit any of the changes to GIT either. Basically, GIT and the local dev have been out of the picture for the last several months.

Since my last commit, the following situations have changed.

created a new git repository that I want to use
my local dev stack is still non-functional
I want to set up a new host so I can test my existing dev site for current hosting issues

Where do I go from here in order to get back on track so that I can move the current website to a new host and preserve the GIT history without being able to use a local dev environment?


texts: Checking if referenced fields are empty in commerce product display node.tpl

texts:
I have a list of fields in a product display node.tpl that are references from different product types, any one of which has a combination of some of the fields of the list.
I pass the list of fields through a check to see if they exist (already answered in Check if referenced field exists in commerce product display ) and then I need to find a solution to check if any of this field is empty to avoid showing it in a dynamic accordion.
In that tplfile I reach the fields with $content['product:field_name']

I'm a little lost here, I've tried using some of field_*_field() drupal functions but I can't seem to get to the product.

Is there a way to achieve it?


texts:
I have a setup with Varnish. Varnish decides when to clear the cache for a page according to the PHP headers. I want to force Varnish to regenerate the cache for each node every time it gets updated by an user. I am looking for the best place to do this. Ideally it would be in a Drupal/pressflow hook (if there is any available) implemented in a custom module.

What HTTP caching directives Pressflow sets?
In what function, file and line number?

Answers that don't address those two bullet points will be appreciated, but not accepted.


texts:
I have a slight issue in connecting Drush to my MAMP localhost DB. Already tried multiple solutions like changing host from localhost to 127.0.0.1, and editing MAMP files like this suggestion.

It seems my socket location is slightly different from most examples I see on the web, being var/mysql/mysql.sock rather than tmp/mysql.sock. I installed via homebrew, if that's helpful.

Super new to drush, and command line in general, so any help much appreciated. All file transfers (like dl) work fine, just anything DB related throwing an error. Thanks!

    PDO::__construct(): [2002] No such file or directory (trying to connect  [warning]
via unix:///var/mysql/mysql.sock) environment.inc:523
Command pm-enable needs a higher bootstrap level to run - you will need  [error]
to invoke drush from a more functional Drupal environment to run this
command.
The drush command 'en views' could not be executed.                      [error]
Drush was not able to start (bootstrap) the Drupal database.             [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
 * connect the database through a socket. The socket file may be wrong or
the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version        :  7.24
 Site URI              :  http://default
 Database driver       :  mysql
 Database username     :  root
 Database name         :  DB_name
 Default theme         :  garland
 Administration        :  garland
 theme
 PHP executable        :  /usr/bin/php
 PHP configuration     :
 PHP OS                :  Darwin
 Drush version         :  6.1.0
 Drush configuration   :
 Drush alias files     :  /Users/UserName/.drush/pantheon.alias
                          es.drushrc.php
 Drupal root           :  /Applications/MAMP/htdocs/landmark/landmark-l
                          earning
 Site path             :  sites/default
 File directory path   :  sites/default/files


texts: How to pass values directly from THEME_NAME.info to THEME_form_system_theme_settings_submit()

texts:
Does anyone know a smarter way to load given settings from the THEMENAME.info file for the submit function only, than to create another "ghost"-form calling theme_get_setting() ? I would like to prevent the ghost form, since there is no input needed.

I only need some settings from the info file in the submit state.


texts: Can not find field_image(image) in drupal 7.24

texts:
I am new to Drupal. I am using a beginners guide pdf to get accustomed to it. It says at point 10 that :

Now, we will move on to the image property. We are going to use an existing field
for this property. In the Add existing field section, enter image for the Label. Select
Image: field_image (Image) from the Field to share drop-down, and click on the
Save button.

But in my installation:

I find no field_image (image)! What has happend?


texts: Total value is showing incorrect if click review button ubercart drupal.


texts: How to check if custom variation field is null in twig?

texts:
I would like to know how to check if a custom variation field has content in a twig template (commerce-product.html.twig with variations injected). I have tried with some filters and conditions but without success. I need to hide some html markup if the field is empty. For example:

{% if product.variation_field_mycustomfield is not empty %}

My custom field: {{ product.variation_field_mycustomfield }}

{% endif %}

My products have some variations that users can select from a list. When this select changes, the product information must change, and some variations of the same product could have this field empty or not.

This question isn't related to only image fields. It's for any kind of field.


texts: Adding fields to user registration form for admins

texts:
I use the Entity Registration module and I created a registration form for specific events in a Drupal 7 site. For the registered users, the fields are name, surname, birth date, upload administrative files etc.

Is there a way for administrators to have specific fields they can fill and that are not available to registered users?


texts: How and where is the $variables variable used in templates etc. generated in Drupal?

texts:
How and where is the $variables variables that is used in templates and theme functions generated in Drupal?

Is there documentation anywhere that defines $variables?


texts: How to display menu in view Block in drupal 7

texts:
I am creating a website in which i am trying to display the submenu into view block . how can i do this.

menu is Like

A -B-c

D -E-F

I have to display in block view

like This is view block

B C | E F

this have to display in views block  using view.


texts: Views Jump menu with taxonomy url and custom url

texts:
I have problem with jump menu and contextual filters.
My idea is this:

I have taxonomys (a,b,c) URL: example.com/a (this works fine with contex. filters)

Then: example.com/a/hello

This hello is my menu-url (I make it my own)

When I select a in this jump menu and click menu-link hello , this jump-menu a need to be activated. Default is in this jump-menu is -Any-


texts: Changing the view mode of EntityReferenceFieldItems programmatically

texts:
I have a paragraph (I'm using the Paragraphs module) that contains an entity reference field that contains references to other pages.

The display settings are set to use a particular view mode, e.g. teaser. This renders an teaser image, title and link to the page.

I would like the editor to be able to set the view mode on a per-paragraph basis. I have created a "view mode" field in the paragraph with two options: teaser, and teaser-text-only.

How can I use the view mode set in the "parent" entity (the paragraph) to add a template suggestion when rendering the "child" entities (the pages)?


texts:
For our final CS project, we have been tasked with building a project management system for a large corporation (which the company wants us to use Drupal). So far we have a few entities created (project, request, and task). A project can have many tasks, and a project can only have one request attached (the request is created first, once approved, a project is created).

Since Drupal is really more of a content (blogs/comments/articles/pages) management system, it is difficult to create dynamic forms that allow showing tasks attached to a project with the ability to add tasks directly within the project "form". I guess this would kind of be a master/detail view.

How can I go about building these types of add/edit/details "forms"? My first two ideas are:

Build custom add/edit/delete forms for each entity type
Build a node-add-project.tpl.php, node-edit-project.tpl.php, etc... for each complex view required

The downside to this is that my fields in my forms are now hard-coded. One requirement is that this system must be dynamic so the end-user can add a field if they need to.

How can I go about this? Templates? Custom Forms?

By the way I have googled, and googled, and googled (probably 5-8 hours) of different things (master details, complex forms, complex entity relationship forms) to no avail.

I am aware of the nodereference and entity reference (and all other reference) types. But these only allow you to use a dropdown list, or a select list, etc...

EDIT:

It is looking like building the database with the Schema API, and utilizing the Form, Theme, and security APIs are going to be our best bet.

Here is a good read.


texts: Drupal 7.54 DATE_RFC7231 already defined

texts:
After moving my Drupal site to a new host, I got the following error in the error logs.

  [error] 8707#0: *1 FastCGI sent in stderr: "PHP message: PHP Notice:  Constant DATE_RFC7231 already defined in /ext/vhosts/public/includes/bootstrap.inc on line 258

How can I fix it?

My site currently says "The website encountered an unexpected error. Please try again later"

My setup is as follows:

Debian 8
PHP 7.0.21
MySQL 5.6
Drupal 7.54


texts:
I use the Bluemaster theme for my site. Since I installed this theme, it worked well, but
a few days ago the background image was not shown.

I think this is because there are a large photo in background.
How do I fix this problem?


texts: field autocomplete with the same value of another field

texts: i have a problem and i don't know if drupal has support for it. for example I have "field one" and "field two" and i want that when in content type an user select a value in "field one", "field two" fills with the value selected in the "field one". It's posible to achieve that? Tried a lot of modules like autofill, or dependency control but seems that don't work in my case. Thanks!!!


texts: Registration doesn't create an order given specific registration state

texts:
I've created a new registration state (Registration in progress) and set it as the default state for new registrations.  Going through the site's course registration process results in a valid registration with this new state, but it will not create a new Commerce order.

A few things to note:

The registration process works perfectly when registrations have the old default state (Pending payment), i.e. a registration is created and the user is automatically taken to their cart.
Registrations are done using the Entity Registration module.
Neither of the Commerce Registration nor the Registration Commerce modules are in use on this site.

The basic question is this - what causes a registration to create an order?

I'm guessing I haven't given enough info to get an answer and I apologize for that but I just don't know where to start on this.

Also, I have no idea if this is a Commerce issue or an Entity Registration issue, and I am only posting here because I have had zero luck formulating a question for Google that gets me anything even remotely related to what I am seeing.

Any / all help will be much appreciated.

Thanks!

Dan


texts:
I have a form on my page that is being submitted. I am implementing hook_form_submit and within that function I have a search algorithm that processes the entered data and returns a result. I would like to display that result on the page underneath the search box. For debugging purposes so far I've simply used drupal_set_message() but this is no permanent solution.
I am new to Drupal module development so I am unsure how to go about this.

Any help would be greatly appreciated!


texts: Change the theme used for the user reset password page

texts:
Drupal 8 - I have the following issue:

Administrator user creates an account for a user
User gets a welcome email with password reset link
Upon browsing the link and passing through the hint page, the user reaches http://example.com/en/user/[USER-ID]/edit?pass-reset-token=[TOKEN]

The problem is that the password reset page uses the administrator theme, while I need it uses the default site theme.


texts: How to create forms similar to admin block forms

texts:
I want to create a form similar to Admin Block Settings form.
So far I have created draggable table, how can I add Enable and Disable sections to the form ?
I checked out Draggable Views module but it does not work out for me as I am creating a custom form.


texts: Access denied occurs after translate menu link

texts:
I want to translate my menu, I have installed internationalization, variable and locale modules but on my menu items when I click on translate :

An access Denied page is displayed :

What am I doing wrong?

[EDIT]
Log :


texts: explicit "switch to mobile theme" link with Theme Key

texts:
I'm using Theme Key https://www.drupal.org/project/themekey to switch automatically between themes dependent on browser and/or OS id.
Now I would like to allow the user to explicitly switch to or from to one or the other theme by clicking a link too. ThePersistant URL https://www.drupal.org/project/purl module might be helpful for this but how exactly can I go about implementing this?

EDIT 1

I followed Answer 1, added drupal_add_library('system', 'jquery.cookie'); into the already existing function marinelli_preprocess_page(&$vars) in my template.php.

I setup two ThemeKey rules like:

system:cookie = "theme=marinelli" THEME [Marinelli]

and

system:cookie = "theme=skeleton" THEME [Skeleton]

and
added following html to my page:

Switch to Marinelli Switch to Skeleton

But clicking the links, doesn't do anything, seems like I might be missing something or it might not quite work this way because href="#" doesn't actually reload the page if that was the actual idea...?


texts: Best way to handle views + taxonomy terms with just one linked node

texts:
For a Drupal 8 website with some different products I'm using taxonomies to organize the content. But I can't get it the way I want.

At first I organized the products like this:

Term AA

Teaser node 1 --> Node 1
Teaser node 2 --> Node 2
Teaser node 3 --> Node 3
Teaser node 4 --> Node 4

Term AB

Teaser node 5 -> Node 5

Term AC

Teaser node 6 -> Node 6

Term AD

Teaser node 7 -> Node 7

So from the menu I'll go to the term overview page and see the terms AA, AB, AC and AD. When I click on AA, I see different node teasers which lead me to the node if I click on one of them.
When I click on AB, I see just one node teaser. Same for AC and AD.

This is not really user friendly, because for AB. AC and AD the user goes to an overview with just one node teaser. And the term AB is actually the same as the Teaser node 5.

So then I tried to organize it like this:

Term A

Term AA

Teaser node 1 --> Node 1
Teaser node 2 --> Node 2
Teaser node 3 --> Node 3
Teaser node 4 --> Node 4

Teaser node 5 -> Node 5
Teaser node 6 -> Node 6
Teaser node 7 -> Node 7

So then when I go to the overview page of term A, I would like to see a mixed page of terms and node teasers, which I think is not possible in views. (Or I just can't get it to work).

Another solution I'm thinking of is to somehow redirect the user, hitting terms with just one node attached to this node, right away. So looking at the first list of terms, that would mean that going to Term AB will lead me directly to Node 5. But .. also this I can't figure out how to do it.

So .. what should I do and how do I make this work? Is it possible with views or some kind of redirect, or should I do it totally different?


texts: How do I add a hyper-link as a content type field?

texts:
I want to add a link as a content-type-field, so that it shows up under all the nodes of that content type.

This is because I do not want a link to a taxonomy-term; I want a link to the view I have created for that content type.


texts: How to create a distribution list for sending eMail?

texts:
In my project I want to create distribution list.
eg: while sending mail if I select drupal, then all drupal user should get mail. This means according to user group, mail will get created and if I selected any of the user group, then all mail id of that particular group will get selected and mail will send.

Any suggestions?


texts: I cannot log in, and I am said I have 5 failed logins

texts:
I've setup a virtual host on one of my machines. The front page shows fine, but the other pages don't. When I put in my login information, and I click the "Log in" button, I get the "page not found" error.

If I go to www.example.com/?q=user, I get that page, but when I try logging in, I see the following error message:

  Sorry, there have been more than 5 failed login attempts for this account. It is temporarily blocked. Try again later or request a new password."

How can I solve this problem?


texts: Custom field with 'point' data type for storage

texts:
I created a new entity and added a few base fields using baseFieldDefinitions(). Everything works fine so far.
The problem is that I would like on this entity to have a field with special storage ( outside of what baseFieldDefinitions() seems to be able to handle ). I want this new field to use the 'point' spatial data type.

Is this possible? If so, it is done via the Typed Data API?

I know that this is vague but I'm trying to get a grasp on these concepts and any pointers will be greatly appreciated.


texts:
I'd like to know the best way to delete system menu links.  I can't delete them through the UI because they have somehow become stray links (there is no "delete" link next to them).

I've looked at menu_link_delete, which calls _menu_delete_item, but that won't hit if $item['module'] == 'system' unless I force it which is discouraged.

So... if I can't do it through the Drupal API, do I need to do a DB query?  If so, which tables should be involved in the delete?  Can I get away with just removing records from the menu_links table?  It looks like the has_children value may also need to be altered?

Are there other options besides a DB query which I'm not seeing?

I've also seen this answer, but he just moved the stray links to another menu, which I don't want to do.


texts: Allow a node to have many dates attached to it

texts:
I am stumped trying to figure out how to set up a node to have many dates attached to it without having to just add a lot of date fields to it.

The scenario is that we have a show, and that show occurs on multiple days at different or multiple times each day.

I'd like to be able to have a content type of 'Show' with a date field and then just add multiple dates to it. However, the Date field doesn't seem to support multiple values.

How do I make this work?


texts:
Hi I am trying to create a custom block but it is not appearing in the block listing is there something missing in my code.

   <?php

  $view = views_get_view('schedule_list2');
  $view->execute();
  print $view->render();

  $view = views_get_view('next');
  $view->execute();
  print $view->render();
/**
 * Implements hook_block_info().
 */
function custom_block_block_info() {
  $blocks = array();
  $blocks['my_block'] = array(
    'info' => t('My Custom Block'),
  );

  return $blocks;
}
/**
 * Implements hook_block_configure().
 */
function custom_block_block_configure($delta='') {
  $form = array();

  switch($delta) {
    case 'my_block' :
      // Text field form element
      $form['text_body'] = array(
        '#type' => 'text_format',
        '#title' => t('Enter your text here in WYSIWYG format'),
        '#default_value' => variable_get('text_variable', ''),
      );

      // File selection form element
      $form['file'] = array(
        '#name' => 'block_image',
        '#type' => 'managed_file',
        '#title' => t('Choose an Image File'),
        '#description' => t('Select an Image for the custom block.  Only *.gif, *.png, *.jpg, and *.jpeg images allowed.'),
        '#default_value' => variable_get('block_image_fid', ''),
        '#upload_location' => 'public://block_image/',
        '#upload_validators' => array(
          'file_validate_extensions' => array('gif png jpg jpeg'),
        ),
      );
      break;
  }
  return $form;
}

/**
 * Implements hook_block_save().
 */
function custom_block_block_save($delta = '', $edit = array()) {
  switch($delta) {
    case 'my_block' :
      // Saving the WYSIWYG text
      variable_set('text_variable', $edit['text_body']['value']);

      // Saving the file, setting it to a permanent state, setting a FID variable
      $file = file_load($edit['file']);
      $file->status = FILE_STATUS_PERMANENT;
      file_save($file);
      $block = block_load('custom_block', $delta);
      file_usage_add($file, 'custom_block', 'block', $block->bid);
      variable_set('block_image_fid', $file->fid);
      break;
  }
}
?>
<?php
/**
 * Implements hook_block_view().
 */
function custom_block_block_view($delta='') {
  $block = array();
  switch($delta) {
  case 'my_block' :
    $block['content'] = my_three_upcoming_events();
    break;
  }
  return $block;
}
/**
 * Custom function to assemble renderable array for block content.
 * Returns a renderable array with the block content.
 * @return
 *   returns a renderable array of block content.
 */
function my_three_upcoming_events() {
  $output = '';
  $now_events = views_get_view_result('schedule_list2');
  $upcoming_events = views_get_view_result('next');
  $max_events = 3;
  // Make a big list of events now; upcoming events will be on the end of this list.
  $all_events = $now_events + $upcoming_events;

  for ($i=0,$z=$max_events;$i<$z;$i++) {
    $node = node_load($all_events[$i]['nid']);
    $output .= '<div>' . l($node->title, '/node/'.$node->nid) . '</div>';
  }
  return $output;
}
?>


texts: How to query for entities where term reference field  value

texts:
I'm trying to query for all entities where term reference field does not equal a certain value. For example:

  $query = $this->entityQuery->get('node');
  $query->condition('my_term_ref_field', '5', '<>');
  $results = $query->execute();

When debugging this I get no results, as it looks like it tries to inner join the field table. This doesn't work for nodes where someone didn't fill in the term reference field. Any thoughts on how I can do this?


texts:
my first question here.
Drupal 7
OG 7.2

I'm trying to make a view to display a list of attached files to a group.
I've made a custom field for the attachments in the content type for posts and in there comments.

I've achieve to display the view, both for private files and public.
Ok ! I was very happy after hours of pain.

The problem is that the view is pulling all the files from all groups.
What I want it's to see the group files.
How do I get the relation between the file and the group ?
 Any help would be appreciated.

Bellow it's a image of the view, I hope you can understand it. (field_anexos_de_grupo) it's the media field.
Note: I'm new to drupal and I'm not a php expert.

Thanks


texts: Epsa crop broken after deploy via features

texts:
I have a local Drupal installation with Epsa Image Crop. Everything works perfect and out of the box. I created a feature with the image crops and then things went wrong...

When I try to apply an image crop locally, I following picture. Like it should.

However, on the remote site I get this:

As you can see, the dimensions of the highlighted area are correct, but for some reason, the dialog box isn't taking the image on it's full width...

I already applied this patch, but no luck here... Any idea what went wrong?


texts:
So this all starts when I hit my php memory limit, I know I can increase my php memory limit... but in order to get the process that I needed running I had to up my limit to 1026M... and I dont think that this is the right way to go.

My process needs to run using cron, so I first looked to batch processing... its very usefull and works well, except when implemented with cron.

I know see that the right path is to use the d7 backport of drupal_queues.

I would put up some code, but what I am really trying to understand is the logic behind setting up and processing a queue using drupal_queues and cron.

So far this is what I got:

I set up hook_queue_info:

function mymodule_cron_queue_info() {
  $queue['mymodule_queue'] = array(
      'worker callback' => '_mymodule_queue_worker',
      );
  return $queue;
}

I setup hook_queue_worker($item)

function _mymodule_queue_worker($item) {
  $acc_id = $item['acc_id'];
  //Collect list of relevant campaign ID's
  $campaignNIDs = mymodule_get_campaignNIDs($acc_id);
  dpm($campaignNIDs);
  foreach($campaignNIDs as $key => $value) {
       $CampaignNID = $value;
       mymodule_collect_contact_actions($acc_id, $CampaignNID);
  }
}

And then I worked in the hook_cron

function mymodule_cron(){
  //Adding drupal_queue into the cron
  $items = mymodule_get_all_accounts();
  //This is the list of items that we need to itterate through
  //This will be the different ESP accounts
  $queue = drupal_queue_get('mymodule_queue'); //grab the queue
  $queue->createQueue(); //initiate the queue
  foreach ($items as $item) {
    $queue->createItem($item); //each item passed as param to worker
  }

  drupal_queue_cron_run();

So far this works and allows me to call each account separately in the queue. but now I have processes(functions) that need to be run per account. Ho would I add these processes as a "Sub-queue" to the queue that is currently being processed.

Do I need to do this or is what I have so far satisfactory?

Any light on this subject would be really appreciated as the documentation on this subject is somewhat lacking


texts: How do I hide a local task (tab) if a module is disabled?

texts:
I would like my local tasks (tabs), defined in mymodule.links.task.yml, to appear only if a certain module is enabled. If a certain module is disabled, I want the tab to be hidden.

mymodule.alpha:
  route_name: mymodule.alpha
  base_route: mymodule.alpha
  title: 'Alpha'

mymodule.bravo:
  route_name: mymodule.bravo
  base_route: mymodule.alpha
  title: 'Bravo'

My understanding is that this can be acheived by adding a _module_dependencies key to my routing.yml file.

  _module_dependencies: Optionally use this key to specify one or more modules that are required to serve this path. You can combine module names with a + (plus) for an AND relationship or , (comma) for an OR relationship. For example, _module_dependencies: 'node + search' means both node and search are needed, _module_dependencies: 'node, search' means either node or search are needed. If your module already depends on other modules for its behavior (via info.yml dependencies), there is, of course, no need for specifying the dependency here as well; however, for optional dependencies, where routes are provided only if those optional dependent modules are also enabled, this is a useful option.

https://www.drupal.org/docs/8/api/routing-system/structure-of-routes

mymodule.alpha:
  path: '/admin/reports/mymodule/alpha'
  defaults:
    _controller: Drupal\mymodule\Controller\AlphaController::render
    _title: 'Alpha'
  requirements:
    _permission: 'access site reports'
    _module_dependencies: 'comment' # this is module is enabled, this line does not cause a white screen on cache rebuild

mymodule.bravo:
  path: '/admin/reports/mymodule/bravo'
  defaults:
    _controller: Drupal\mymodule\Controller\BravoController::render
    _title: 'Bravo'
  requirements:
    _permission: 'access site reports'
    _module_dependencies: 'statistics' # this is module is disabled, this line does cause a white screen on cache rebuild

However, if a module is disabled, I get this error:

  Symfony\Component\Routing\Exception\RouteNotFoundException: Route "mymodule.bravo" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 187 of /var/www/mysite/core/lib/Drupal/Core/Routing/RouteProvider.php).

The error is thrown even when I visit: /admin/reports/mymodule/alpha.


texts: LOAD DATA LOCAL INFILE suddenly stop working

texts:
I have created a script that insert record from csv to data but it suddenly stop working on and I am getting error : General error: 2 File '/code/sites/default/files/data_file/CSVFile.csv' not found (Errcode: 2)
My site is hosted on pantheon but they not provide any support to fix the issue.
I am not sure while the script stop working even i was working fine before. Is the LOAD DATA no more supported on what would be the cause of the issue.
I am using Database Version 5.5.30 System MySQL, MariaDB, Percona Server, or equivalent
I tried LOAD DATA LOCAL INFILE to LOAD DATA INFILE but this also not working.
public function buildForm(array $form, FormStateInterface $form_state) {
$form = [];
$form['data_file'] = [
  '#type' => 'managed_file',
  '#title' => t('Data File:'),
  '#upload_location' => 'public://data_file/',
  '#upload_validators'  => [
    'file_validate_extensions' => ['csv'],
    'file_validate_size' => [25600000],
  ],
  '#required' => TRUE,
];
$form['submit'] = [
  '#type' => 'submit',
  '#value' => $this->t('Process'),
];
return $form;
}

public function submitForm(array &$form, FormStateInterface $form_state) {
$data_file_id = $form_state->getValue('data_file');
$data_file = file_load($data_file_id[0]);
$data_file_uri = $data_file->getFileUri();
$data_file_path = file_url_transform_relative(file_create_url($data_file_uri));
$data_file_server_path = $_SERVER['DOCUMENT_ROOT'] . $data_file_path;
if (file_exists($data_file_server_path)) {
  $database = \Drupal::database();
  $query = $database->query("TRUNCATE TABLE data");
  $query = $database->query("LOAD DATA LOCAL INFILE '$data_file_server_path'
    INTO TABLE `pantheon`.`data`
    FIELDS TERMINATED BY ','
    ENCLOSED BY '\"'
    LINES TERMINATED BY '\n'
    IGNORE 1 ROWS");
  drupal_set_message($this->t('File uploaded successfully.'));
}
else {
  drupal_set_message($this->t('Please try again.'));
}
}

}


texts: How do I add a password field on registration form?

texts:
I have a basic website, with nothing installed on it yet. My first task is to get my users to be able to register with a password. I see that certain "modules" will allow you to do this, but is a module really necessary to be able to register with a set password?

I'm using Drupal 7.


texts:
I'm using Drupal for my site, and I activated the CAPTCHA image for the login of the administration user. However, it doesn't work.

I don't see the CAPTCHA image, which is replaced by a placeholder.

Why does this happen? Do I need to fix something in the settings?

May you tell me how I can, at least, skip this verification to be able to log in, and remove the CAPTCHA for my account?


texts: Minor Drupal upgrade for the first time. 1 Error and 2 warnings

texts:
I am trying to upgrad 7.18 to 7.19. I followed the upgrade.txt procedure. After going to Administration > Reports > Status report I see 1 error and 2 warnings. How significant are they? Do I need to do something about them?

Error
Database schema Inconsistent
The Schema comparison report shows:

28 modules with matching tables
5 extra tables
2 modules with mis-matching tables

I've had a look at the database schema comparison report but how am I meant to make sense out of it?

Warnings

Drupal core update status   No available releases found
There was a problem checking available updates for Drupal. See the available updates page for more information and to install your missing updates.

Module and theme update status  Out of date
There are updates available for one or more of your modules or themes. To ensure the proper functioning of your site, you should update as soon as possible. See the available updates page for more information and to install your missing updates.


texts: Drupal 8: Upload Validation form alterations ignored

texts:
I'm trying to ignore the auto down scaling of large images and replace the validation step with a hard check that the size matches the maximum size provided. I'm trying to do this through the HOOK_form_alter hook and while it appears to be affecting the form render array, the AJAX request seems to ignore my changes and run the default upload validation steps.

Here's what i'm doing:
In the seven.theme file:

function seven_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $imageForValidation = NULL;

  if (isset($form['field_name_here'])) {
    $imageForValidation = $form['field_name_here'];
  }

  if ($imageForValidation != NULL) {
    // Validate
    $imageForValidation['widget'][0]['#upload_validators']['myTheme_image_validator'] = array();
    unset($imageForValidation['widget'][0]['#upload_validators']['file_validate_image_resolution']);
  }

  return $form;
}

function myTheme_image_validator($file) {
  $errors = array();

  // This doesn't even get called.

  return $errors;
}

I've debugged with xdebug and the render array is indeed getting affected, but the result of uploading an image is always the same as the default setup. At the very least I expect the unset validator to not get run, but it still downscales.

Has anyone got round this issue before?


texts: Code Adding Additional Node Reference to Existing Node

texts:
I have 2 content types: video and product. Each product contains a node reference to a video, and products can be linked to multiple videos. I'm writing a custom module to add in lists of these products and videos from an outside URL with JSON. Loading the content into Drupal isn't an issue.

What I want to do is check to see if the product exists, and if so then to add an additional node reference to the loaded video. The JSON spits out an array of videos, and there's a product array within each video array (so 1-10 products can be linked to one video). Each product has a specific product ID I'm passing in, and with that I'm able to single out the product node that needs to be updated. I load the product node, and then instead of adding an additional reference, the code I have is replacing the node reference. I've tried a handful of changes which either alter nothing or throw an error.

Here's the code:

 $result = $efq->entityCondition('entity_type', 'node')
  ->fieldCondition('field_product_id', 'value', $prodID, '=')
  ->execute();
 if (!empty($result['node'])) {
   $nids = array_keys($result['node']);
   $node = node_load($nids[0]);
   $node->field_video['und'][0]['target_id'] = $node_id;
   node_save($node);
 }
 else
 {
   Add product node
 }


texts: How do I add column to existing table on module installation?

texts:
I want to add an extra field to the users table from a custom module. I am not sure how exactly can it be done. I'm sure it is done in mymodule.install file.
Should I use db_add_field, or is there any other way? And where should I implement it? hook_schema (but the schema is already defined), or hook_install?


texts:
Drupal 7.26 multi-site , one of my sites is playing up.
Error started with no login page until I realised all nodes except home were not found.
So I tried putting in code in index.php to see errors but none showed up. Then I dropped the database and reinstalled settings to start with basic drupal install but after importing sql and again drush updating database still pages cannot be found excepting home page. Then went to ?q=user to login as admin and could see all the pages but clicking on any one of them would throw page not found error.

update: this has morphed into new question but was able to regain pages by removing clean-urls so will grant answer and ask new question.


texts: How to move custom code into template.php

texts:
In my node.tpl.php file I have this custom code:
<?php if($node->field_division['und'][0]['value'] = 1):
    $cta = $GLOBALS['base_url'].'/node/6';
elseif($node->field_division['und'][0]['value'] = 2):
    $cta = $GLOBALS['base_url'].'/node/7';
endif;
?>

I want to move it to my template.php file, so I can access it both from node.tpl.php and page.tpl.php.
How can I do this?
I tried following the examples in this thread and this article but I can't get it to work. Any help would be greatly appreciated.


texts: How can I prevent an organic group administrator from accessing edit page of a group?

texts:
I want them to be able to post content only, not edit the group itself.  I'm using og_read_only so they can only post content to their own group as well.  This module has a problem though, you have to select which content types are read only each time you create a group, and if you add content types, you have to edit all of your groups again and check off the new content type as read only.

Is there a module that can prevent the group admin from accessing the group edit page?  Would that module also be able to prevent the admin from posting to a group that they are not a member of?

I will accept an answer if it only covers preventing the group admin from accessing the edit page.  I was just hoping the other issue might be covered by the same module since they both seem related to access control.


texts:
Here I have a problem with Views and Calendar modules.
I created test events with a date field.

I configured a view for Calendar with the date field, but no events are displayed ...

How to?

And if possible, how to remove the link on the month names?

thank you very much


texts: How do I download a JPG file from the server?

texts:
I have written a custom module in which i have a download button like given below.

$form['topics_info_graph']['download_graph'] = array(
 '#type'  => 'button',
 '#value' =>  t('Download Graph'),
 '#button_type' => 'button',
 '#ajax' => array(
   'callback' => 'digitaliq_bckgrd_variable_ajax_download_callback',
   'wrapper' => 'download_graph',
   'event' => 'click',
 ),
);

Onclick of this button i need to download a jpg image which is located in the temp folder.
I'm able identify the file name and the path, Not sure how to download. any help?

function digitaliq_bcgrd_variable_file_download($filename) {
  $temporary_directory = variable_get('file_public_path', conf_path().'/files').'/tmp';
  $temp_path = $temporary_directory . '/';
  // Download logic should come here, any help?
}


texts: What's the differences between these 2 queries to publish/unpublish nodes?

texts:
I found these 2 queries to publish or unpublish a node programmatically:

db_query("UPDATE {node} SET `status` = '1' WHERE `nid` =:nid ;"
    ,array(':nid'=>$node->nid));

db_query("UPDATE {node_revision} SET `status` = '1' WHERE `nid` =:nid AND  `vid` =:vid;"
    ,array(':nid'=>$node->nid,'vid'=> $node->vid));

I do not understand the difference, and not sure which one use.

Any suggestions?


texts: How to set up the publish and prompt to front end settings in feed importer?

texts:
I have a feed importer which is attach to the "feed source" content type. This feed importer create nodes of type "Blog". I want when I want to create a feed source content and select the publish in the publish settings the newly created blogs should also be published. But if while creating the feed source content I unchecked the publish in the publish settings the the newly created blogs should also be unpublished. Same is for prompt to front end.

How can I achieve this functionality through feed importer?


texts: Save node when content with reference to it is created

texts: I have two content types - Review, and Business. Reviews have an entity reference field linking the review to the Business being reviewed. On the business page, I have fields that display the averages of the submitted reviews for different aspects of the Business. However, the average only updates itself when the node is saved. So, I need a way to automatically save the business page when a review referencing it is created. I'm assuming that the best way to go about doing this would be using Rules, but I am not sure what actions to assign to the Rules to make it tick. Any suggestions?


texts: How do you go to an overlay view within Drupal using drupal_goto?

texts:
I want to redirect to a page with an overlay within code.  I have tried the following, which is the path in the URL.

 drupal_goto('#overlay=admin/vendor/auth-stripe');

The path I want in overlay is admin/vendor/auth-stripe.  When I remove the #overlay= it works, but I want my user to see it in overlay mode.


texts: drupal 7 display user info for current user

texts:
I need to display name, role, photo of current user. I'm use views, in Advanced settings add Contextual filters select Content: Author uid and in settings of it select Provide default value ,in type selectbox choose User ID from logged in user. But in fields i haven't field 'user:name'. If i create relationship content : author , user name will be displayed, but only for users, that published node. At the end, i want see like this

Hello, SmithJN
Role: Authorised user
Photo: [photo]


texts:
How to upload multiple files in Alfresco using custom content type of Drupal using CMIS module?

In settings.php, i have configured like below,

$conf['cmis_sync_map'] = array(
   'alfresco_upload' => array(
   'enabled' => TRUE,
   'cmis_folderPath' => '/Sites/beneficiery/documentLibrary/first', // you need to create a site and add a custom foder in it (on Alfresco side)
  //'content_field' => 'field_upload1',

  /*array(
    'drupal' => 'some_other_custom_field',
    'cmis' => 'cmis:someOtherCustomProperty',
    'cmis to drupal' => TRUE,
    'drupal to cmis' => TRUE
    ),*/
  array(
    'title' => 'cmis:name'
    'field_upload1' => 'cmis:file',
    'field_upload2' => 'cmis:file'
    ),

 ),
'deletes' => TRUE,
);

How to give files in the array list to store files in alfresco ?

or if any other method available, please let me know,


texts: Cannot change logo or colors of a scheme

texts:
Hello I use Open Atrium based on Drupal. I can use the standard Radix 7.x theme, but even with that I cannot change the color scheme by saving it via Colorize. If I then use another theme I cannot even get the logo to display or any submenu to appear. I am not sure if it is a question of permissions. The site is installed on a VM as part of a webmin set up. I have seem very nice sites in both Drupal and OA so I am sure I should be able to customize my site, but it just does not work. The colorize shows the result on Radix, but as soon as I save it it forgets it. In my experience this might either mean that the path to the new colors (CSS?) is not valid, reachable or has the wrong permissions. DO you have any idea of what I can try? I need nothing fancy, but I'd like to customize the logo and colours and have all the Radix menus in another there, e.g. Bartik....Thanks in advance for any help you can give me. Please note I am not a programmer...if you advise me to change something in the code I can do it but you have to give me the full instructions. Thank you so much. regards
Enea