texts: Best approach for [back][next] form submitting

texts:
I've been doing a [back][next] to [finish] set of forms for user input fields, think of it like a questionnaire for user info where the user can still go back to the previous pages to update their info.. until it reaches the end of the pages to [finish]

I've done this before (hardcoded) but my code is too long and all the debugging gave me a headache. My first approach was:

Use a PHP case to find out which phase/step the user is in now
If the user clicks on [next], the page variable appends a +1 to the page count
If the user clicks on [back], the page var deducts -1 to the page count, until it reaches
[finish]
If the user leaves the page for some reason and comes back to it, the session/cookie saved fills in the form values and which phase/step the user is in

This method of mine isn't very dynamic as the php case is hardcoded to a set of page numbers & phases, if the client wants to add another page; that can be a problem.

I'm new to Drupal; maybe Drupal already has some part of the API that makes this [back][update][next][finish] easier, or a easier way to store cookies? If by PHP only, is there a better approach?


texts: Creating Nodes and Referenced Nodes at Same Time

texts:
I have a situation where I would like to be able to create nodes and referenced nodes at the same time.  Are there any solutions for this that work well for this?

To clarify what I am talking about, consider the following situation (highly simplified for the sake of explanation):

There is a content-type Class that has a node referenced field, Student.  I would like to have users be able to create Class nodes and Student nodes at the same time.  I would also like them to be able to use the normal node reference auto-complete to pick a Student who happens to already exist.

Ideally, I would like all of this to work from a single page, and also work within the confines of the Drupal permission system so I can have various roles and various permissions.

Yes, I know that in this case Student would be best served as a user (rather than a node), but Class and Student are just to illustrate the situation.  The real scenario really does need node references.

There is a similar question to this, Creating referenced nodes together with parent node, but I am specifically interested in Drupal 7 solutions only.

EDIT:

Not just looking for existing modules, but also head starts for custom code.


texts:
I'm currently trying to migrate my Drupal 7 site, which has the Dutch language enabled, to Drupal 8. I have enabled the following modules as instructed in the docs: Configuration Translation, Content Translation, Interface Translation, Language. After running the migration, no nodes have been created on the Drupal 8 site. Moreover, the log contains lots of error messages similar to the ones underneath.

  Migration d7_node_complete:webform did not meet the requirements.
  Missing migrations language. requirements: language.

  Operation on Node complete (Webform) failed

Am I doing something wrong? How can I solve this?


texts: Does hook menu accept a wildcard as argument 0?

texts:
In a custom module I have implemented hook_menu() using the following code.

function MYMODULE_menu() {
  $items = [];

  $items['%/review'] = [
    'page callback' => 'review',
    'page arguments' => [0],
    'access arguments' => ['access content'],
    'type' => MENU_CALLBACK,
  ];

  return $items;
}

Wildcard should be existing node. I am trying to access mydomain.com/product1/reviews (where product1 is node/1) and then print some related product data on reviews page.

I'm getting a 404 error. If I change $items['%/review'] to  $items['abc/%'] everything works. What can be the problem?

Note: I don't want to change node route. I want to access this path mydomain.com/product1/reviews where product1 is an existing node.


texts: How to specify the version for drush site-install

texts: I am running drush site-install and I want to install d6 but d7 is default, how to I specify the Drupal version?


texts: Avoid the user is asked to download the files

texts:
I am very new to Drupal sorry if my question is very basic or common.
I am creating a web site using Drupal 7 and I am using Tack da files module to tack files which are available for download.

My problem is that I have many PDF files in my site available for download, and the sites shows a popup window to download some of those PDF files. I do not want that popup window, but the site showing the PDF.

Why does it offers the user to download the files, instead of showing them?


texts: Give permissions to users to edit Drupal Views content

texts:
How to give permission to users to edit the content that are in Views.
In Views the FORMAT is:

Format: Unformatted list | Settings
Show: Content | Full content

Thank you in advance.


texts: Drupal 8 Contextual Filter Exclude option

texts:
I have a case where I want to list all taxonomy terms but exclude the term that is filled in the url. In D7, in contextual filters you could expand 'More' and check that option. I cannot find this option in D8. Am I looking in the wrong place or just not seeing it, or is this option not (yet) in Drupal 8.

If the latter, is there any other option to become this? I searched around but without any succes.

Thanks in advance


texts: Panels - Style region to become a drop down/expandable menu

texts:
Please see: http://drupal.org/project/tableofcontents

I am using Panels and would like to style a panels region so I am able to hide/show just like the TOC module above.

I have looked on Drupal downloads for a module, but none work the way I want.

Any suggestions? Thanks for your time!


texts: Creating a view with 2 content of different content types

texts:
I currently have 2 different content types which are very different from each other. I have also created multiple content using these content types.

I want to create a view which shows only 2 specific contents one below the other. Is this possible? Currently I can only have a view which filters on the two content types but that results in all of the different instances of the content types coming onto the page and not just the ones I want.

The content that I want to show in the view have no relationship with each other, I just want to be able to filter them in using their names.


texts: hook_block_view For an Array of Paragraphs

texts:
Is there a way to use the theme() function to process an array of paragraphs, in a fashion to how theme('item_list', $theme_args) works?

If there is not a way using the theme function, what then is the "preferred" way to create a render array for an array of paragraphs?


texts: Hide Authoring info on certain pages/nodes

texts:
I am looking for a way to hide the "Submitted By: .... on ...." info on certain pages. I am aware that it can be removed from all pages of the 'Basic Page' or 'Article' type through the configuration settings, however I would like the info to appear on all pages unless I turn on a setting whilst creating/editing the page which hides it on that certain page.
Does anyone know of a way to do this?
Thanks,


texts: How to configure paragraphs module for multilingual

texts:
I try to configure the Paragraphs drupal module for a multilingual website.

I have :

set the content type translatable with field translation
enable translation on the paragraphs field
enable translation for the field in the paragraph bundle (or not)

However, when I create some content and translate it, the existing paragraphs are not displaying in the other language.

What's the correct/working way?


texts:
I am looking for a way of getting menu items for a menu i.e(Main menu) via rest, enabling the Menu resource and trying /entity/menu/{menu}
gives me only dataset of the menu i.e

{
  "uuid": "57e695a4-2af8-43ac-9300-b989ecbb2d87",
  "langcode": "en",
  "status": true,
  "dependencies": [],
  "id": "main",
  "label": "Main navigation",
  "description": "Site section links",
  "locked": true
}

but I need the menu links associated to that menu too.
which is the most suitable approach ?


texts: Using different field template suggestion in different view mode

texts:
I have a field field_a that has a template suggestion of field--node--field_a.html.twig. Using that field template suggestion, I've modified the field to render a certain way within the template field--node--field_a.html.twig.

If I then create a teaser view mode and want to have the field render slightly different within the teaser, how do I write the field template suggestion to target only the teaser view mode?


texts: Is it possible to make hook_view() the same as hook_edit()?

texts:
My current client does not like the separation between viewing their custom content types and having to travel to a different page to edit. They are pushing for the View page and the Edit page to be the same. Are there any negative ramifications of simply redirecting from hook_view() over to hook_edit()?

The client is a desktop application developer, with a large installed base of clients, and I'm making the first "web version" of their desktop software. They want their webapp to behave as close as possible to their last desktop version. Their application is sorta like a CAD/3D-Modeler, and "viewing a model" without the ability to make any edits makes no sense for their users. Hence the request to get rid of hook_view() and make hook_edit() triple functional (create,edit & view).


texts:
I am trying to create an entity programmatically.

My code:

//my entity
use \Drupal\my_module\Entity\my_entity;

$entity = my_entity::create(
      [
          'label' => "token",
          'type' => "bundle",
          'uuid' => $uuid,
          'user_id' => $user->id(),
          'entity_type' => $node->getType(),
          'entity_id' => $node->id(),
          'value' => 10,
          'read' => false,
          'created' => time(),
          'changed' => time()
      ]
  )->save();

However, on save, it gives me this sql error. What am I missing?

  Drupal\Core\Entity\EntityStorageException: SQLSTATE[42000]: Syntax
  error or access violation: 1064 You have an error in your SQL syntax;
  check the manual that corresponds to your MariaDB server version for
  the right syntax to use near 'read, created, changed) VALUES
  ('bundle', '4a6ca0e3-89f0-46da-8889-c42a7f45ec4a'' at line 1: INSERT
  INTO {my_table} (type, uuid, user_id, entity_type,
  entity_id, value, read, created, changed) VALUES
  (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4, :db_insert_placeholder_5,
  :db_insert_placeholder_6, :db_insert_placeholder_7,
  :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] =>
  bundle [:db_insert_placeholder_1] =>
  4a6ca0e3-89f0-46da-8889-c42a7f45ec4a [:db_insert_placeholder_2] => 2
  [:db_insert_placeholder_3] => article [:db_insert_placeholder_4] => 14
  [:db_insert_placeholder_5] => 10 [:db_insert_placeholder_6] => 0
  [:db_insert_placeholder_7] => 1493818295 [:db_insert_placeholder_8] =>
  1493818295 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
  (line 770 of
  core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).


texts: Change drupal 7 way of hashing password?

texts:
Hi I am trying to migrate users from a legacy custom CMS site that used "sha256" technique to hash passwords to drupal 7 platform.

Upon further reading I came to know that drupal 7 stores passwords as salted and sha512 hash.

How can I change drupal 7 way of storing password hashes/ authentication of users to sha256 technique? Any direction would be helpful.


texts:
I am trying to create a form that will have the input boxes inline and next to one another. I have created the following module but nothing seems to help. Can anyone help to solve this issue? Also the form doesn't seem to be reacting to changes in the size parameters.

function name_search_block_info() {
    $blocks['name_search'] = array(
        'info' => t('Name Search Block'),
    );
    return $blocks;
}

function name_search_block_view($delta='')
{
     $block = array();
     switch($delta)
     {
        case 'name_search':
          $block['subject'] = t("Search Form");
          $block['content'] = "
".drupal_render(drupal_get_form('name_search_custom_search_form'))."
";
          break;
     }
     return $block;
 }

function name_search_custom_search_form($form_state) {
  $form = array();

  $form['keyword'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#attributes' =>array('placeholder' => t('Search')),
    '#maxlength' => 64,
    '#size' => 32,
    '#required' => TRUE,
    '#id' => 'searchfield',
    '#prefix' => '
',
    '#suffix' => '
',
  );
  $form['location'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#attributes' =>array('placeholder' => t('Zip')),
    '#maxlength' => 5,
    '#size' => 7,
    '#required' => TRUE,
    '#id' => 'locationfield',
    '#prefix' => '
',
    '#suffix' => '
',
  );

  $form['#submit'] = array('name_search_custom_search_form_submit');

  return $form;
}

function name_search_custom_search_form_submit($form, &$form_state) {
  $redirect_url = 'search/node/';
  $redirect_url .= 'type:' . $form_state['values']['type'];
  $redirect_url .= ' category:' . $form_state['values']['category'];
  $redirect_url .= ' %' . $form_state['values']['keyword'] . '%';

  $form_state['redirect'] = $redirect_url;
}


texts: Error: The website encountered an unexpected error. Please try again later

texts:
After I put a new custom theme I did in my theme folder, when I go to my website to install and apply the theme, the site just keeps returning this error:

  "The website encountered an unexpected error. Please try again later."

PHP error log message:

  "Drupal\Core\Extension\InfoParserException: Missing required keys (core) in themes/custom/javali/javali.info.yml in Drupal\Core\Extension\InfoParserDynamic->parse() (line 29 of /home/rui/public_html/core/lib/Drupal/Core/Extension/InfoParserDynamic.php)."

Yes, I know the error is very common, but I believe I explained my specific problem well.

PS: And now when I put the theme in the folder themes folder, the site works except the admin nodes.

PROBLEM SOLVED:
I put the following lines on the .info.yml file as Neograph734 said and now everything works fine!

core: 8.x
version: 8.x-2.0


texts: How to intetrupt a form submission in drupal

texts:
I have made a custom module where I create one page. In that page I load the existing form for creating a new content and also add a password field. In my loaded form I have an email field. I want before submitting the form to check if there exists a user with the username the value found in the email field and the password offered by the password field. Here I have 3 scenarios:

if the user does not exist I take the email and password and create an account then create the content
if the user exists and the password is correct , I create the content
if the user exists but the password is incorrect I stop the form submission

My problem is I don't know how to stop the form submission ( I am refering to scenario number 3). Any suggestions are most aprerciated

Here are the callback for the page function:

function add_new_article_simple_page() {
  module_load_include('inc', 'node', 'node.pages');
  $node_form = new stdClass;
  $node_form->type = 'announcement';
  $node_form->language = LANGUAGE_NONE;
  $form = drupal_get_form('announcement_node_form', $node_form);
  return $form;
}

the alter function to insert the password field :

function add_new_article_form_alter(&$form, &$form_state, $form_id){
  if($form_id=='announcement_node_form')
  {
    $form['#after_build'][] = 'add_new_article_after_build';
    $form['account_password'] = array(
        '#title' => 'Parola',
        '#type' => 'password',
        '#required' => TRUE,
    );
    $form['#submit'][] = 'add_new_article_form_submit';

    return $form;
  }
}

and the form submit function

function add_new_article_form_submit($form, &$form_state){
  $email=$form_state['values']['field_email']['und'][0]['value'];
  $password=$form_state['values']['account_password'];
  //check if the email even exists
  if(!db_query("SELECT COUNT(*) FROM {users} WHERE name = '".$email."';")->fetchField())
  //create the new account
  {
    $edit = array(
        'name' => $email,
        'pass' => $password,
        'mail' => $email,
        'init' => $email,
        'roles' => array('4' => 'standard user'),
        'status' => 0,
        'access' => REQUEST_TIME,
    );
    $loc_var=user_save(drupal_anonymous_user(), $edit);
    $GLOBALS['new_user']=$loc_var->uid;
  }
  else
  {
    //check if username + password are valid combination
    if($uid = user_authenticate($email,$password))
        //log in user after account creation
    else
        //this is where I want to interrupt the submission of the form
        form_set_error('account_password', 'Parola nu este buna pentru acest email.');
  }
}

When i test the 3rd scenario: The content is created , the page jumps to that content page and that is where the error message appears

I have followed a suggestion to try hook_form_alter, so I wrote a simple validation function which should always give an error. The problem is that the content is still submited and saved. It doesn't seem to even call hook_form_validate .. Here is the function :

function add_new_article_form_validate($form, &$form_state)
{
    $email=$form_state['values']['field_email']['und'][0]['value'];
    $password=$form_state['values']['account_password'];
    form_set_error('account_password',t('The form is being validated.'.$email.' and '.$password));
}

Thank you,
Cristi


texts: How would one upload a list of users via a .csv file and have them blocked by default?

texts:
The user import modules exists for Drupal 7, but how would one import a list of user from a csv file into Drupal 8? And once they are imported, have them blocked by default.

Now when the users come to the site to register, they can only register with one of those imported accounts on the csv. So that means you cannot create a new account, but only unblock an existing account in the system. How would one accomplish this setup?


texts: How to render $site_name without html tag?

texts:
The $site_name variable get the name of the site wrapped in <a> tag but I want print only the value without html?

Is possible?

Thank you in advance.

  EDIT

  I'm using the strip_tags() function of php <?php print strip_tags($site_name); ?> but I don't know if is the best solution to solve the issue.


texts: How is AJAX attached to exposed filters?

texts:
I am currently rendering a view manually like so:

$content = \Drupal::service('renderer')->renderPlain(views_embed_view('user_admin_people', 'page_1'));

Then I'm sending the html to the page and inserting it into a div with javascript.  I needed to use renderPlain() rather than render() because when I was doing that, I was getting this error:

  LogicException: Render context is empty, because render() was called     outside of a renderRoot() or renderPlain() call. Use renderPlain()/renderRoot() or #lazy_builder/#pre_render instead.

Now, you're probably thinking, why don't you just use render arrays normally and let Drupal handle it?  Unfortunately, I can't do that, I need to render the view's html and send it to the page, which I have already done.  BUT, when I do this, clicking on 'Filter' brings me to the /admin/people page of the Drupal site (on which it will do ajax filters properly, because it rendered from a normal render array).

How could I attach the javascript to this view html so that it reloads its data via ajax instead of linking me to the view's page?  I have already tried Drupal.attachBehaviors(), thinking that it would run something from ajax_view.js from views (which is a confusing & large file).

Or, where would I look in core to find out more about this, or where is some good documentation to read?  Am I looking in the right place in core, looking at ajax_views.js?


texts: Is it possible for the Contact page to have 2 URL aliases? or clone it?

texts:
My client is wants the Contact page to be available in more than one place in the menu system. Problem is this would interfere with how sidebar menus load. so ideally it would be nice to have 2 URL aliases for it,  …or as alternative just clone the page.

Does anyone know how to do either of these options. I need to do the same for the User page.

big thanks in advance!


texts:
I have a list ordered on a specific field. The value of this field contains yes/no.

So the list first displays all rows with yes. After that all rows with no are displayed.

I would like to display a second title before all rows with no. How to do this?


texts:
I am having difficulty getting drupal to redirect a user to a specific page after completing the registration form.

In the user.module file there is this:

// No e-mail verification required; log in user immediately.
elseif (!$admin && !variable_get('user_email_verification', TRUE) && $account->status) {
    _user_mail_notify('register_no_approval_required', $account);
    $form_state['uid'] = $account->uid;
    user_login_submit(array(), $form_state);
    drupal_set_message(t('Registration successful. You are now logged in.'));
    $form_state['redirect'] = '';
}

I would have assumed that by entering the path you wish to redirect to, in the form redirect  ,it would redirect. For example:

$form_state['redirect'] = '/page/I/Want/To/Redirect/To';

However this is not the case. When the user is logged in after completing the registration form they are taken to the homepage.

Once the user is logged in (from the registration form) I wish to send them to our services page. But for them to be sent to the homepage every subsequent time they login.


texts: How can I download files from public folder?

texts:
I want to provide download link to the users to download the files which are present in the public folder. How can I achieve that, I tried below but not worked.

if ($handle = opendir(variable_get('file_public_path', conf_path(). '/files/') .'/xmluploads/Sainath')) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            $file = basename($_GET[$entry]);//$file consists caste certificate.pdf
            $file = variable_get('file_public_path', conf_path(). '/files/') .'/xmluploads/Sainath'.$file;
            if(!$file){ // file does not exist
                die('file not found');
            } else {
                header("Cache-Control: public");
                header("Content-Description: File Transfer");
                header("Content-Disposition: attachment; filename=$file");
                header("Content-Type: application/zip");
                header("Content-Transfer-Encoding: binary");

                // read the file from disk
                readfile($file);
            }
        }
    }
    closedir($handle);
}

This error I am getting:

Notice: Undefined index: caste certi.pdf in file_upload_download() (line 194 of C:\xampp\htdocs\academy\sites\all\modules\custom\file_upload\file_upload.module).
Warning: readfile(sites/default/files/xmluploads/Sainath): failed to open stream: Permission denied in file_upload_download() (line 206 of C:\xampp\htdocs\academy\sites\all\modules\custom\file_upload\file_upload.module).

Please help regarding this, Thanks in advance..


texts:
While reading several different ways on creating custom tokens i am still unable to assign values to custom made tokens and i don't understand why.

This is the code for hook_token_info().

function my_module_token_info(){
  $info['types']['custom_tokens'] = array(
    'name' => t(Custom Tokens'),
    'description' => t('Custom Tokens'),
  );
  $info['tokens']['custom_tokens']['custom_value_1'] = array(
    'name' => t('Custom Value 1'),
    'description' => t('My custom value 1'),
  );
  $info['tokens']['custom_tokens']['hello_world'] = array(
    'name' => t('Hello World Test'),
    'description' => t('Hello World Test'),
  );
  return $info;
}

This is the code for hook_tokens().

function my_module_tokens($type, $tokens, array $data = array(), array $options = array()){
  $replacements = array();
  if($type == 'custom_tokens'){
    foreach($tokens as $name => $original){
      switch($name){
        case 'custom_value_1':
          $replacements[$original] = $data[$name];
          break;
        case 'hello_world':
          $replacements[$original] = 'HELLO WORLD';
          break;
        default:
          break;
      }
    }
  }
  return $replacements;
}

This is the code for hook_webform_submission_presave().

function my_module_webform_submission_presave($node, &$submission){
  token_replace('[custom_tokens:custom_value_1]', array('custom_value_1' => $submission->data[34][0]));
  //this works for some reason
  token_replace('[custom_tokens:hello_world]');
}

The token appears in the browse all tokens area. When I run this with xdebug it shows that token_replace() does return a string, but when I use this token in webforms email the token is empty. Other tokens that are made with contributed modules are working correctly in the email. If anybody can point out why this isn't working please let me know.

EDIT:
Just to note I am attempting to use the token in an E-mail template in: http://localhost/node/###/webform/emails/8
[current-user] and [submission] tokens are working but these are built by contributed modules.

EDIT:
I tried creating a token that just has static content and doesn't need to use $data. For whatever reason this specific token works in the email template but the tokens with values obtained at run time still don't. I suspect the fact that $submission is a reference variable and it is being altered after the token_replace() might be having some affect although i don't see how.


texts: Adding process function in address field

texts:
I am customising address field so need to add process function in address field element.

If I am using following code, then its adding process function but then I am not able to call protected function which are defined in address class in address field module.

$info['address']['#process'][] = 'custom_feature_address_element_process';

If I am using following code, then its not working.

$info['address']['#process'][]  = array(0 => 'Drupal\customaddress\Element\CustomAddress', 1 => 'customprocessAddress');


texts: How Can I send full content body field by simplenews_content_selection?

texts:
I use the drupal 7 and simple news content selection module for simplenews.

When select an existing content for send by simplenews only the title of its content add to simplenews sent mail.

I want to send whole content (the full body field) of selected content by simplenews.have any idea?

thanks before hand


texts: How do I autoload a class with the X Autoload module?

texts:
I have X Autoload installed and enabled. I'm trying to get a simple example to work. The below setup throws the error:

  Fatal error: Class 'Pet' not found in
  MY-SITE/sites/all/modules/foo/foo.module on line 15

Have I got the directory structure correct for pet.php? I'm finding the docs difficult to follow on the placement and naming of the file that contains the class definitions. I'm trying to follow the PSR-0 standard to begin with. Thanks.

UPDATE: The below has now been corrected as per Clive's answer.

foo.info

name = Foo
core = 7.x
dependencies[] = xautoload (>= 7.x-4.0)

foo.module

<?php

function foo_menu() {
  return array(
    'foo' => array(
      'title' => 'Foo',
      'page callback' => 'foo_page',
      'access callback' => 'user_access',
      'access arguments' => array('access content'),
    ),
  );
}

function foo_page() {
  $output = \Drupal\foo\Pet::dog();
  return array(
    '#type' => 'markup',
    '#markup' => $output,
  );
}

Pet.php (MY-SITE/sites/all/modules/foo/lib/Drupal/foo/Pet.php)

<?php

namespace Drupal\foo;

class Pet {
  public static function dog() {
    return 'Buster';
  }
}


texts:
I want to expose the node add form for a particular content type to anonymous users but not with all the fields visible. I want limited fields to be visible to anonymous user.
I have tried to hide the unwanted fields through display fields functionality of cck module, but it does not seem to work.

I also want to theme the node add form in a way that the various text fields with different text sizes should all appear of the same size to anonymous user. Just as a proper form.

Please tell me a way to do this.


texts: View Contextual filter for content updated dates

texts:
I am new to Drupal.

I want to implement a contextual filter in YYYYMMDD or in Unix date format. if I pass a value as 1st Dec 2013 (20131201) then it should return me all the contents who has been updated after that date. I am not able to get how to do it.. I got to know about updated date but its in the format of CCYYMMDD is it same as YYYYMMDD? if not then can I change it to so?


texts:
I am getting the following error:

  PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction: INSERT INTO {domain_source} (nid, domain_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array([:db_insert_placeholder_0] => 101712 [:db_insert_placeholder_1] => 0)

This happens hook_node_update(). Do you have an idea on how to solve the issue?


texts:
I'm installing drupal 7 on my windows 7 machine and I use WAMP. Thing is, at the end of the drupal installation I had the following error:

  An AJAX HTTP request terminated abnormally. Debugging information
  follows. Path:
  http://localhost:8080/install.php?profile=standard&locale=en&id=1&op=do
  StatusText: ResponseText: ReadyState: 4

Has anybody ever seen this during the installation process? Do yo  guys have any idea what it could be?

One thing I should mention is that my localhost is localhost:8080, that's where I commenced the drupal installation, but in phpmyadmin when I am asked:

  In the drop-down menu beside the Host field, select Local.

I'm pretty sure it says localhost only.
COuld it be that?

thanks


texts: Class not found in drush command definition

texts:
In the drush command definition hook for the Node Revision Delete project I have the following code:

use Drupal\node_revision_delete\Utility\Time;

...

function node_revision_delete_drush_command() {
  $values = array_keys(Time::convertWordToTime());

The namespace exists and is in the correct place but once I use drush cr I got this error:

Error: Uncaught Error: Class 'Drupal\node_revision_delete\Utility\Time' not found in /Users/adriancid/Sites/drupal84-test/modules/drupal.org/node_revision_delete/node_revision_delete.drush.inc:34

It's weird because I call the same function in the line 179 for the drush nrd-st command and is working fine:

Time::convertWordToTime();

Trying to understand what happens I tried to use an Utility function from the Core in the drush definition command hook and works fine without problem, but with my function call it doesn't works.

Any idea about class not found problem?


texts:
I've searched around and can't see any issues or bugs so thought I would ask the question first regarding Paypal EC when a product discount is applied.

I have recently installed/setup Paypal EC version 7.x-2.3 on a production site and have come across an issue when purchasing a product that has a product discount applied.

The discounted value shows when logging into Paypal, after continuing back to the site and paying for the order, the original product value is taken with no sign of the discount on the order.

Has anyone else seen or experienced this?


texts:
I understand that there is already I want to get a Mobile version of my drupal site working about setting up a mobile website, but I'm still having such a hard time figuring out what to do. I'm a newbie in web development in general. I was hoping that I'd get some more handholding here.

Basically I have a Drupal site up and running, e.g. http://example.com/fullsite/, and I want to set up a mobile site on http://m.example.com/fullsite.

I'm a Lunarpages customer, which uses LPCP (instead of CPanel). I've created the m.example.com subdomain for the mobile site, but I haven't created any redirection. Some CPanels apparently let me setup the redirection through it, but not LPCP.

Following the instructions on some random blog I found, I set up new folders in my Drupal's "sites" folder. My "sites" folder currently looks like the following:

public_html

fullsite

sites

default (and all its contents)
all (and all its contents)
mydomain.com.fullsite

settings.php (copied from default)

m.mydomain.com.fullsite

settings.php // copied from default, but with the theme_default line modified

    $conf = array(
      'site_name' => 'My Drupal site',
      'theme_default' => 'zen',
      'anonymous' => 'Visitor',
    );

I've also:

installed Drupal's Mobile Tools,
set the mobile url to http://m.mydomain.com/fullsite
set the desktop url to http://mydomain.com/fullsite
enabled "automatic redirection of the mobile user" under "redirection options"
chosen a different node as frontpage for my mobile visitors under "additional settings"
Under "Theme Switching", chosen "Switch theme based on the URL"

But accessing my site from my mobile device, here's what I'm seeing:

Going to m.mydomain.com/mysite = "Not found. The reqeuested URL /mysite/ was not found in the server"
m.mydomain.com/mysite/node/somenode = "Not found. The reqeuested URL /mysite/ was not found in the server"
mydomain.com/mysite = "Cannot open the page because too many redirects occurred".

Am I even on the right track here? Do I have to do a new Drupal install on my m.mydomain.com/mysite for this? I was under the impression that I could just get m.mydomain.com/mysite to get its data from the main drupal site, and display the contents with a mobile theme. Is this true?

I'm pulling my hair out over this (Well, not literally. I'm actually bald)! Any pointers will be greatly appreciated.


texts: i am having taxanomy names TEAM and create two fields home team and away team and want to create a exposed filter dropdown which is a combination of both teams please help me out


texts: How to check where in a menu tree a node is & then display a portion of the tree?

texts:
How can I check where in a menu tree a node is, and in particular how can I determine what its ultimate parent is? And how can I display a portion of a menu tree? Here's an example menu tree to illustrate:

m1
-subm2
--subsubm3
-subm4
m5
-subm6

If I were on the pages linked to from items 1-4, I'd want to find out that the ultimate parent of these items is m1, and then display only the portion of the menu below m1, ie:

m1
-subm2
--subsubm3
-subm4


texts: How to force the display of an empty field in panels for an editable field?

texts:
I can't seem to force an empty field to display so that it can be edited with editable fields. I installed the Empty fields module which adds an option in the pane settings but still no luck.

Has anyone had success with this?

Edit: Form content with added submit buttons work, but Page Content is far more user friendly.


texts: function name to be called by another module via drupal_alter?

texts:
I need to alter data of a contrib module, which does a call drupal_alter('workbench_access_user', $access, $account);.

How must my function look like? My module's name is workbench_access_crud_by_state.

Is the following OK?  What about the parameters? I am confused about that data and context stuff.

function workbench_access_crud_by_state_workbench_access_user_alter($access, $account) {
  //do sth
  $bla = 'test';
  debug($bla);
}

It seems that my hook implementation is not being called at all and there are no error messages.


texts: Gallery that can be added to a node via node edit page?

texts:
I want to have a gallery that I can easily add/edit/delete photos of from a node creation page and if a user adds a gallery it adds it to the node.

So let's say I want to have a gallery on a page, I would add all the title, body, then I would add 3 photos. And that would create a node with a title, body, and a image gallery with 3 photos. Similar to what I can do in wordpress for each page.

Or something that would function similar to what I want.

Any ideas?


texts:
I have created two flags using the Flag module and they are placed on my custom content type, 'Challenge'. Both the flags can only be flagged but not unflagged. The first flag is "Accept". The second flag is "Complete". These two flags i have created normally through the UI. However to display them in panels, i have used the following code in a custom text area in panel as flags are not displayed automatically there.

<?php
   print flag_create_link('flag1', %node:nid);
?>

<?php
  print flag_create_link('flag2',%node:nid);
   ?>

This displays both the flag on my Panel Page. However, my use case is something different. At first only, the "Accept" flag should be visible. Then, when the user clicks on "Accept", then only the other flag, "Complete" should appear. Any hints on how to achieve this. I have also tried using Rules, giving the event: A node has been flagged and then the action for a new flag. It does not work. Then i tried using flag actions as well, i.e., on flagging of first flag, display another flag.It does not work. Any ideas, suggestions are appreciated.

Thanks

Edit

i thought of a way to do this using JavaScript and css. When the first flag is visible, the second wont show. The code i am using is :

if($("#accept-flag").is(":visible")){
    $("#complete-flag").css('display','none');

This i have placed inside js/script.js in my theme folder.

(function ($, Drupal, window, document, undefined) {

if($("#accept-flag").is(":visible")){
    $("#complete-flag").css('display','none');
}

})(jQuery, Drupal, this, this.document);

When i view the page source, the script is loading however both the flags are still showing.

Please advice

Thanks again


texts: How to embed private videos hosted on Amazon S3/Cloudfront using JW Player module?

texts:
Have anyone tried using the signed url option provided by the new version of Amazon cloudfront with the JW Player module?
I´m using Drupal 7.

I´ve read that the idea of the signed url option is to generate the signed url at page load time with a short expiry. This way each user who loads the page gets a unique short lived URL they can access, if they share it, it will eventually expire limiting your exposure to hot-linking.

How may I add a dynamic expiring link? I know that this has more to do with how Amazon works than how JW Player works, but maybe someone can help me out because have made it through, or maybe have found a good n00b tutorial (I haven´t found any that explains how to use their services and this video player at once that I could actually understand).

Thanks in advance for any insight!
Rosamunda


texts: Most effective way to create a landing page for content types?

texts:
I have a "facility" content type which I am creating programmatically, through a module called "facility". I would like to have a landing page, such that when you go to http://www.mysite.com/facilities, you are taken to a heavily styled/scripted page that displays facility information in a specific format. To do this, in my facility module, I implemented hook_menu to point to a callback that will return the necessary markup. Here's my code:

facility.module

<?php

function facility_menu() {
    $items['facilities'] = array(
        'title' => 'Facilities',
        'page callback' => 'facility_landing',
        'access callback' => TRUE,
        'type' => MENU_CALLBACK
    );

    return $items;
}

function facility_landing() {
    return file_get_contents(drupal_get_path('module', 'facility') . "/facility_landing.php");
}

Due to the length and complexity of the markup, I would like to have it in a separate file. The issue is that this markup is not being evaluated in the Drupal context, since it is being read in with PHP's file_get_contents function. For instance, if my markup contained...

<?php echo $user->uid; ?>

...nothing would be displayed. Is there a function within Drupal that will parse a PHP file in the bootstrapped environment, and return the generated string? If not, what is the best/easiest way to handle this situation?

EDIT: This just occurred to me - I've already created an API within Drupal that would allow me to access the facility info I need via AJAX. I could just output the page without the facility data, then include a JS file which would get that. I'm still not convinced that's the best way, though. Thoughts?


texts: Node is flagged, flag has node reference field, how to show list of referenced nodes to author

texts:
This is a little convoluted, so I'll try to be as clear as possible by using concrete examples.

It's basically a "relevant job suggestion" system. It works like this:

A "candidate" user creates a "CV" node.
An "employer" creates "job" nodes.
There is a flag set up that is attached to CVs.
This flag has a node reference field.
When an employer flags the CV, they choose a job node to reference (suggest)

I want to display a view of all job nodes suggested for that candidate - visible only to them (the author of the flagged node).

I hope that makes sense. I think the part I'm struggling with is getting the relationships & contextual filters right, so any pointers there would be appreciated.


texts: How can I hide menu items based on permissions?

texts:
In my main menu I have a "menu item 1" that links to mynode1.

I have successfully implemented hook_permission() and hook_node_access() so that users who do not have the "access menu item 1" permission  cannot access mynode1.

I assumed that the menu item link "menu item 1" would automatically be hidden by Drupal, but this is not the case. Therefore I now would like to hide that menu item to users who do not have "access menu item 1" permission.

Does anyone have a code sample that would hide a menu link based on permission? (I tried hook_menu_alter() with no luck.)


texts: Embed a view into a Webform for submission

texts:
I have the following set up on a D8 install using the Flag, Views and Webform modules:

A content type named Product with a Flag field that can be set to "Add product to quote" or "Remove product from quote".
A view named "My Quote" that displays all products Flagged with "Add product to quote".
A Webform named "Get Quote" set up to capture the client's name, email, address, etc.
I now need to add the the view for "My Quote" to the Webform in some way.

I see in D7 there was a module called Webform View that provided similar functionality to what I'm looking for. If I understand the Webform Computed Elements correctly there should be a way to do this using Twig or Tokens, but I have no idea how to get the View data using either method.

I would be very grateful if someone could point me in the right direction, or help me understand the Twig syntax for referencing a View so I can use it in my Weform.


texts: Get info from entity reference using PHP

texts:
I'm trying to use PHP to get user IDs from an Entity Reference of users in a content type.

I have got as far as doing (where I actually get the NID from elsewhere):

$node = node_load(123);

$info = field_get_items('node', $node, 'field_my_users');

But how do I get the IDs from $info?


texts: Can relationships be used to show Content and linked content in the same view

texts:
I'm trying to display content in a view and, beneath each entry, show a teaser of other content to which it is linked via Node Reference.

Here is roughly what I'm trying to show in my View:

Classroom A (title with link)
  L Teacher A (teaser)
  L Teacher B (teaser)

Classroom B (title with link)
  L Teacher B (teaser)
  L Teacher C (teaser)
  L Teacher D (teaser)

I've tried using Relationships and Contextual filters, but find them quite confusing and unintuitive.

The best I've managed is showing the same Classroom A link multiple times, one for each Teacher...


texts: Awarding points with Rules for uploading a user picture

texts: Does anyone know how to create a rule that awards points to a user for uploading an image?


texts: How to redirect to the previous page after submission of a form in a block

texts:
I have a view of nodes of type task.
I created a block with an inline task create form (using form block module)
The block is next to the view on the same page.

Question:
After creating a new task by using the block, it shows the task full node. Instead, I want it to be redirected to the initial page (the views page) where the task was created.

I understand that the block is not aware of the URL, neither is the task create form in it. That is why a return to previous page in for example business rules, does not work.

How can a redirect be accomplished in this case?

I created a module with this code, which does not work:

<?php

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_form_alter().
 */

function yc_noderedirect_form_alter(&$form, FormStateInterface $form_state, $form_id) {

if ($form_id == 'node_task_form' || $form_id == 'node_article_form') {

    $current_path = \Drupal::service('path.current')->getPath();
    $form_state->setRedirect($current_path);

  }
}


texts: Understanding Recruiter profile in detail

texts:
I am trying to learn installation profiles. So i took up recruiter installation profile and trying to exploit it to learn.

I found the code like in the .profile file

<?php
// $Id: standard.profile,v 1.2 2010/07/22 16:16:42 dries Exp $

/**
 * Implements hook_form_FORM_ID_alter().
 *
 * Allows the profile to alter the site configuration form.
 */
function recruiter_form_install_configure_form_alter(&$form, $form_state) {
  // Pre-populate the site name with the server name.
  $form['site_information']['site_name']['#default_value'] = t('eq-Recruiter');
}

/**
 * Implements of hook_install_tasks().
 */
function recruiter_install_tasks() {
  $tasks = array(
    'recruiter_import_vocabularies_batch' => array(
      'display_name' => st('Import terms'),
      'display' => TRUE,
      'type' => 'batch',
      'run' => INSTALL_TASK_RUN_IF_NOT_COMPLETED,
    ),
  );
  return $tasks;
}

/**
 * Defines batch op for importing
 */
function recruiter_import_vocabularies_batch() {
  $batch = array(
    'operations' => array(
      array('recruiter_import_vocabularies', array()),
    ),
    'finished' => 'recruiter_import_vocabularies_finished',
    'title' => t('Import terms'),
    'init_message' => t('Starting import.'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Example Batch has encountered an error.'),
  );
  return $batch;
}

/**
 * Import batch operation for vocs
 */
function recruiter_import_vocabularies(&$context) {
  if (!isset($context['sandbox']['progress'])) {
    $vocs = taxonomy_vocabulary_load_multiple(FALSE);
    $context['sandbox']['progress'] = 0;
    $context['sandbox']['current_node'] = 0;
    $context['sandbox']['max'] = count($vocs);
    $context['sandbox']['vocs'] = $vocs;
  }

Here i saw code like $vocs = taxonomy_vocabulary_load_multiple(FALSE);  He is just saying FALSE here. Does it now require any parameters? If no how is it fetching the values?


texts: db_query() to retrieve the image path using the fid

texts:
In Drupal 7, I'm trying to retrieve the image path for a given fid.

If I am running a query such as the following, that is fine and dandy and returns a bunch of numbers that relate to the images on each row.

$query = db_query("Select s.field_swatch_image_fid as fid from {field_data_field_swatch_image} s");

foreach ($query as $row) {
  $swatch_fid => $row->fid .'<br />';
}

However, the table contains no information as to how to retrieve the actual image. Does anyone know the secret to pull the actual image URL into the foreach loop, or is there some sort of render function that needs to be run on the fid values? I'm guessing it is easy, but I can't seem to find any documentation on this.

Also, if I wanted to apply a style to the images, would that be a necessary step if the style was already set on the field image itself, and if so, what would be that process?

EDIT:
here is the full query. I was doing it manually because I have to retrieve the value and send a json object back to jquery and then render it in jquery. But this is kindof the start to a different and larger question.

Declare database variables to be used in the database call
 - so far this was easier than looking at all the giant field names Drupal creates in the database
 - hoping to rewrite the query in the new improved drupal 7 style soon

*/

  $swatchcolor = "field_data_field_swatch_color";  // sc - swatch color data table
  $color = "field_swatch_color_value";
  $states = "field_data_field_state"; // s the table that holds the swatch's reference to the state
  $state = "field_state_value";
  $swatchref = "field_data_field_swatch_ref"; // sr - swatch reference target table
  $target = "field_swatch_ref_target_id";
  $imagetable = "field_data_field_swatch_image"; // swatch image ref
  $parent_ref = "field_product_ref_target_id";
  // If a swatch has not been selected, run this query and select all colors as options

  if($swc == '') {

    $query = db_query ("Select n.nid AS nid, n.title AS title, s.$state AS state
        FROM {node} n
        INNER JOIN {$swatchref} sr ON sr.$target = n.nid
        INNER JOIN {$states} s ON s.entity_id = sr.entity_id
        WHERE (s.$state IN $theregion)
        GROUP BY title");

  } else {

      $query = db_query ("Select n.nid AS nid, n.title AS title, sc.$color AS color, s.$state AS state
        FROM {node} n
        INNER JOIN {$swatchcolor} sc ON sc.entity_id = n.nid
        INNER JOIN {$swatchref} sr ON sr.$target = n.nid
        INNER JOIN {$states} s ON s.entity_id = sr.entity_id
        WHERE (sc.$color = '$swc') AND (s.$state IN $theregion)
        GROUP BY title");

  }

EDIT!!
Here is how the image path was integrated into the json output:

 $json = array();
        foreach ($query as $row) {

        // get the image fid

          $fid = $row->thefid;
          $file = file_load($fid);
          // $file = str_replace('public:\/\/', '', $file1);

        // create the output as an array
          $jsonelement=array(

             'title' => $row->title,
             'path' => $file->uri,
             'style_name' => 'swatch'

            );
              array_push($json,$jsonelement);
        }

            // encode to json
            $jsonstring = drupal_json_encode($json);

            //output the json string
            drupal_json_output($jsonstring);


texts: Content type with Multiple fields reference

texts:
I am building a website a website which holds date about players and teams. There are two content types Player and Team.
I want it to work like this, when we are adding a team we can add and reference multiple players into it. How can this be achieved?


texts: Migrate nodes with special characters in title

texts:
Given a source's title like

This "cool" & "neat" article's title has HTML entities

, is creating a title of

This &quot;cool&quot; &amp; &quot;neat&quot; article&#39;s title has
HTML entities

Must I create a process plugin to handle this?
My migration yml looks somewhat like this:

...
source:
...
    -
      name: title
      label: 'Title'
      selector: title
...
process:
  title: title
...


texts: Add empty links from a BreadcrumbBuilder

texts:
For several specific parts of a website, I'm using a custom BreadcrumbBuilder, like this:

...
class SpecificBreadcrumbBuilder implements BreadcrumbBuilderInterface
{
    /**
     * @inheritdoc
     */
    public function applies(RouteMatchInterface $route_match)
    {
        $node = $route_match->getParameter('node');
        return $node->getType() == 'specificpage';
    }

    /**
     * @inheritdoc
     */
    public function build(RouteMatchInterface $route_match)
    {
        $node = $route_match->getParameter('node');

        $breadcrumb = new Breadcrumb();
        $breadcrumb->addCacheContexts(["url"]);
        $breadcrumb->addCacheTags(["node:{$node->nid->value}"]);

        $breadcrumb->addLink(Link::createFromRoute('Home', '<front>'));

        if (!empty($node->field_specific->value == '...')) {
          $breadcrumb->addLink(Link::createFromRoute('Specific pages', '<front>'));
          $breadcrumb->addLink(Link::createFromRoute($node->getTitle(), '<front>'));
        }

        return $breadcrumb;
    }
}

I would like to not use URLs for the two last links. Something like <nolink> (from the "Special Menu Items" module), but made from code.
I cannot find a way to add a text-only element to my Breadcrumb (and from what I can see, this class only have an addLink() function).

Any thoughts?


texts: Hook to change display widget in facet api from template.php

texts:
In my site i have search api with one block facet option "Display widget" set to "Links with checkboxes"

but now i want to change the value to "Links"

because when the website is displayed on a mobile device i need to change to this option value.

Is there a way to change this option through any hook or another way to get this accomplished?

Maybe put a hook in template.php is my closes approach.

Thanks :)


texts:
I need to redirect an anonymous user when they hit the url 'node/add/project' to 'user/login' - otherwise, just leave them enter that url.

Not sure if I'm going about this the correct way (probably not as it doesn't appear to work!) - Can someone shed some light, or advice!

function local_menu() {
    $items['node/add/project'] = array(
        'page callback' => 'local_project_anonymous',
        'access callback' => TRUE,
        'type' => MENU_CALLBACK,
    );

    return $items;
}

function local_project_anonymous(){
    global $user;
    if($user->uid == 0){
        drupal_goto('user/login');
    }
}

Cheers


texts: User password Reset without sending an email

texts:
I know by default Drupal provides 'Forgot password' option which allows user to enter their username/Email. If that's valid, sends a password reset link to their Email.

But I would like to do the same process without involving an email, which allows users to logged in immediately in one or two steps (by validating some checks).

How can I achieve that in Drupal?


texts:
I am creating a module with 2 tabs, a short term calendar and a long term calendar.
I made the tabs, but I'm already stuck..

How can I implement calendar.module to show a calendar on each tab?

This is the code of my tab:

  $items['planning/longterm'] = array(
    'title' => 'Long Term',
    'access callback' => TRUE,
    'page callback' => 'planning_page_longterm',
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
  );

In my callback function I try to call the calendar.module via this piece of code:

  if (module_exists('calendar')) {
    print theme('calendar_date_default_argument_alter', array('#item' => array('year' => '2013')));
  }


texts: Is there any workaround for the "Global Text" area in "No results behavior" that doesn't process chained tokens?

texts:
I have a view with a contextual filter for the node ID. If the view returns no result, I would like to display a fixed picture (no problem) linking to a path containing the node ID from the filter in it.

Available global token replacements in Configure no results behavior: Global: Text area shows the following tokens (among others).

view
...
[view:url] - URL: The URL of the view.

In most other Drupal contexts I can use a chained token [view:url:args:first], and it will get me the node ID I want, but not in this particular context. When I use [view:url] I get the whole URL with my node ID dangling temptingly off the end of it, but [view:url:args:first] or [view:url:args] or [view:url:whatever] simply doesn't process and prints the unprocessed token verbatim.

Is there any reason for such non-standard token processing in this particular context? Am I missing something? Could any kind soul suggest a workaround?


texts: How can I insert into table a row which contains an auto incremented field?

texts:
I am using drupal 7.41, I have a database table and it contains an auto incremented column/field. I am trying to insert some data into that table by using db_insert but it keeps displaying syntax error. Am I missing something in this syntax?

db_insert('my_table')
-> fields(array(
    'id' => NULL, //my auto incremented field...
    'name' => $form_state['values']['name'],
    'link' => $form_state['values']['link],
    'group' => 2 /* I have already tried this field with and without integer data and string data. Eg '2' and 2*/
    )) -> execute();

My mysql table contains four columns: id (Auto incremented, int), name (varchar(50)), link(varchar(200)), group (int).

I have tried every syntatic way but no to avail. And lastly here is my error message when I execute the query above:

I think there is no access violation here, since I was able to insert some other rows into different tables. Only difference is that that table has no auto incremented integer field and other integer fields. Just two varchar fields.

Thank you.


texts: fields.title.content in views-view-fields--n--block.html.twig won't display

texts:
This is what I wrote into views-view-fields--n--block.html.twig.
The second and third fields are displayed properly (here I used the machine name). But how do I get the title which is automatically there with every content type?

 {{ fields.title.content}}

{{ fields.field_news_bild.content }}

{{ fields.body.content}}

please help!


texts:
I received the "The directory sites/default/files does not exist" error on a 7.43 install. In this situation, Drush is not available so I am doing a browser install.

I had this error once before in 2014 according to my notes. I don't know whether it's specific to the server I'm on or a general issue because I've done setups on other servers and don't remember seeing that particular error. In the previous situation, I noted that I changed the permissions on default to 777. I am always loathe to set much of anything to 777 so I am wondering whether it needs to be kept at 777 or is there some point after setting up the site that I can switch it to something more secure.


texts: Paragraph image URI with image styles in paragraphs-item.tpl

texts:
I have Paragraph bundle with Multi Value Image Field which is limit of 3 numbers. i tried to print these three images separately because i want to used different image styles for each images. I tried like this:

<img src="<?php print image_style_url('size_400x600', $node->field_image['und'][0]['uri']); ?>"/>
<img src="<?php print image_style_url('size_750x524', $node->field_image['und'][1]['uri']); ?>"/>
<img src="<?php print image_style_url('size_550x365', $node->field_image['und'][2]['uri']); ?>"/>

In the code it display the uri without the file name like this:

What will be the correct way to do this?


texts: How do I update core in commerce 2.x distribution?

texts:
I would like to update drupal core from 8.2.1 to 8.2.3 in a local environment. The normal procedure of deleting both the vendor and core folders along with the files in the site root won't apply. The commerce2.x disto installation puts the vendor folder outside of the site root and it contains more files than in a fresh drupal 8 downloaded vendor folder. I'm guessing there must be a slighty different process.

I run composer update drupal/commerce --with-dependencies.

The image attached shows the error.

If anyone can give me the steps I need to take, that would be great.


texts:
I've been thinking for a user-friendly navigation into my website.

I wanted to exposed the user form into a page where they can just easily update their information. I've installed the module profile 2 and added 3 types of profile (Personal Data, Withdrawal Form and Drawing Records), these 3 types of form I want to expose in one page.

Can it be just embedded into a views or do I need to use hook_form_alter? Please help... Thank you...


texts: creation token rest post via postman Access Denied

texts:
I added drupal module "Oauth2" in order to test access by tokens. I created a consumer and got his uuid and client_secret by which I tested, using postman post method, the genretation of my first token,but it failed by 403 access forbidden(see the capture bellow):

I tried to test a simple connexion (by admin account) to my user login using the post method, but it failed as well (see the capture bellow):

Seems like there is an issue with the post method

PS: I've already enabled POST for my endpoint at /admin/config/services/rest.

Thanks in advance!


texts: How do I pass the right UID in the same query, without it defaulting to Anonymous?

texts:
I have this fantastic view setup that lets me add endorsements to different items.

It works a little something like this, to get the UID of the endorser:

What I basically end up with is Advocate.Name = NULL and Advocate.Picture = NULL. I think internally Drupal is set up to pull these based on the UID (a guess based on below SQL), as it's not found it defaults to 0 - the anonymous user.

Here is the SQL code the view generates:

SELECT      users_field_data_field_endorser.name AS users_field_data_field_endorser_name,
            users_field_data_field_endorser.uid AS users_field_data_field_endorser_uid,
            users_field_data_field_endorser.picture AS users_field_data_field_endorser_picture,
            users_field_data_field_endorser.mail AS users_field_data_field_endorser_mail,
            node.nid AS nid, node.created AS node_created,
            'node' AS field_data_body_node_entity_type
FROM
            {node} node
LEFT JOIN   {field_data_field_tech_endorsement} field_data_field_tech_endorsement ON
                node.nid = field_data_field_tech_endorsement.field_tech_endorsement_target_id AND
                (field_data_field_tech_endorsement.entity_type = 'node' AND
                field_data_field_tech_endorsement.deleted = '0')
LEFT JOIN   {node} field_tech_endorsement_node ON
                field_data_field_tech_endorsement.entity_id = field_tech_endorsement_node.nid
LEFT JOIN   {field_data_field_endorser} field_tech_endorsement_node__field_data_field_endorser ON
                field_tech_endorsement_node.nid = field_tech_endorsement_node__field_data_field_endorser.entity_id AND (field_tech_endorsement_node__field_data_field_endorser.entity_type = 'node' AND field_tech_endorsement_node__field_data_field_endorser.deleted = '0')
LEFT JOIN   {users} users_field_data_field_endorser ON
                field_tech_endorsement_node__field_data_field_endorser.field_endorser_target_id = users_field_data_field_endorser.uid
WHERE       (
                (
                    (field_tech_endorsement_node.nid = '13' )
                )AND
                (
                    (
                        (node.status = '1')
                        AND
                        (node.type IN  ('endorsement'))
                    )
                )
            )
ORDER BY node_created DESC
LIMIT 1 OFFSET 0

I have heard this can be an issue but copious googling doesn't seem to bring anything back (I probably don't know enough to search with the right terms).

So how do I pass the right UID to the view (Advocate View) from the NID of the other views?


texts:
I created the following preprocess function to add a value.

function mytheme_preprocess_node__audio(&$variables) {
  $node = $variables['node'];
  $media_field = $node->get('field_image')->entity->uri->value;
  $variables['poster'] = file_create_url($media_field);
}

I want to output the content of $variables['poster'] in the file-audio.html.twig template.

<audio {{ attributes }} poster="{{ poster }}">
  {% for file in files %}
    <source {{ file.source_attributes }} />
  {% endfor %}
</audio>

{{ poster }} outputs an empty string. I have tried multiple methods, with no success.

I can get the variable in the field template (field--field-audio.html.twig), but it is not available to the child file template I am using.

How do I get the value of $variables['poster'] in the template file I am using?


texts:
Sorry for the off topic question, it may seem in wrong direction as it is not relevant to coding and other stuff.

The problem is that I am developing a module called Amazon send to kindle.
It is right now in sandbox module. I am getting problem, as i am not able to share on amazon kindle.

I need a guidance from some expert users, to help and guide me in the development. Drupal.org allows us to select the mentors, but i don't know how should i approch other user to be my mentor.

Is there any official way to ask users to be my mentor ?


texts: Easiest way to make body of text wrap around image

texts:
I would like to have a body text wrap around the the image below. Here is an example:

http://www.fareham.ac.uk/events/2011/06/creative-arts-summer-exhibition

And here's an excerpt of the code:

        Fri 24 Jun 2011

    Don't miss your chance to see the incredible artwork produced by this year's Creative Arts students at Fareham College.

    The exhibition will be held on the College campus, featuring work from our Art, Graphic Design, Photography, Fashion and Media students.

    This event runs on weekdays from 10am–4pm on 24th June–1th July 2011 in both the A-Block and the Function Room at Fareham College.

    We look forward to seeing you.

How can I get the  with the text in to wrap around the  with image in?

Thank you.


texts: How to switch language on login based on user profile?

texts: Is there a way when a user login to automatically switch him in then language setup in his user profile.


texts: Entity view displays are throwing dependency errors during installation

texts:
I have a custom entity in my module. During installation I am creating a bundle for this entity. Then in the config I have two entity view displays for this bundle. One of those displays is for the default view mode.

During installation I am getting dependency exception for these two displays. But if I import them manually via config import everything works just fine.

So I have moved these into the optional config for now. This causes another issue and that is the display for default mode for my entity bundle.

When a new bundle is created the display for default mode is automatically created. So since I now have the config as optional it will try to import it afterwards but the display for default mode already exists so it will do nothing. The only solution that comes to mind is putting the config for this display into code bude I'd rather not.

So the solution for the first issue causes the second issue. Therefore how can I fix that dependency issue?

I was thinking about removing the dependency on the bundle form the display config and putting dependency on the display into the bundle config but that would not work since display needs an existing bundle first.


texts: How to theme the header area using panels everywhere and twitter bootstrap theme?

texts: I am using panels everywhere and I am using the twitter bootstrap theme and  panels bootstrap layouts. At the moment I have the 'header elements' from 'page elements' menu pane which contains the site name, logo and slogan and can be themed with pane_header.tpl.php . However, I would also like to include the menu in this because I need to wrap all these elements in the bootstrap menu html in order to use the collapsing navbar functionality?


texts:
I've seen this on Blackboard and other sites before. How in drupal could have user interaction(UI) with content on each node?

The user should be able to:

-rearrange content on each node with out being a administrator or logged in.
-remove view of content from node and re-populate with more content. The content removed will not be deleted but removed from user view.

I know of panels and I have created panels, but I do not see any UI that allows me to do what I would like to above with panels.

Some help please! Image of what I am talking about. see how user can drag and drop content


texts:
We are working in Drupal 8 website and same user will have two different user profiles buyer and seller.

We want to show a user drop menu and when user click on "buy" link in drop down then main menu of the site would be changed as per "buyer" profile.

And if user click on "sell" link in drop down menu then main menu of the site would be changed as per "seller" profile.


texts: How can I move the location of the advanced search form?

texts:
This has been giving me troubles for some time now. I am in the process of changing my search results page on my drupal 7 site. I have modified both the search-result and search-results template files to change how my results are displayed on the page.

However I can't figure out how to move the placement of the advanced search form. It is driving me crazy. I have created my own "advanced search" button, and want to give it the dropdown functionality that the default "advanced search" link has.

I know that I can change the "node_form_search_form_alter" function from node.module to alter the guts of this form, but thats not what I want. I just want to place it on the screen somewhere else.

I can't for the life of me figure out how to do this. I have gone through every template file, and the advanced search form just seems to magically appear. Any help would be GREATLY appreciated.

In the image below, you can see the default advanced search link, but I want to move it to my button that I have added, on the right of the page.


texts: Programmatically create user and add complete address field values

texts:
I have an address field on my User entities.  I want to programmatically create users and set their address field values, I currently have this:

 $values = [
  'mail' => 'chris+7asd7fadf7afdafasdf@example.com',
  'name' => 'chris+7asd7fadf7afdafasdf@example',
  'first_name' => 'First',
  'last_name' => 'Last',
  'roles' => [],
  'pass' => user_password(),
  'status' => 1,
];
$user = User::create($values);
$user->field_contact_information->country = 'US';
$user->field_contact_information->given_name = $values['first_name'];
$user->field_contact_information->family_name = $values['last_name'];
$user->save();

But it's not saving the values to field_contact_information.  Elsewhere in the app, I do access these values with $user->field_contact_information->given_name.


texts:
I am following this tutorial: Altering existing routes and adding new routes based on dynamic ones for changing the route from '/example' to '/example/helloworld'.

I tried following code in my example module. With '/example' it is working fine, but with '/example/helloworld' which is the new altered route it is showing page not found. Am I missing something in the following code? Thanks

In file: example.routing.yml

example.content:
  path: '/example'
  defaults:
    _controller: '\Drupal\example\Controller\ExampleController::content'
    _title: 'Hello World'
  requirements:
    _permission: 'access content'

In file: example.services.yml

services:
  example.route_subscriber:
    class: Drupal\example\Routing\RouteSubscriber

In file: RouteSubscriber.php

class RouteSubscriber extends RouteSubscriberBase {

  public function alterRoutes(RouteCollection $collection){
    //Change path '/example' to '/example/helloworld'.
    if ($route = $collection->get('/example')){
      $route->setPath('/example/helloworld');
        }
  }
}

File structure in module,


texts: How can I maintain redirects from a non-existing path to an existing one?

texts:
With Drupal 7, the Global redirect module provided end users with a great interface to input redirects from a non-existing path to an existing one. I have installed and enabled the Redirect module for Drupal 8, but I do not see where end users can maintain a list of redirects. We are migrating an old site to Drupal 8 and we will need a method to redirect old URLs to new ones.

How can I maintain these redirects using the Redirect module?


texts: Change add node select field to show data from 2 different fields of other content type

texts:
I didn't know exactly how to ask this but the idea of what I need is very simple.

I have content type A with 2 fields: title and A2

Then I have another content type, B, with a node reference field (select box) that references title from node type A.

What I need is that the options in the select box are the concatenation of both title and A2 field.

Is this possible without coding my own module?


texts: Recommendations for security testing a Drupal site?

texts:
I'm about to relaunch my company's website using Drupal 7. I'm the sole web engineer in our IT department, so I have a lot on my plate as we approach the launch date. As this is my first major Drupal site, I want to be certain that it is as secure as possible. I have completed as many proactive security measures as possible, including following the secure configuration and the best security practices guides on drupal.org, I've subscribed to the security newsgroup, and hardened the LAMP server using industry best practices.

Now that I have completed due diligence with regards to proactive security, I want to run a security audit before we go live to be able to generate a report stating we are "as secure as possible" for management. I usually do all of the testing by hand, page-by-page, using the OWASP Web App testing cheatsheet; however, I'm new to Drupal, this site is hundreds of pages, and I have limited time.

What are your recommendations for security testing a Drupal site of this size? I have access to Rapid7's Nexpose Enterprise, so I will be using that for some automated testing. I do not want to use hosted scanning tools, but will consider security-audited tools that I can install myself to use. Do you have security checklists you go by, similar to OWASP, but specific to Drupal 7? Any other advice for things I might have missed are also appreciated!


texts: Showing Discount labels for products that are linked to any discount offer?

texts:
I created a view (table) of my products and I want to display the ID field of the related discount.

So I added a relationship with Trade Discount Offer referencing products from commerce_free_products and referencing Trade Discount Trade Discount Offer from commerce_discount_offer
Then added the field Trade Discount: Discount ID I have my column but in the 0 if I add (referencing Trade Discount Trade Discount Offer from commerce_discount_offer) Trade Discount: Title for administration (Title for administration) my column is empty.

What did I do wrong?
I found it this ticket but it does not help.


texts: List of D7 contrib modules that create and use custom tables with full Views 3 support

texts:
I'm trying to understand how to properly use Drupal 7 and Views 3 to retrieve data from a completely customized MySQL table.

There are several tutorials for Views 2 and Drupal 6 (Scratching The Itch: MyWeather being a great example) but very little for Drupal 7 and Views 3.

I would like to compile a list of Drupal 7 Contributed modules that:

Define there own, custom tables.
Store data in those tables (no nodes).
Query those table using the Views 3 API.

It would be very useful as a developer new to Drupal 7 and Views 3 to see live examples of modules that implement functions like hook_views_api and hook_views_data.


texts:
I am trying to set up a local copy of Solr on my development workstation using these (admittingly dated) instructions here [1] and while it sets up a fully functioning Solr 4.10.2 instance that can be connected to, but once I attempt to queue up content to index, it fails on Solr with the following error:

ERROR
SolrCore
org.apache.solr.common.SolrException: ERROR: [doc=sxodha/node/1] unknown field 'site'

The procedures I followed were to copy the module's existing ideal Solr configuration into what Solr provides in the example directory. Once done, I run the query import, and it appears as if Drupal is able to run it without issue. But the Solr logs paint a different scenario. Nothing is imported, as a glance of the collection shows no new entries.

If needed, I can post my config files for Solr, even though they're essentially the unmodified files from the apachesolr module, copied into /INSTALLDIR/example/solr/collection1/conf. I apologize if this seems vague, i'm still. trying to find my bearings here.


texts: How to test if user is denied access when her role has no "access content"

texts:
Wanting to test that only users with "access content" have access:

public function testOnlyAccessContentAccessible() {
  $web_user = $this->drupalCreateUser();
  $this->drupalLogin($web_user);
  $this->drupalGet("foo");
  $this->assertResponse(403);
}

The module under test, relevant hook_menu-entry:

$items['foo'] = array(
  'title' => 'Foo',
  'page callback' => 'foo',
  'access arguments' => array("access content"),
  'expanded' => TRUE,
);

What is wrong here? My drupalCreateUser has not recieved an array with permissions, so it did not receive the "access content" permission either; yet Drupal hands out this permission by default, so I guess this is a permission that is "default" when nothing is posted.

So, how to check that only users with permission "access content" can access a page?


texts: How do I embed a URL in a block which is displayed as the linked image on the site?


texts: Username is generated after update user informations

texts:
in a drupal 8 project I've a problem with users usernames, when updating a user from BO and save change the username changed to be email_registration_{a generated key} this happen even with admin user (user with ID 1) the username was changed from admin to email_registration_CFJffXsshq

Any idea why the username is changed after an user update?

Thanks

Update:

The field username does not appear in user edit form and the contrib module email_registration is enabled.

How can I force printing the field username (field with label Display name) in user edit page?

Fixed

This patch fix the issue.
See Strange username logic after rc6 release


texts:
I try to rewrite

return theme('table', array('header' => $header, 'rows' => $rows, array('variables' =>$my_vars));

into:

$build = array();

$build['table'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows);

 $build['variables'] = array(
'variables' =>$my_vars);

 return $build;

But it does't work:

$build['variables'] = array('variables' =>$my_vars);

How can I do this?


texts:
I would like to use a custom template for my taxonomy term pages.
I attempted doing so by creating a hook in template.php like so

function mythemename_preprocess_page(&$variables){
    if($hook == 'node'){
        if(arg(0) == 'taxonomy'){
            $vars['template_file'] == 'node-taxonomy';
        }
    }
}

And then creating a custom template called node-taxonomy.tpl.php

However the page does not change.

I understand that I can achieve something similar using views, but since other sites are using different themes on our drupal instance I'd prefer not to change anything that relies on those views.


texts: Is there any way to hide author information from custom article rather than content type?

texts:
I know that I can hide author information in below path in Drupal 8:

Home>Admin>Structure>Types>Article>Display settings

but I want to know is there any setting or selective options to hide author information per custom article or post, rather than all post of custom content type?


texts: View displays no results for roles without Bypass Content Access

texts:
For some reason one of my Views displays no results when I use my moderator role, but it does when I use the administrator role. The role permissions are exactly the same, except for the "Bypass Content Access" permission.

When I display content of type A everything is displayed like it should. But as soon as I add a "referenced entity" relationship from A to type B, nothing is displayed and the view uses the "No results behaviour".

When I create a view displaying only type B, both roles can see everything just fine.

I'm using Content Access and Organic Groups. I granted the roles the same permissions. I also set the View permissions to None.

Does anyone have a clue why this could be?


texts:
I created a simple content type and a form mode for this content type. Where can I view this form mode after creating it? I see no option for form modes when creating a content type.
I would have expected an option to be presented when clicking on "Add Content" to select "Add xy content with xy form mode"? Raised it as an issue here https://www.drupal.org/node/2530086


texts: migrating from multiple csv files in one migration class

texts:
I have multiple CSV files in different folders.
The folder names are the node ids. And each folder contains its own CSV file.
Now I want to loop these directories and import from the CSV files in one migration class but it only migrate from the last CSV  file.

Here is my code

class MigrateNodes extends Migration {
  public function __construct($arguments) {
    parent::__construct();
    $columns[0] = array('Number', 'Number');
    $columns[1] = array('Title', 'Title');
    $columns[2] = array('Description', 'Description');
    //The Description of the import. This desription is shown on the Migrate GUI
    $this->description = t('Import lots from excell file ');
    $nids = db_select('node', 'n')
        ->fields('n', array('nid'))
        ->condition('n.type', 'type')
        ->execute()
        ->fetchCol();
    foreach ($nids as $nid) {
   $path = $nid . "/nodes.csv";
      //The Source of the import
      $this->source = new MigrateSourceCSV($path', $columns, array('header_rows' => 1));
      if ($this->source) {
        $this->destination = new MigrateDestinationNode('lot');
        $this->map = new MigrateSQLMap(
            $this->machineName, array(
          "Number" => array(
            'type' => 'int',
            'unsigned' => TRUE,
            'not null' => TRUE,
            'alias' => 'import'
          )
            ), MigrateDestinationNode::getKeySchema()
        );
        //Field ampping
        $this->addFieldMapping('title', 'Title');
        $this->addFieldMapping('field_lot_description', 'Description');
      //}
      }
   }
  }
}

The Number field is unique.
Any one knows what I am doing wrong?


texts: How to change search index for a view in the Views

texts:
We made a lot views using Views module type of Search API index#1. Now, we realize that we need to go with another index#2. Is there any way to change indexes in existing Views? Can anyone point me in right direction?

Thank in advance!


texts: Webform calculator (I need to delay the result)

texts:
https://www.drupal.org/project/webform_calculator

Hello, is there a way to delay the calculation for performance purpose ?
The problem is that I have a TON of formulas being calculated every time I type inside the inputs, and this is making the whole thing very SLOW.

I need something like: "Wait 2 seconds after keyup and mouseup > show formula results"


texts: File/image upload via CCK and Nginx + FastCGI

texts:
I am using the ImageField module with Pressflow, Nginx, and FastCGI. When I go to add a file via the standard ImageField CCK upload widget on a node, the Upload "throbber" does its thing, Drupal does not report any problem. The upload completes fine, but no thumbnail is generated in imagefield_thumbnails, and no ImageCache presets are generated.

I can see the file in the right place on the server. It feels for all the world like a file permissions problem, but I'm getting no such warnings from Drupal or PHP and the file is chmod 664 and belongs to www-data (which is the user Nginx is running as). So I can see no reason why PHP would not be able to read the image.

Furthermore, all the ImageField and ImageCache target directories are chmod 777 and owned by www-data, so again, no reason why the application would not be able to write there. And anyway, no errors suggest that is the problem, in either /var/log/messages or in /var/log/nginx/error.log. It makes no sense!

Can anyone shed some light? Is there any simple step I need to follow (or a missing package I need) to make Drupal work, or am I doing something stupid?


texts: How to get the country from shipping address in a view?

texts:
I am using Drupal Commerce Kickstart!
I want to get 'Only' the country name from the shipping information of a particular order in a view,
The shipping information field in my view shows the entire shipping address including the country at last, is there a way that I can extract only the country name from that? or a db query using the order_id?


texts: How can I make the list of exposed filters hide options with no existing nodes?

texts: I'm using Drupal commerce, and I have a "Product Type" select field in the "Accessories" content type. There are 20+ options. In the views page I'm exposing that field, but I want only the options to display that have 1 or more nodes with that option selected. Is that possible?


texts: Views don't seem to be working properly on localhost with Chrome

texts:
This seems to be something connected to being on localhost rather than a server as once the site is uploaded it works fine - it's almost as if Chrome is too fast for my drupal site. Parts of the views don't register properly (fields will be missing) but some of them do.

The site works fine locally on FireFox, IE and Safari - it's just Chrome. Any ideas?


texts: getting error when clear cache in drupal

texts:
Following Error occure when i clear cache from admin in drupal:

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
  Duplicate entry 'seven-views-retailers_view-block' for key 'tmd':
  INSERT INTO {block} (module, delta, theme, status, weight, region,
  pages, cache) VALUES (:db_insert_placeholder_0,
  :db_insert_placeholder_1, :db_insert_placeholder_2,
  :db_insert_placeholder_3, :db_insert_placeholder_4,
  :db_insert_placeholder_5, :db_insert_placeholder_6,
  :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => views
  [:db_insert_placeholder_1] => retailers_view-block
  [:db_insert_placeholder_2] => seven [:db_insert_placeholder_3] => 0
  [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => -1
  [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => -1 ) in
  drupal_write_record() (line 7106 of
  /home/nxsol/webdata/latestspecialsonline.co.za/includes/common.inc).


texts:
I'm trying to create a form element with an array of child inputs. How is the below example incorrect in D7, I'm getting this error:

Fatal error: Cannot create references to/from string offsets nor overloaded objects in C:\wamp\www\water-uk\www\includes\common.inc on line 6518

array(3) {
  '#tree' =>
  bool(true)
  '#type' =>
  string(8) "fieldset"
  'first' =>
  array(6) {
    '#type' =>
    string(6) "select"
    '#options' =>
    array(8) {
      'All' =>
      string(8) "Show all"
      [0] =>
      class stdClass#470 (1) {
        ...
      }
      [1] =>
      class stdClass#468 (1) {
        ...
      }
      [2] =>
      class stdClass#469 (1) {
        ...
      }
    }
    '#size' =>
    NULL
    '#default_value' =>
    string(3) "All"
    '#ajax' =>
    array(5) {
      'callback' =>
      string(38) "_listing_blocks_select_tax_depth_js"
      'wrapper' =>
      string(18) "tax-select-wrapper"
      'method' =>
      string(6) "append"
      'effect' =>
      string(4) "fade"
      'event' =>
      string(6) "change"
    }
    '#required' =>
    bool(false)
  }
}


texts: How can you force a stylesheet reload in Drupal7?

texts:
This is about that old trick of tacking a fake query argument onto the URL of a stylesheet (e.g., <link rel="stylesheet" type="text/css" href="http://www.example.com/site.css?v=123">) so that, when you change the stylesheet, it'll be reloaded by the users' browsers, since it looks like a URL that's not in the browser's cache.

So, the question: How can you do this in D7 where the stylesheets are specified in the .info files?  I tried adding a query arg onto the entry in my site's info file -- stylesheets[all][] = site.css?v=123 but without any luck (the page rendering got very unhappy).  Any ideas?


texts:
I'm using domain access sharing the same database for 6 different sub domain websites

My concern my database limit is 1000MB

Is there a way to create new database set to a limit for example every 700MB

What the best way to deal with large database size?


texts: Using variable_get() in multiple places, without duplicating $default

texts:
When using variable_get() in multiple places, how should one avoid duplicating the $default values?

define()?  Or is there some built-in Drupal-specific mechanism I'm missing?


texts: Mask User url with dynamic temprorary user

texts:
Is there a module to mask user url with a temporary url which only last for a day and next time it generates another url for the same user?

I want to hide the users UID/username so that no two users can talk to each other but can view their profiles with a temporary url.

I checked with pathauto module but it generates a dynamic permanent url not a temporary ones.

Edit:-
I used uuid_link module for this and ran cron to generate uuid for users.


texts: Views Data Export Module not including the custom added rows in a view

texts:
I have created a view for commerce orders where format is tabular and they are grouped by email of order owner. So basically each group of record shows how many orders are placed by a given email id.I need to have a extra row in each grouped results which is basically summary of order(showing cumulative order total) so I used views_summarize module and got it done. Now I need to have export views as csv or xls functionality so I put views_data_export module but it seems the row added by views_summarize is not included by csv or xls generated by views_data_export.

I also tried including the row using hook_views_pre_render(), and I am seeing the row is getting added in the views page under preview but when I export the views in csv again the row does not appear.

Here is code

function mymodulename_views_pre_render(&$view) // don't forget to replace my_module with your modules name
{
  if($view->name == "paid_partner") {
    if($view->current_display = "paid_partner_csv" || $view->current_display = "paid_partner_xls") {
      foreach($view->result as $submission) {
        $order_total_summary += $submission->field_data_commerce_order_total_commerce_order_total_amount;
        $quantity_total_summary += $submission->commerce_line_item_field_data_commerce_line_items_quantity;
        $currency = $submission->commerce_order_total_amount_currency_code;
      }
    $price_display = commerce_currency_format($order_total_summary, $currency);
    // insert a 'total' row
    $row = new stdClass();
    $row->order_id = "Order Summary";
    $row->users_commerce_order_mail = "Order Total Summary";
    $row->commerce_line_item_field_data_commerce_line_items_quantity = $quantity_total_summary;
    $row->field_commerce_order_total[0]['rendered'] = array(
      '#markup' => $price_display,
      '#access' => TRUE,
    );
    $view->result[] = $row;
    }
  }
}

What can I do to include the summary row with each grouped record in exported csv or xls.


texts:
I have an issue related to drupal image styles, and I am not able to fix it since last two days. Have searched and tried everything on google, but of not help.

I have a drupal instance on production where all the images are stored at imgs/<entity_type>/<entity_id>/<filename>.  All these files have three different styles: thumbnail, entity_image, and slide. All the styles were working initially. Now suddenly most of the times styles do not work. If I change the image, most of the time styles show old images, even if at the URL location no image is present. Sometimes, thumbnails are not getting created.

To resolve this, the following are the things I already tried:

drush image-flush: Did not help
Changed permissions of styles to 777:  Did not help
Cleared all caches several times: Did not help
Disabled and re-enabled clean URLs: Did not help
Created another instance and tested: Issue persists
Tried to create style forcefully using image_style_url: Did not help
Changed +FollowSymLinks to +SymLinksIfOwnerMatch in .htaccess: Did not help.
Commented Options None and Options +FollowSymLinks in .htaccess: Did not help

Initially it looked like a permission issue but after all this, I am not getting what could be wrong. It could be some issue with inode creation, but not sure. So, please let me know your suggestions, what should be done in this case.

EDIT: I disabled clean URLs and everything worked fine. Enabling clean URLs again gives the same issue. SO it has to do something with the menu I guess, but not sure about the fix. Need a permanent solution as I can not afford to keep clean URLs disabled.


texts:
The user account page (http://example.com/user) consists of some default tabs like  "View," "Edit," etc.

I want to add my menu link over there. The content to be returned should depend on the user ID. How do I do this?


texts: How can we uninstall a module directly from the database?

texts:
I am trying to find a way to uninstall a Drupal 8 module directly from database.

How can I achieve this?


texts: Jobs falling behind in Ultimate Cron, but none take very long to run

texts:
I have a total of 15 cron jobs set up in Ultimate Cron. 14 of them are set to run every 15 minutes, and 15th runs once a week. The longest of the 14 takes 22 seconds to complete.

They are only running twice a day, not every 15 minutes, and the Cron area always (correctly) reports them as behind schedule.

I tried changing them to run at set minutes per hour and increasing the number of threads to use for cron, but this didn't fix anything. Due to the cron tasks taking less than a minute to complete, I don't suspect this is because of the tasks interfering with each other.

I am pretty sure that this is because in the "Run cron" tab, under Cron Settings, "Run cron every" is set to 12 hours. I'd like to change this interval, but the most frequent option is 1 hour.

What am I missing here? I don't understand what the point is of having the option to run something every 15 minutes if the most often it can actually run is every hour. I don't think this setup is correct, and am not sure how to change it so that my cron jobs actually do run every 15 minutes.


texts: Posting to managed page using Drupal for Facebook not working

texts:
I am able to post to my feed but not to a page that I manage. I can select it from the drop down menu when creating a new node but I get the following error message:

  Failed to query https://graph.facebook.com/131180330289436/feed. Forbidden: (#200) The user hasn't authorized the application to perform this action OAuthException 200 (http 403)
  Failed to query https://graph.facebook.com/131180330289436/feed.

Array (
  [method] => POST
  [data] => access_token=mytoken&message=&link=http%3A//mysite.com/node/577&name=Honey&description=Honey&actions=%7B%22name%22%3A%22View%20More%22%2C%22link%22%3A%22http%3A%5C/%5C/mysite.com%5C/node%5C/577%22%7D
)

  Forbidden: (#200) The user hasn't authorized the application to perform this action OAuthException 200 (http 403)
  Could not post Honey to facebook. You might avoid this error in the future by granting additional permissions.
  Post Honey to facebook failed with this error: Forbidden: (#200) The user hasn't authorized the application to perform this action OAuthException 200 (http 403)

As in the documentation, I've tried applying for the 'manage_pages' permission but they have stated that it is only necessary for public apps.


texts: The function file_entity_download_uri() seems to no longer exist in Drupal 8.4, and I need to build a download URL for a file. I would not like to directly expose the file location.


texts: Notice: unserialize() [function.unserialize]: Error at offset 0 of 13 bytes i UserController->attachLoad()?

texts:
I've created my first module, which gives me this error and I dont know where to look for the error.

The module is a list of nodes sorted by terms. Each node has a checkbox connected to a form (using Form API), which lets the user sent multiple emails at once to the author of that node. The data is then inserted into the database for further use. The funcion seems to work and the node authors gets its own rows in the table, but why this error?

It is shown when the form has been submitted, btw.

Drupal 7

Notice: unserialize() [function.unserialize]: Error at offset 0 of 13 bytes i UserController->attachLoad() (row 303 of /drupal/modules/user/user.module).


texts: Drupal 6: using template based on browser version

texts:
Is it possible to serve up a specific page template based on browser version? If I can satisfy my IE 7 requirements with a special template, I'd prefer that rather than loading a bunch of extra css only used when IE7 is being used.

I have a special drop-down menu and though on its own will work in IE7, once it's a block and assigned to a region, issues start with height. I can put it in another region within a page template but then I'm changing all the css for all other browsers so I'd just as soon as have a template for the specific pages.

thanks