texts: Add autoupload property after page load using plupload

texts:
In a form I have added a field for images, set the file source to "Advanced upload widget (Plupload)" ( all other checkboxes are unchecked ) and I get the interface. I want to make it autoupload images after being drag and droped or selected via the add image link. The form is loaded in a custom created page using a personal made module. I tried to set

$form['field_image_article1']['#autoupload']=TRUE

in myModule_form_alter and also called a myModule_after_build. None of the situations work and I can't figure out where or better sayd when should I set this value. Here is the code for the module :

function add_new_article_menu() {
  $items['addAnnouncement'] = array(
  'title' => 'Adauga anunt',
  'page callback' => 'add_new_article_simple_page',
  'access callback' => TRUE,
  );
return $items;
}

function add_new_article_simple_page() {
form_load_include($form_state, '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;
}
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';
    return $form;
  }
}
function add_new_article_after_build($form, &$form_state) {
  $form['field_image_article1']['#autoupload']=TRUE;
  return $form;
}

Modules installed for plupload : FileField Sources Plupload,  File Field Sources , Plupload integration module

Any help is most appreciated.


texts:
I am creating a View in Drupal 7 for a particular content type.
I want to add filter to show nodes which are updated. When I am adding Node Update Date field, it is asking for operator and Value to compare with. But I can not provide Updated date of each node.

Then I also tried hook_views_query_alter to alter the query. When I am adding Query Value to node.created field it take it as a string or you can say Value.

Can someone help me to achieve this?


texts:
I use the main menu as navigation bar, and I would like to obtain the following result: When the mouse is hovered on one navigation item, the sub menu should be shown as <div> under this item. I would like to be able to style the sub menu <div>s as well.

Shall I actually use the navigation menu or just the main menu?

I am using Drupal 7.


texts: What If I Need Conditional/Overriding (synchronized) .yml Config Install With a Custom Module?

texts:
With D8, the appropriate method for adding fields during install with a custom module is with the config system and .yml files in a config/install directory.

I have a module for user theming I like to use for new D8 site installs, it adds hooks, templates, fields.

With a minimal install, this module provides the field and storage config for the user.user.user_picture field, as well as the entity_form_display and entity_view_display for compact and token view modes for the user.

I also include some custom fields such as first_name and last_name.

Obviously, with a standard install, this module will get the errors that the user.user.user_picture config already exists among others.

I would really prefer that the config overwrites the display config for the view modes, but would take them just being ignored on install if it already exists.

Is there a method following the Drupal config system to get conditional, or overriding, (synchronized) config during install? Or do I need to use the features module?

Is there a definitive approach for this?


texts: Convert an exported rule to a programmatic rule

texts: I created a Rule through the GUI and it works fine.  I would like to convert this into a programmatic rule that I can include with my custom module.  This way I dont have to re import my rule every time I set up a site.  Is there any way to do this (other than manually)?


texts: Views aren't respecting the ?destination=xxx in the URL

texts:
Using Drupal 7/Views 3, I created an admin page for a custom content type. When I click on a node edit link on a row, I'm directed to node/33/edit?destination=admin-mycontent ,where I can edit the node.

If I perform an operation like adding a field, the "destination=" in the URL is ignored, and when I save my changes, I'm directed to the node view, instead of back to my admin page.

If I cancel instead of save, I'm directed back to my view.

How can I have the expected redirect when I save the node?


texts:
How do you get the currently chosen image style name from the field format display option?

I can load an image with a given style with the code below, however, the style name (e.g. thumbnail) is hard-coded.

$imageStyle = \Drupal::entityTypeManager()
  ->getStorage('image_style')
  ->load('thumbnail');

I am hoping to get the selected style name dynamically.

MYMODULE.module:

HOOK_preprocess_menu() {

  $imagePath = getUser()['currentUser']->$imageFieldName
    ->entity->uri->value;

  $imageStyleFormatterValue = ???;

  $imageStyle = \Drupal::entityTypeManager()
    ->getStorage('image_style')
    ->load($imageStyleFormatterValue);

  $imageStyleURL = $imageStyle
    ->buildUrl($imagePath);

  $markup = new TranslatableMarkup(
    '', [
      '@imageStyleURL' => $imageStyleURL,
    ]
  );

}

For my case, $imageStyleURL will be printed as background-image: url();, so I need to build the path in preprocess.

I've tried going through FieldConfig, ->entity, and FieldStorage, but cannot find the image style value stored anywhere.


texts: How do I execute code when a module is installed or uninstalled?

texts:
Currently, I manually have to add terms one by one every time a module gets installed, and that's not efficient. I'm writing a simple module that needs to automatically install 2 terms every time the module gets installed, and remove them every time the module gets uninstalled.

From Create taxonomy term programmatically on Drupal 8, I learned how to add terms. However, I simply don't know where to put the code. What must I do to achieve it?


texts: Change field settings for text field from plain to formatted while data exists

texts:
anyone know of a quick example of how to change the field settings for a text area (plain) to formatted and set the input formatter (or maybe it will use default)? Will this require a resave of all the data or can it just be changed for the entity type? I currently have a lot of existing data on this site.

The field is currently stored as the type string, Text (plain). I need to change it to text_long, Text (formatted, long).

Thanks


texts: Clear example of Service module authentication and authorization

texts:
I've been playing around with Service module, which it seem the best module for exposing web service specificaly I have REST architecture. Nevertheless haven't been able to clear how does the authentication and authorization works here.

I know than I can expose a specific method like this:

/**
 * Implementation of hook_service()
 */
function custom_service_services_resources() {
...

 return array(
    'volunteer'=>array(
    'actions'=>  'disable'=>array(
        'callback'=> '_custom_service_disable',
        'file' => array('type' => 'inc', 'module' => 'custom_service', 'name' => 'inc/custom_service'),
        'args'=> array(
            array(
                'name' => 'id_entity',
                'type' => 'string',
                'description' => 'The ID of the record',
                'source' => 'data',
                'optional' => FALSE,
              )
        ),
      'help' => t('Service custom for example.'),
    ) ),

 );
    }

And it work quite nicely but only with the admin user, I understand there are some extra access parameters like:

'access callback' => '_custom_service_access',
'access arguments' => array('disable'),
'access arguments append' => TRUE,

But they are not well documented, does anybody has an insight on how to use them in service module, thanks.

Aditional Information

Drupal Version: 7

Service Module

Edit

Apreciate the answer but the hook about the auth can be found in

http://www.ibm.com/developerworks/opensource/library/os-drupal-web-service-project/index.html

The problem with this example are:

The service access function (_note_service_access) will always return TRUE. That means that all calls are authenticated.
Why do they do

$access = user_access('note service delete any note');
$access = $access || $note->uid == $user->uid &&

If they are not going to use it.

One last fact If I don't use the admin user with the services I can't get authorization.


texts:
I'm migrating my Drupal website to a new host.

Here's what I've done:

1 - Create an DB.mysql.gz using backup and migrate module (in old host)

2 - Create a new database and user in new host and restore this DB.mysql (step 1) directly using mysql -u USER -pPASS MYBD < /home/DIR/DB.mysql

3 - Install in new host the drupal using QuickInstall (installed v7.32)

4 - Transfer all data by directory www (old host) to a new host (hostgator - public_html) overhidding all files of Drupal 7.32 (installed by QuickInstall) to my current install v7.34.

5 - Change settings.php database content

I need check if all site is running OK before change DNS, for it, i need login using www.URL_TEMP/~MYUSERHOST/user/login, but this URL return 404 - Page not found.

Home page is load disfigured and browser log say 404 not found in css/js files, eg: www.URL_TEMP/~MYUSERHOST/sites/default/files/css/css_xE-rWrJf-fncB6ztZfd2huxqgxu4WO-qwma6Xer30m4.css and others. This file exists in public_html/sites/default/files...

I try change hosts file in my local machine (http://support.hostgator.com/articles/general-help/technical/how-do-i-change-my-hosts-file) but not solved.

This problem does not allow that I access with admin and change file temporary path in /admin/config/media/file-system, clean cache and test website.

Am I missing something, or do something wrong?

Ps: In old host the website is running OK!


texts: Populate questions and answers (Display two types of content two different ways on one page intermittently)

texts:
I am using the Answers module and would like the landing page to display all questions as well as all answers, as they are posted, and each would render different fields e.g. I want the questions and answers to look differently but still show up in the same feed. Currently, it uses a view to list all the questions only. Is this possible?

For an example of what I mean, this is a screenshot Quora.

I read this answer but do not want to use panels, but am also not sure if this solution will render questions and answers differently from each other in the
 list.

Please notice that the answer shown in this example isn't related to the question; it's just a random answer to a question. That's what I'm looking for.


texts: Deleting all terms from a vocabulary after timeout

texts: When I tried to delete a vocabulary, Drupal timed out and I don't think any or all of the terms in the vocabulary were deleted. How can I delete them manually in the database?


texts: Possible to use PDO inside a custom module in Drupal 6?

texts:
I'm about to build some new functionality on an old Drupal 6 site which will be upgraded to D7 or D8 within a year or so. This new module is heavy on the SQL and I'm building many complex SQL queries. I'd love to use PDO with named parameters to make the code readable.

Is it possible for me to initialize my own PDO connection to MySQL inside the module or will this break the rest of the Drupal environment somehow?


texts: Using Views to add comments to user profiles

texts:
My goal is to create an additional "ratings/comments" tab to user profiles in drupal 7 to allow authenticated users to leave comments/ratings for other users.  I've created a "ratings" content type (which naturally has comments enabled) and created a view around this type and added it as a user menu tab.

The problem is, since it is one content type, all the comments that have been left by any authenticated user show up on every single user's "ratings/comments" tab.  Of course I only want the comments that were meant for that particular user to show up.

Is this possible using filters?  I've been playing around with it but haven't been able to find the right setting just yet.  I know there is a guestbook module but I don't really want to go this route.

Thanks.


texts: Can Drupal 8-compatible Drush be installed in Windows?

texts:
Has anyone had any luck upgrading from Drush 6 to 7 on a windows machine?  I feel like I'm beating my head against a wall trying to get this done.  I want/need to use Omega 4 and I need Drush 7 to do so.  Also, if I ever want to update my websites to Drupal 8, I will need Drush 7.  Any direction/advice would be great!

Edit by @othermachines: Drush 8 is now recommended for Drupal 8 development.


texts:
I want to display updated content's field with views block on the front page.

2019/06/20 newly posted content1-title
2019/06/19 updated content2-title

The words updated and newly posted before the title want to customize according to whether the content was first posted or updated.
My code is as follows.

However, even at the time of initial content posting, durpal has different created and changed timestamps, which is not the expected result.
Is there are good ways? Thanks.


texts: Unable to get variable facebook_publication_id, it is not defined

texts:
I am using Facebook Autopost module for drupal 7.

Following the instructions in from here, I went up with rules scheduler to delay posting of nodes to facebook by few minutes but it is not posting to facebook and showing

My current rule definition is:

{ "rules_facebook_post_delay_post" : {
"LABEL" : "Facebook Post delay post",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_switch_user", "rules_scheduler" ],
"ON" : { "node_update--article" : { "bundle" : "article" } },
"IF" : [
  { "NOT data_is" : {
      "data" : [ "node:field-category:0" ],
      "op" : "IN",
      "value" : { "value" : {
          "17" : "17",
          "19" : "19",
          "26" : "26",
          "27" : "27",
          "20" : "20",
          "15" : "15",
          "18" : "18",
          "24" : "24",
          "23" : "23",
          "22" : "22",
          "16" : "16",
          "21" : "21",
          "14" : "14",
          "25" : "25"
        }
      }
    }
  },
  { "NOT data_is_empty" : { "data" : [ "node:field-media-new" ] } },
  { "node_is_published" : { "node" : [ "node" ] } }
],
"DO" : [
  { "rules_switch_user_action_switch_to" : { "account" : [ "node:author" ] } },
  { "schedule" : {
      "component" : "rules_post_to_facebook_rule",
      "date" : { "select" : "node:changed", "date_offset" : { "value" : 1 } },
      "param_fb_article_post_rule" : [ "node" ]
    }
  },
  { "rules_switch_user_action_switch_back" : [] }
]

}
}

And current rule component definition is:

{ "rules_post_to_facebook_rule" : {
"LABEL" : "Post to Facebook Rule",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules_switch_user", "rules", "fb_autopost_entity" ],
"USES VARIABLES" : { "fb_article_post_rule" : { "label" : "Post to Facebook Article compoent", "type" : "node" } },
"DO" : [
  { "rules_switch_user_action_switch_to" : { "account" : [ "fb-article-post-rule:author" ] } },
  { "entity_create" : {
      "USING" : {
        "type" : "facebook_publication",
        "param_type" : "link",
        "param_user" : [ "fb-article-post-rule:author" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-link" ],
      "value" : "[node:url_www]"
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-picture" ],
      "value" : "[node:mdm_facebook_picture]"
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-description" ],
      "value" : "[node:mdm_facebook_description]"
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-message" ],
      "value" : "[node:mdm_facebook_message]"
    }
  },
  { "variable_add" : {
      "USING" : { "type" : "integer", "value" : "105777439461526" },
      "PROVIDE" : { "variable_added" : { "fb_pub_id" : "FB Publication ID" } }
    }
  },
  { "publish_to_facebook" : {
      "USING" : { "publication" : [ "entity-created" ], "pages" : "105777439461526" },
      "PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:facebook-id" ],
      "value" : [ "facebook-publication-id" ]
    }
  },
  { "entity_save" : { "data" : [ "entity-created" ] } },
  { "entity_fetch" : {
      "USING" : { "type" : "node", "id" : [ "fb-article-post-rule:nid" ] },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "rules_switch_user_action_switch_back" : [] }
],
"PROVIDES VARIABLES" : [ "fb_article_post_rule" ]

}
}

I have also used rules switch user to switch users based on posted author so that this anonymous issue during cron run can go but not working for me as facebook publication id and facebook authentication is not working for me.


texts:
I have installed and configured https://www.drupal.org/project/smtp module
sending test email works fine, but when sending email with code nothing is sent and also no log in drupal (I have enabled debugging)

    $ownerEmail = 'email@someemail.com';
    $subject = 'update';
    $msg = 'You case has been updates';
    mail($ownerEmail,$subject,$msg);


texts: I want to alter the path of login page, /user/login, to /ulogin.  How can I accomplish this?


texts: Why don't CAS users show up in users_field_data?

texts:
I have a simple multisite setup in Drupal 8. I installed the CAS module and verified that at least one user logged in successfully using our university's CAS server.

I can see the user at /admin/people, but I cannot see his entry in the database. I looked in the tables users, users_data, and users_field_data, and all I can see is the admin user (me).

Where are the users located in the database?

I need to know for a custom module I am developing. FWIW I do have "Auto Register Users" enabled in the module configuration.


texts:
How can I have a multistep user profile form in Drupal 8?

Using Profile module I can have the tabs for the different sections of the profile, but what I need to have is a single form with steps for each profile section.

The modules for this are yet to be ported and the field group module no longer supports multistep forms.

Is there a solution for this without creating a full custom form with handlers? Maybe a form alter or something.


texts: How to display node teaser in Display Suite custom field?

texts:
I am trying to create custom Display Suite code field.

I would like to show truncated text of node body or teaser if exists (+ other stuff, like: (...) and link to current node)

I tried to use [node:teaser] but nothing was showed.
I tried to use [node:body:?] token too, but all options I have tried failed for me.

Field code:

[node:teaser] (...) <?php print t('read more'); ?>

Any suggestions?

It so basic thing but I have no idea what I am doing wrong here...


texts: How to apply dynamic block layout depending upon number of nodes in it (Drupal 8)?

texts:
I have very challenging task. Can any expert guide me?

(NOTE: This is for Drupal 8)

There is a requirement to show nodes in a block in a way that block must adopt style automatically depending upon the number of nodes in it.

For Example:
If there is only node published under news content type then block must adopt single news article layout in teaser mode, And
If there are published 2 nodes under news content type then block must now adopt the layout of 2 nodes and so on.

and this continues to 10 nodes

I know we can create views but how to apply conditions to check how many nodes are there under any content type and apply block layout accordingly?

Can anybody help?

Thanks
Mithow


texts: Roster Views with User data plus office content type

texts:
I'm creating a site that is an intranet portal for a company. All the users will be employees that work in different offices. I am adding several fields to the users to be used within the roster display. ie Cell phone, personal email, etc.

I will also have a content type of Office that will have fields relating to the individual locations. ie Address, phone, wifi code, etc.

I need to be able to display the full roster for any given office location. Views seem to be the way to go but getting the relationship between users and the offices is my problem. I know this is a pretty basic application but not something that I haven't done before.

What are possible ways to tie the office content type with the system users so that I can create a view that would have access to all of the fields from both content types?


texts: Make custom form submit data to view filters

texts:
I have a custom-generated form on a page and it needs to submit data to a view on a different page. I'm currently trying to get this to work by passing the form #validate through a submit hook and then using $form_state['redirect'] = 'customsearch/'; to catch the results. The view has several exposed filters and will ideally set themselves to the data received from the initial custom form page.

It doesn't look as though data is actually making it to the /customsearch/ landing page however. I have enabled the Views Expost module and am watching for POST variables from a PHP field in the landing page view.

The current code including form, validation and redirection can be found over here.

What is the proper 'Drupal' way of passing data from a form to a view with exposed filters? Should I be watching for GET or POST variables or will Drupal pass data with a different set of functions than the ones currently used?


texts:
I am trying to figure out what the main difference is between mymodule.module and mymodule.admin.inc.

Can anybody explain it?


texts: How to set the visibility rule for pane to not show up when any user is logged in?

texts:
I have created three panes (as shown below) using Mini Panel module. as named below,

Login/Register  |   Username  |  Logout

This I want to keep at the top left of website. Now, how each pane is created

Login/Register: Created menu and added link named Login/Register and have given the path /user. So, it leads to login page.
Username: This I created using the Views, a block created of users and filter was given that the user is logged in. hence it will automatically show up only when the user is logged in.
Logout: This I created using menu, with name Logout and path user/logout, hence when it gets clicked the user gets logout and this pane disappears automatically.
When users are logged-in, only the Username and Logout pane should appear; hence, users can see their profile by clicking on their name, or they can log out. When users log out, this pane disappears.
When user are not logged-in, only the Login/Register pane should appear.

So, the Username and Logout pane works perfectly fine.

What SELECTION rule shall I give to the Login/Register pane, so it gets visible only to anonymous users?


texts:
I have installed mysqlnd_ms plugin , created the mysqlnd_ms.json with following configuration.

{
  "myapp": {
    "master": {
      "master_1": {
        "host": "mysql://drupal@1x4.xx6.x.1x9",
        "port":  3306,
        "user": "drupal",
        "password": "password",
        "db": "site2"
      }
    },
    "slave": {
      "slave_0": {
        "host": "mysql://drupal@1xx.1x1.xx9.2x1",
        "port":  3306,
        "user": "drupal",
        "password": "password",
        "db": "site1"
      }
    }
  }
}

its still not splitting the queries! how will drupal work withmynsqlnd. Do i have make edits in setting.php


texts: With all the power of D7 Views 3.x and modules like Node Reference and/or various entity reference modules, alongside flexibility of fieldable taxonomies, I have trouble deciding data structure scenarios for taxonomy vs content types. What are some use cases?


texts: White screen after quiz submit "Course" module

texts:
I noticed after I began adding a number of nodes to my course. That now when a quiz is completed instead of seeing the results page, they get white screen my server is running fine. There are no errors in the logs with error_reporting(E_ALL); ini_set("display_errors", 1);

It works about 2 out of 10 times, the results page is shown.


texts: 403 error when trying to edit one page (works on all other pages)

texts:
Using Drupal 7.69

There's one node (page) on my website that I'm trying to edit. When I click on edit it opens up this page but only shows the html source code instead of showing the other editor. When I try and click on 'plain text editor' at the bottom, nothing happens.

When I try and save an edit (even after editing nothing on the node), I get a 403 error.

Nothing in the Drupal error log. It's a pretty basic page with a button, some images, some text.

I've tried editing other nodes (no issues), and have tried creating a new node and editing that, with no issues as well.

So it's only this one page that I can't edit. Any ideas on what's wrong, or how to fix this?

EDIT: So after a bunch of testing and trying to rebuild the page line by line, I found out I get the 403 error only when a new line on the node starts with "Location:" (including the colon). I don't get an error when a new line starts with any other word with/without a colon, or if the new line starts with "Location"/"Location -"/etc, or if "Location:" is in a line but not at the start of the line. Strange...


texts: Why is my site status continuing to indicate mismatched field definitions after updating?

texts:
When I visit /admin/reports/status, I am told that a few entities have fields that need to be updated or reinstalled.  I created an update hook:

/**
 * Remove the result field from the analysis entity and reinstall
 */
function mymodule_update_8101(&$sandbox) {

  $entity_name = 'analysis';
  $old_field_name = 'result';
  $new_field_name = 'result';

  $field_definition = BaseFieldDefinition::create('decimal')
      ->setLabel(t('Results'))
      ->setDescription(t('Results.'))
      ->setSettings([
        'precision' => 12,
        'scale' => 4,
      ])
      ->setDisplayOptions('view', array(
        'label' => 'above',
        'type' => 'number_decimal',
        'weight' => -4,
      ))
      ->setDisplayOptions('form', array(
        'type'     => 'number',
        'weight'   => 5,
      ))
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE)
      ->setRequired(FALSE);
  mymodule_replace_field($entity_name, $old_field_name, $new_field_name, $field_definition);
}

/**
 * Replace a field in an entity.
 *
 */
function mymodule_replace_field($entity_name, $old_field_name, $new_field_name, $field_definition) {
  $definition_manager = \Drupal::entityDefinitionUpdateManager();
  $old_field_storage_definition = $definition_manager->getFieldStorageDefinition($old_field_name, $entity_name);
  $connection = \Drupal::database();

  if ($new_field_name !== $old_field_name) {
    $definition_manager->installFieldStorageDefinition($new_field_name, $entity_name, $entity_name, $field_definition);
    $connection->update($entity_name)
      ->expression($new_field_name, $old_field_name)
      ->execute();
    $definition_manager->uninstallFieldStorageDefinition($old_field_storage_definition);
  }
  else {
    $definition_manager->installFieldStorageDefinition('temp_column', $entity_name, $entity_name, $field_definition);
    $connection->update($entity_name)
      ->expression('temp_column', $old_field_name)
      ->execute();
    $definition_manager->uninstallFieldStorageDefinition($old_field_storage_definition);
    $definition_manager->installFieldStorageDefinition($new_field_name, $entity_name, $entity_name, $field_definition);
    $connection->update($entity_name)
      ->expression($new_field_name, 'temp_column')
      ->execute();
    $temp_field_storage_definition = $definition_manager->getFieldStorageDefinition('temp_column', $entity_name);
    $definition_manager->uninstallFieldStorageDefinition($temp_field_storage_definition);
  }
}

After running this hook, the error goes away until cron runs, then it returns.  I was able to determine that the "needs to be updated" is triggered by SqlContentEntityStorageSchema::loadFieldSchemaData() returning an empty array after cron runs. If I run the update hook, the function returns an array with mostly correct information. After cron runs, it is empty. I am running D8 with SQL Server.


texts: Currently our application has a nice little feature where it can upload projects (.zip files) directly from our application to our current php based project display site.  We are currently exploring moving this project display server over to Drupal and I was wondering if Drupal could handle this kind of thing.  We currently send an http-post with all of the authentication information then our server sends back a response depending upon authentication success or failure, then the application sends another http-post which includes the .zip file.  Would this sort of work flow be possible with Drupal?  Are there any modules which might facilitate this?


texts: get the content moderation value on node update

texts:
The module content moderation has been activated and a custom workflow added to a content type.
On editing content, when selecting a content moderation state then clicking on save, I would like to programmatically save that value in a variable.

$mod in that code doesn't display the latest values for moderation state chosen on update.

I wonder if what I get is the default revision value (as configured for a state, Révision par défaut Quand le contenu atteint cet état il devrait devenir la révision par défaut; ceci est implicite pour les états publiés.)  but it is definitely not the latest revision value.

function my_hook_entity_update(Drupal\Core\Entity\EntityInterface $entity) {
  if ($entity->getEntityTypeId() !== 'node') {
    return;
  }

  $content_id = $entity->id();
  $content = \Drupal\node\Entity\Node::load($content_id);

  $mod=$content->get('moderation_state')->getValue();
  var_dump($mod);
  die();
}

How do I get the latest value of content moderation on node update?


texts:
Just performed an update to Drupal 7.56. In the process I updated all modules, including Google Analytics. The weird thing is that on my machine, where I performed the update, Google Analytics updated just fine.

But, after placing the files onto the server, and updating the DB with a copy of my own, the server is saying Google Analytic is still in need of an update. Everything else appears fine.

I checked the files for the Google Analytics module, and they are indeed the updated version.

Any ideas?

Thanks,
Cy


texts:
I'm using Profile2 and Profile2 registration path module and I created two profiles.

I want to display their registration form in user/register page. So two forms in one single page.

I set their path to user/register but these forms merged together. But what I want is two separate forms.

Like this:

Any suggestions?


texts: How do I add dropdowns in Filter Criteria in Views module?

texts:
I was at a local Drupal group meetup last week where a member ran through a presentation of the Views module. I was really excited when I saw that he was able to add dropdowns to the Filter Criteria that he was using as I need exactly that functionality for something that I am building.

The thing is: I can't find the settings at all in my build. I remember that there was a 'settings' link at the bottom of his Filter Criteria area, but I have nothing like that.

Could anyone explain where I can find this? Am I missing and additional module?


texts: 8 - How to programmatically add terms to an existing Node

texts:
After loading a node with Node::load with an existing taxonomy field abc do I add a new term and save? Something like?

  $term = Term::load(123);
  $node->get('abc')->appendItem($term );


texts: How to create a rule to send an email when someone creates content of selected type(s)?

texts:
I'm trying to create a rule (using the Rules module 8.x-3.x-dev) to send an email when someone creates content that is of the type Announcement or Article, but I can't seem to get the event to trigger properly. It's sending an email for every node that is created. Can anyone help with the proper method of setting the content type? My rule is as follows:

Event: After saving new content (rules_entity_insert:node)

Condition: Node is of type

Node Value: @node.node_route_context:node

Content Type Value: Announcement, Article


texts:
I have got a question. I have got drupal 7 running and in the user profile page, the body classes look like this:

<body class="html not-front logged-in one-sidebar sidebar-first page-user page-user- page-user-1">

If you notice, the second last class, 'page-user-' seems like it is missing something at the end, meaning, something is not working right. I have used theme devel and just did some mega digging around (including the user module) to see where this class is being added from, but I have had no luck.

I would basically like to change the styling of some tables in the user profile page via css and would like to identify these tables by a specific class in the body, so that it only applies in this user profile page. If that class was perhaps displaying correctly, I could identify the tables with that, and not have to modify the user-profile.tpl.php page to add a new class. So, I would appreciate it if anyone could tell me where these classes are being added, and what that missing variable could possibly be. Thanks.


texts: How can I create a birthday calendar using the Date and Calendar modules?

texts:
I have a content type that represents a person, and this content type has a CCK Date field "birthday". I'd now like to add a list of upcoming birthdays and a calendar where they are displayed.

I'm already using the Calendar module for events on that site, but the birthday stuff seems to be more difficult. I can't use the Birtdays module as I'm working with nodes, not user profiles. And the Date field doesn't seem to support this use case, I can't create a view that only shows upcoming birthdays because I see no way to ignore the year for that calculation.

What would be the easiest way to implement such a birthday calendar?


texts:
I have problem similar to this one.

I want assign node to section while being created. During php node creation I use:

    $node->workbench_access=array('1067');

which should assign node to certain section, but after script execution I see "Section: Unassigned".

When I do separately:

$node = node_load(823);
$node->workbench_access=array('1067');
node_save($node);

..it works. Section gets assigned. As I read Workbench access there might be some bugs preventing this from working (comments like "// Workbench Moderation submits the node twice???" and deleting of redundant nodes?)..

If it was matter of 1 node I would drop it and use second code.. But it seems like I need hundrets of nodes to be created at once so I'd rather avoid loading and saving node only for section assignment.


texts: Strategy for organizing category pages with Views and Panels

texts:
I have created a vocabulary and using a 2 level tree for organizing content into categories.
Each category and sub-category will have it's own page, where a view block will list the teasers from the content types linked to the filtered term(s).

Now I can go and create a View block for each category, but that just doesn't seem to be proper. I'm new to Views and I have been reading a lot but I'm still not at ease with best practices on using  Views.

Should I create just one single View and make a Display for each category or there's a better way to do this?

I'll be using Panels to lay out the category pages. Do I have to create 1 page for each category/subcategory and add the corresponding view to it? Is there's a better Panel's usage strategy, that permits to skip the use of multiple page panels ?

I'm using D7, Views 3.3, Panels 3.2


texts:
I'm trying to figure out how to debug the following behavior and would appreciate some ideas on how to track down the source of the problem.

I run a website were some users have privileges to create and edit nodes and taxonomy terms.

Upon creating content or taxonomy terms, users report that, on occasion, content is created 3 times, for both entity types.

What steps can I take to find the culprit for this behavior knowing that...?

I have made sure users only click the submit button once, but that hasn't made any difference.
Both Drupal and PHP error logs are clean.  I can see 3 logged messages confirming content has been triplicated but nothing else.
It only happens in live environment.  I haven't been able to reproduce it in development environment
It happens randomly.  Users have reported this only happens ocasionally.
When this happens, any rules that react to the condition 'After saving node ...' or 'After updating node...' are also fired 3 times


texts: How to preserve anchor links when pasting from Word into CKeditor?

texts:
Microsoft Word documents often include a table of contents which link to anchor tags elsewhere in the file.
When pasting from Word into ckeditor using the full_html text format I find that the resulting anchors are wrapped in  tags but an id attribute is not present.
Introduction

I would have expected something like this
Introduction

Or this
Introduction

When manually entered in the source code using the full_html text format the anchor link still does not work.
There appear to be two things going on.

The paste from Word functionallity is stripping the ID value from the link

Without additional configuration, anchor tags don't appear to work with the full_html text format

How to solve both problems?


texts: How to know the format when programmatically setting a field value

texts:
I am trying to create a set of entities based on a CSV file on install of a custom module. The entity has a price field and I don't know how to find out what I should be passing in as a value, the following does not work:

$entity = entity_create('item_price', ['type' => 'wand']);
$entity->setName('Harry Potter');
$entity->set('price', 2000);
$entity->save();

Although this problem is specific to the price field I would like to know as a general rule how does one "discover" what format the value should be in for any field type.


texts: Up-to-date solution for cloning commerce product-variation types and their product displays

texts:
I am using Drupal 7 with commerce module. There are a lot of product-types with a plethora of fields – but in general, only a few fields differ, the vocabularies attached to the product for example. So I would like to stubbornly clone the product-variants and their product-display and make some minor changes manually afterwards. It's important, that the display settings are cloned, too.
While researching, I found a confusing amount of modules that seem to offer that kind of functionality:

replicate_commerce
bundle_copy_commerce
bundle_inherit
field_tools
features_clone
https://www.drupal.org/sandbox/davidfiaty/2745827

I would be glad to hear advices from savvy people for modules and appropriate workflows.


texts: Showing latest news article from taxonomy

texts:
I have News content type on my Drupal 7. With views I want to show latest news within specific taxonomy. So each News content type has taxonomy field where I can set news for example into "Cars" category.

Now I have News Lift content type where I have entity reference field called news_type that is linked to same taxonomy as is my News content type. When I make a new news lift and I set I want to show post from "Cars" category. On this just created page I want to now show that latest post in that category using views. In Views my current set up is this:

Filters (published & News -content type)
Relationships (Entitry referecing news_type field).

But at the moment it just shows the latest post. It ignores the relationship about the category. What's wrong. Do I  need contextual filter too?


texts: How do I validate form elements in a modal without closing?

texts:
I'm using Drupal 8 and I have defined a custom entity type 'my_entity_type', with form handlers defined in the @ContentEntityType annotation:

 * @ContentEntityType(
 ...
 *   handlers = {
 *     "form" = {
 *       "add" = "Drupal\my_module\Form\MyEntityForm",
 *       "edit" = "Drupal\my_module\Form\MyEntityForm",
 *       "delete" = "Drupal\my_module\Form\MyEntityDeleteForm",
 ...

where:

MyEntityForm extends ContentEntityForm
MyEntityDeleteForm
extends ContentEntityConfirmFormBase

These are routed in my_module.routing.yml leveraging the _entity_form element:

_entity_form: my_entity_type.add

I am rendering the form from another form as a modal:

$form['add_my_entity_button'] = [
  '#type' => 'link',
  '#title' => t('Add NewEntity'),
  '#url' => Url::fromRoute(
    'my_module.add_entity',
    array(
      'node' => is_numeric($node) ? $node : NULL,
    )
  ),
  '#attributes' => [
    'class' => ['button', 'use-ajax'],
    'data-dialog-type' => 'modal',
  ],
  '#attached' => [
    'library' => ['core/drupal.dialog.ajax'],
  ],
];

All works as imagined. The '#required' type validator appears in the form in the modal.

Goal

To add custom validation to this form's elements ('live' validation that does not close the modal). I recognize that this type of problem isn't novel, and I've done it often in non-modal forms. The methods I would usually leverage are:

'#element_validate' form element callback
validateForm() type form callback

Both appear to require submission of the form, close the modal, and render the errors in a flat form display. I then combed through Core for ideas and embarked on a remarkably twisted yak-shaving journey:

Adding validation via BaseFieldDefinition::addConstraint in the
entity baseFieldDefinitions() : This still submitted the form and led to a flat (non modal) form with errors correctly thrown. Once I solve this problem, I will likely leave this in to serve as a gatekeeper at the storage level.
Extending the 'number' FieldType via Plugin, extending the widget, type or storage : This seemed overly complex for something as simple as adding a validator. I bailed on this before getting too far, since I considered:
Injecting a generic '#ajax' 'replace' callback to the element inside buildForm() in MyEntityForm : I could NOT get ajax inserted in this manner to fire here.
Injecting a generic '#ajax' 'replace' callback to the element in hook_form_alter : I could NOT get ajax callbacks inserted in this manner to fire either.

Questions

What have I missed? I feel this is simple. Is there something I've missed in Form that defines simple ajax validation?

Is there a standard way for validating form elements inside modals without closing the modal?

Can AJAX 'replace' callbacks be attached to forms defined and routed via the @ContentEntityType annotation? Is there a restriction here in the render pipeline?


texts: Can I reset content so that when I enable notifications, no new notification emails go to existing users?

texts:
I disabled the Notifications module a couple years ago when my blog became less active and when I was editing pages to prepare for a relaunch. Now I am preparing to relaunch it and I would like to let the notifications happen again. But I am wary that Drupal is going to blast out emails to everyone for all the edits I've made. Is there a way to reset things so that I can be sure no notifications will be sent out until I post actual new content?

This is Drupal6, btw


texts: Can Panels just be uninstalled if you want to switch themes?

texts:
I used panels + panels everywhere with precision theme to build a website.

I now rather want to use Zen theme with basic blocks.

I wish to keep the content types with their fields.

If I uninstall panels will all instances of it be removed from the site?
Or should I rather just rebuild the site from a new clean installation?


texts: Where does the variable for the left sidebar get set in Drupal 6?

texts:
I have a Drupal 6 site where I've added a submenu for a new set of products:

products
-old products set 1
-old products set 2
-new products set
--new product 1
--new product 2
--new product 3

that goes to a page where that link then becomes a main menu item:

new products set
-new product 1
-new product 2
-new product 3

I found the code:

$variables['layout'] = 'none';
if (!empty($variables['left'])) {
  $variables['layout'] = 'left';
}

in the template_preprocess_page function in the theme.inc file.

On the main menu page, the left sidebar appears with the menu block in it ($variables['left'] is turned on) but on the submenu page, it is not appearing ($variables['left'] is turned off).  The menu block has both pages listed on the 'page specific visibility settings'.  I'm trying to figure out why the difference but the problem is I cannot find where $variables['left'] ever gets set prior to that in the code.  Any idea ??


texts: How to retrieve a select box option and set the field's value to it?

texts:
I have a a taxonomy term select box (called "product_keyword") in a node that gets its options populated via the Reference Field Option Limit module. There are 3 other taxonomy term reference fields in the node that are responsible for limiting the "product_keyword" option list all the way down to a single option, and this part is working beautifully.

The "product_keyword" field is set to Required, so when you actually go in to edit the node, the "product_keyword" field appears to already have this one option selected. However, with the use of the Devel module, I have discovered that this is not the case. There is no #value for the "product_keyword." I have created a custom module (my very first one ever, in fact) to set this #value, but I am having trouble determining how to choose the right properties to set this. This response by Clive is what I'm trying to wrap my brain around.

My module code is using a hook_form_alter function that involves the use of #after_build:

    //Declare the callback for after_build for page node form
function set_keywords_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'part_node_form') {
    $form['#after_build'][] = 'set_keywords_after_build';
  }
}

function set_keywords_after_build($form, &$form_state) {

The overall goal is to simply allow this field to be displayed in a view, but one complication is that these 7000+ nodes are being imported via the Feeds module, and the clients should not have to edit each node manually just to hit the Save button (which is the only way the problem can be solved now - VBO can't do it, nor can the Resave Nodes module). I'm not even sure if #after_build should be involved, and I am also ok with setting the field's #default_value instead of or in addition to the #value.

EDIT:

In the page array dropdown, for the keyword's select list options:

#options (Array, 1 element) 0 (String, 13 characters ) Inker Parts

But under '#value," I'm just getting:

#value (String, 8 characters ) - None -

Under another reference field, "Product Family," where things are functioning normally, I see:

#options (Array, 40 elements)
_none (String, 8 characters ) - None -
1401 (String, 5 characters ) AUTOZ

.......and so on

and for the #value:

    0 (String, 2 characters ) 1401
          $...['content']['system_main']['field_product_family']['und']['#value'][0]

In this example, "1401" is the tid, and "AUTOZ" is the term name.


texts: How to display the number of images contained in a node using Views?

texts:
I have a content type that has an image field (among other fields).
When creating a node, users can upload up to five files.
What i'm trying to do is to display how many images are uploaded in each node when listing node teasers using views ?

Thanks


texts:
Im trying to alter the module "zendek_forms"

It states:
There are four fields in the form (name, e-mail, subject, and description), but
more fields can be added in hook_form_alter and the submit handler will
recognize fields prefixed with "zendesk_" and pack them in the API call to
Zendesk.

I am absolutely clueless on how to do this, even where to begin.  Any help would be greatly appreciated.


texts: How to change order_number on hook_commerce_payment_order_paid_in_full or hook_commerce_checkout_complete

texts:
I'm trying to change the order_number after the order has been created.  Specifically, I need to do this in the hook_commerce_checkout_complete or hook_commerce_payment_order_paid_in_full functions.

I'm sending orders out for 3rd party fulfillment and want to store the 3rd party's unique order_number (which is different than Drupal Commerce's order_number) into DC's order_number column.

I do not need to change the order_number in hook_commerce_order_presave because this happens before I make the call to 3rd party fulfillment when the new order_number gets generated in their system.

You can see in the code below that this is being executed as the order is paid in full, during checkout completion.  In this example the order_number 00001890 is trying to be changed to 9999999 and saved, but the new order_number is not actually saving.

function custom_module_commerce_payment_order_paid_in_full($transaction) {
  print "<pre>";
  print "paid in full\n";
  print_r($transaction);

  $orderid = $transaction->order_id;
  $order = commerce_order_load($orderid);

  print "BEFORE CHANGING ORDER NUMBER \n";
  //order number is 00001890
  print_r($order);

  $order->order_number = 9999999;

  print "AFTER CHANGING ORDER NUMBER \n";
  //order number is 9999999
  print_r($order);

  $result = commerce_order_save($order);

  print "Order save result\n";
  //SAVED_UPDATED = 2
  print_r($result);

  print "DID ORDER NUMBER CHANGE??? \n";
  //no, it did not change, it's still 00001890
  print_r($order);

  $order = commerce_order_load($orderid);
  //confirm order number did not change, it's still 00001890
  print_r($order);

  print "</pre>";
  die();
}

Any help or advice would be much appreciated!


texts: Embed a single field from an existing content in ckeditor

texts: I managed to embed the full content or teaser using Entity Embed module in Drupal 8 but, is it possible to embed a single field which contains text or html without coding


texts: How to resolve the SSL error with local copy of site on Dev Desktop?

texts:
I am running a local copy of my site on Acquia Dev Desktop and everything is working fine.

The site is set to enforce SSL connection when logging in to the sitename.com/admin page. However, since it is now installed on my localhost, it does not have an SSL certificate and throws the error like so:

SSL connection error
Unable to make a secure connection to the server. This may be a problem with the server,
or it may be requiring a client authentication certificate that you don't have.
Error code: ERR_SSL_PROTOCOL_ERROR

What can I do in order to get around this, and log in to my page administratively?


texts: Rules Looping for Multiple User References

texts:
I have a Rule which checks to see if a "Reviewer" CCK User reference field has been changed. If it has been, it loads the referenced user and add the "Reviewer" role. This works perfectly however it only works for the first value in the field, so adding multiple reviewers becomes a problem.

I can see in the "load a referenced user" action that is says "Note that if the field has multiple values, only the first user will be loaded." So I assume this has come up before...

Is there any way around this for Rules 1.x on Drupal 6? I need to Loop this for each set value in the field array but I cant find the best way to do so...


texts: How to store temporary metadata for the remainder of a request?

texts:
I am looking for a way to store some additional metadata for the remainder of a request, that should be removed after the request has finished. Sessions or SharedTempStore store persistent data across requests, which is not desirable.

The main problem is that I am working on an inbound PathProcessor, which after some path modifications needs to check if a valid path remains by using  \Drupal::service('path.validator')->isValid($path). This in turn calls all PathProcessors again, leading to infinite processing. I wish to store some sort of metadata in the request, so that the PathProcessor is aware that it is ran for a second time and does nothing.

Obviously, for subsequent requests the metadata should initially be empty again so that the processing is done for each request.


texts: i have commerce_bundle module installed, and we use it to implement (shop the look) concept, the problem is that we already use flags to implement wishlist for separate products and view the items added to wishlist by a view, now we need to allow bundles to be added to wishlist, but we can't view it in the same view that render the products items in wishlist. are there any ideas to solve this problem?


texts: Possible to customize the look/length of CKEditor Styles dropdown?

texts:
I've added custom styles to the Styles dropdown in CKEditor included by default in Drupal 8. They work fine. However, the dropdown isn't convenient for editors to use because

It isn't tall enough
There's a lot of vertical spacing between items
Items have the style they represent, taking even more space

Here's a snip of my default Styles dropdown:

It's fine that the items have the style they represent, except it can take a lot of space in the very small box, especially if the font is large. Plus there's lots of vertical spacing between items.

I've figured a [hackish] way to keep the items from taking on their represented style, producing this:

But it's still too short with a lot of space between items, so only four styles of 20 show.

QUESTION:

Is there a way to customize the look of the Styles dropdown, or at least to make it longer? Lots of reading of posts and documentation hasn't provided an answer, if there is one.


texts: Having trouble exposing custom table with relationship to multiple entity fields

texts:
I have a custom table with two fields I'd like to use as foreign keys to user with corresponding content fields attached to the user entity.  So far I have the base table exposed to Views and showing data in preview.  I have been trying to add just a single field of relationship/join at a time, so here's what I've got for that:

$data['lcm_subscription_lookup']['SID'] = array(
  ...
  'relationship' => array(
      'base' => 'field_data_field_subscription_sid',
      'field' => 'SID',
      'handler' => 'views_handler_relationship',
      'label' => t('User SID'),
  ),
  ...
$data['lcm_subscription_lookup']['table']['join'] = array(
  'field_data_field_subscription_sid' => array(
      'left_field' => 'field_subscription_sid_value',
      'field' => 'SID',
  ),
);

I think there's a clue in the views generated SQL with error:

...
FROM
{lcm_subscription_lookup} lcm_subscription_lookup
LEFT JOIN {field_data_field_subscription_sid} field_data_field_subscription_sid_lcm_subscription_lookup ON lcm_subscription_lookup.SID = field_data_field_subscription_sid_lcm_subscription_lookup.

Note that there is no field specified (empty string after "." where I'd expect 'field_subscription_sid_value') in the JOIN .. ON to the field table.

Once this is working, I'll need to also add in the other field (lcm_subscription_lookup.AddrID -> field_data_field_subscription_addrid.field_subscription_addrid_value) and then what to link to the User itself?

This https://drupal.stackexchange.com/a/137661/2114 looks really close along these lines, but I haven't make the connection.


texts: How to alter the visibility of a menu tab for a page created in Views?

texts:
I have a View that is a primary tab on the user profile page. The user profile tabs look like this view | edit | menu-item-to-hide. If the person viewing the page is does not have role of admin or the owner of the profile page then they should not see the tab.

I assume that I use hook_menu_alter() but I'm not sure what the code should be.


texts: I have given permission for anonymous users to comment on my site. But the default comment form being displayed does not have a field for email address in it. Also, I have comment notify installed. The email field to be displayed on the comment field should be recognized by comment notify as the email address of the commentor so that it can send notifications. Also, the email field should not be made visible for logged in users. I cannot solve all the three problems at once. Any help will be greatly appreciated.


texts: Change the front page based in the screen size of the visitor?

texts:
I use the Omega theme to make a site responsive.
I need to change the Front Page of the site based in the screen size of the visitor.

The idea is to hide a front page which include a flash movie on mobiles devices.

Then:

if the user screen is small than 740px then the front page is: no-flash-page
if the user screen is bigger than 740px then the front page is: flash-page

Can I do this using the Omega theme setting? Maybe with Delta and Context?


texts: CKEditor is adding inline style to resize my textarea on node add/edit form

texts:
No matter how many rows I define the textarea to be in the content type configuration, I get a huge editor taking up almost the whole browser window in the node add/edit page. I tracked this down to CKEditor, which is hiding the actual textarea and adding an inline height to the table cell it uses to display the iframe containing the actual field. (Argh.)

Please share any advice on how to make it stop or override it? Since it's inline, I'm not hopeful about using normal CSS.


texts: How can I move a view from one feature to another?

texts:
I have a view that I added to Feature A that I would instead like to move to Feature B.  I re-created Feature A using the admin interface, but even after re-creating the feature, clearing the cache, and reverting the feature, the view still appears in the database in code and I am unable to attach it to Feature B.

How can I remove a view from one feature and add it to another?


texts: How do I integrate media (e.g. attaching audio) to nodes?

texts:
I installed the Media Entity module for Drupal 8. I thought it would somehow facilitate adding Mp3, etc, as Media does in Drupal 7, where I could specify a media player type for an audio file. (And things work fairly well.) I am updating my site to Drupal 8 and it seems the Media Entity module only acts as an API. Maybe I just need to wait for an official Drupal 8 release before I get too far in the weeds with media?

Since I am grabbing Mp3 files from my previous site, ideally there would be a media field to which I can, in code, just add the field info, with the rendering of the field being determined by the form display settings.

Anyway, I am sure a lot of people are trying to figure this out in Drupal 8, so if anyone has a good approach, I am all ears!


texts:
Every user of my site must be able to create a first FORM, a first request, where inserts quantities.
Administrator must be able to control these quantities and possibly confirm or modify them.

Then the user must be able to fill out a second FORM, a second request, where insert a number of elements for a field, as many as the amount specified in the first FORM.

Example: if in the first FORM someone entered for PRODOTTO_1 as QUANTITY '= 3, in the second FORM must enter, for PRODOTTO_1, only 3 NAMES taken from a list in the site.
If inserts for PRODOTTO_1 as QUANTITY '= 2, in the second FORM must enter only 2 NAMES for PRODOTTO_1.

How can I try to fix this problem?

Thanks in advance to everyone!!!


texts: How do I use Taxonomy reference field tokens in a path alias?

texts:
I have a content type with two taxonomy entity reference fields. Both are required fields that only allow one value. I have path_auto and token enabled. I would like to use them to set the path of the node type.

This is the path pattern that is a problem:

[node:field_main_site_section:entity:name]/[node:field_content_category:entity:name]/[node:title]

It looks close to the answer given in another questionn here.

Result: The only thing showing up in the path is the title.

Versions: Drupal 8.8.5, pathauto 1.8, token 1.7

What have I tried?

I tried running the code through the debugger and found out that the action is in the functions PathautoGenerator::createEntityAlias() and Token::generate(). I see that the three tokens are found and that a Node data is passed to Token generate. Then the generate function runs $replacements = $this->moduleHandler->invokeAll('tokens', [$type, $tokens, $data, $options, $bubbleable_metadata]). There were 9 modules found that implement hook_tokens but the only one returning any data is node_tokens. Looking at that code I don't see any attempt to return fields.

I also found an issue on the token module that indicated that I might be missing Token view modes. I was indeed missing a token view mode for my two taxonomy vocabularies so I created them. I added each field in the vocabulary including "name" in plain text.

I also tried to guess that the node needed to be converted to an entity to grab it's fields:

[node:entity:field_main_site_section:entity:name]/[node:entity:field_content_category:entity:name]/[node:title]

That was an invalid pattern.

Question:
What is the correct pattern or what else do I need to configure?


texts:
I need to implement functionality for search nodes and taxonomy terms through one search form and display results in one listing.

I try to use these modules:
1. Apache Solr
2. Search API
3. Search API Solr Search
4. Search API multi-index searches
5. Search_api_views

I can't make apache solr module add taxonomy terms into index.
It's possible? What I do wrong?
Now my apache solr index only nodes.

I configure apachesolr module http://i.imgur.com/V1OYd.png
Also I configure Search API http://i.imgur.com/qeAvs.png

Any help is appreciated


texts: How to hide a field based on a specific condition?

texts:
I have a website for ads, which are either of those:

Regular ads.
VIP ads.

The Regular ads have an additional field "field_adding_make_vip". If the user decides to change a Regular ad to a VIP ad, the user will use the description from that field and send a SMS to a specific number and that ad will become automatically a VIP ad.

The filter in Views to show the VIP content is a additional field "field_vip_date" that uses a date filter. That mechanism is created with a custom PHP file.

So only left to do is: when the Regular ad becomes a VIP ad, the field "field_adding_make_vip" will be automatically hidden and the VIP ad will have additional field "field_adding_vip_image" that will show a VIP image, so every user will know that the selected ad is a VIP ad.

How can I hide that field and show the VIP image when the ad becomes a VIP ad?

The Regular ad and VIP ad are the same content type (adding). I'm using the field "field_vip_date" as a filter in views by date. Let's say when the date field of a specific node is set to 25 October, that node will be displayed in a VIP block position in the website until 25 of October and the next day it will be automatically removed from that position. That's for a block view position.

In every page node the field "field_adding_make_vip" has a description with the node id how to send the SMS, to be used to make it a VIP ad. The whole idea is when the user sends an SMS with the number ID, the field "field_adding_make_vip" will disappear, because the regular node has become a VIP ad and that node will have an additional field "field_adding_vip_image" that will display an image with a text "VIP".

Somehow the field "field_vip_date" (which is a date field) will have to control the field "field_adding_make_vip". For an example if "node/120" has "field_vip_date" set to 25 October, the field "field_adding_make_vip" will be hidden until 26 October and the field "field_adding_vip_image" will be displayed until 26 October.

Note: I've tried the code from @harshal, but it has errors. The name of my custom module is "custom_alter" and here's the full code:

<?php
function custom_alter_form_alter (&$form, &$form_state, $form_id) {

 $node = node_load($nid);
 $date = date('d/m/Y');
 $todaysdate = strtotime($date);
 $field_date_vip = $node->field_date_vip['und'][0]['value'];
 $date = date('d/m/y',  $field_date_vip);
 $expirydate = strtotime($date);

If ( $todaysdate <  $expirydate )) {
  //Hide the field adding_make_vip using css
  drupal_add_css(drupal_get_path('module', 'custom') . '/css/hide_field_adding_make_vip.css');
             }
else {
// hide field adding_make_vip using css
  drupal_add_css(drupal_get_path('module', 'custom') . '/css/hide_field_adding_vip_image.css');

}

}


texts:
I have installed User Relationships for a project.  User A is friends with user B.  When user A posts a piece of content, currently it shows up on his front page, as well as user B's front page.

I just want any user to view their friends' content if they are viewing a friend's user profile.  I created views for the content as menu tabs for the users.  If someone is a friend, they should be able to view the content.  Otherwise, it should remain private for the user.

To rephrase my desired functionality, a user's content should only be viewable by the owner, and by any friends, via a user menu tab.


texts: Is 'order completed' a safe way to assume that order is paid in full?

texts:
I am working on a client's site. I have a requirement that when a user buys a product, a specific role should be assigned to the user.
For this, I have used 'business rules' module.
Business Rules
Reacts on event: After updating Entity
Target Entity Type: Order
Target Bundle: Default
Condition
Type: Data Comparison
Target Entity Type: Order
Target Bundle: Default
Field: state: State[state]
Data to compare: Current value
Operator: =
Value to compare: completed
Items to execute if condition succeed
Action: Add 'One year subscriber' role to user
My question is, Is this the correct way to identify that the product is purchased and order is paid in full?
That is, if order status is completed then is it safe to assume that the product is purchased and order is paid in full?


texts: Drupal Antispam + Administer Views modules

texts:
Seems that when activating Administer Views, all pages in the path admin/content/* disappear, and got replaced by some custom views that the module automatically creates for them.

The problem is that no view is created for the antispam moderation queue page...

So i was wondering if any of you had the same problem and how did you solve it?

I tried to disable the antispam module and activating it again, so it load later than the admin views... a crazy idea that accomplished nothing...

I tried to create a system view to emulate the capabilities of the antispam page... but i don't know how to get the comments marked as spam from a view... it doesn't seem to exist any field used as a flag for that...

Any ideas?

Thank you very much,
Marc


texts: Translating view content is not working as expected

texts:
I got a D8 site with a newly created content type with the following fields:

Title
Ordering Number
Some Boolean field

The title field is allowed to be translated but the other two are not.

A view is created to show a list of all entities of this content type, showing only the title, filtering by the Boolean, and ordering by the Ordering number field.

Everything works fine for the default language. When switching to the second site language, the titles still shows in the default language.

I then added a filter criteria to filter using translation language of the context selected language. Now the title shows in the correct language but the order field and the Boolean field comes as nulls (I've ran the view query manually). The reason is apparently because these two fields are not translatable and hence when joined using the current language there are no corresponding records.

What is the solution for such a situation?

Query from the current view settings looks like the following:

SELECT node_field_data.langcode AS node_field_data_langcode,
node__field_order.field_order_value AS node__field_order_field_order_value,
node_field_data.nid AS nid FROM  {node_field_data} node_field_data
LEFT JOIN {node__field_order} node__field_order ON node_field_data.nid = node__field_order.entity_id AND (node__field_order.deleted = '0' AND node__field_order.langcode = node_field_data.langcode)
WHERE (( (node_field_data.status = '1') AND (node_field_data.langcode IN  ('en')) AND (node_field_data.type IN  ('my_content_type')) ))
ORDER BY node__field_order_field_order_value ASC

I had to remove the filter by Boolean because when it comes as null, no results show at all.


texts: Commerce: What field to join line_item in order to get product price in custom query?

texts:
I'm starting with line 'commerce_line_item' as a base table, and I want to get prices for each of the line item products attached to a Drupal Commerce Order, rather than just the order total. I need a listing of each product sold with prices, and neither views nor Entity Field Query offer enough options for me (I'm creating a master order statistics spreadsheet with phpexcel).

The only promising field I have in the 'commerce_line_item' table is an 'order_id', which I can't find a way to relate back to 'commerce_product' and a 'line_item_label', which does not join on the field 'commerce_product.sku'.

So what would I join on to get pricing information?

I asked a similar question here, but this has me slightly more baffled.

Here's my code below for the query.

  $query = db_select('commerce_line_item', 'i');
  $query->fields('i', array('line_item_label', 'line_item_id', 'quantity', 'data'));
  $query->condition('i.type', 'product', '=');
  $query->leftjoin('commerce_product', 'cp', 'cp.sku = i.line_item_label');
  $query->leftjoin('field_data_commerce_price', 'fcp', 'fcp.entity_id = cp.product_id');
  $query->fields('fcp', array('commerce_price_amount'));
  $query->leftjoin('commerce_order', 'o', 'o.order_id = i.order_id');

snip->

Thanks for your help!


texts:
Working on my first Drupal project, I meet this problem for the second time. I can't figure why this happens and couldn't find any leed on the web.

1) A view with contextual filter Content: Has taxonomy term ID (with depth)

depth = 1
When argument not in the URL = Show all results
Vocabulary : the proper (hierarchical) taxonomy is selected

The view has path taxonomy/term/%

The preview is correct, both when entering as an argument a child term ou a parent term.

The view results are correct for any taxonomy/term/[child_term] path.

But for a taxonomy/term/[parent_term] path, I get a message "No content tagged with this term". The sentence is true, but it should return all content tagged with any of the child terms. So, it behaves as if there was no (with depth).

2) Adding to the same view a basic Filter criteria = Content: Type(=[TheRightContentType]).

The preview is ok. But again, the results are not filtered. Even when the argument is a child term, I get all results tagged with that term, but whatever their content type is.

I flushed the browser cache. Then I flushed Drupal's caches. In vain.

Any suggestions appreciated. Thanks.


texts: Customizing Drupal Commerce Bundle module

texts:
How can I customize Drupal Commerce Bundle module? My situation is that I am developing an Ecommerce site where user can buy Necklaces from necklace collection and lockets from locket collection, both combined to form a single product. So I have used commerce bundle module to achieve this. Now I am stuck in an issue which is what if the user wants to buy multiple lockets or multiple necklaces? Currently the user have the option to select only one of each type to form a single product. How can I achieve multiple selection?

Thanks In Advance


texts: Use name from referenced user entity in URL as contextual filter

texts:
In a D7 site, I have a blog node, and to allow multiple authors, I'm using a user entity reference field (field_source) for blog author instead of the default user. I would like to create an RSS feed of a referenced source's blog content with the URL friendly version of the source's name as a contextual filter (e.g. for user John Smith, the url would be /mysite.com/feed/john-smith).

Here's what I have so far in my view:

Display type = Feed
Relationship of "Entity Reference: Referenced Entity - A bridge to the User entity that is referenced via field_source"
Contextual filter of field_source with settings of:

User validator
Allowed filter value of "Allow both numeric UIDs and string usernames"

My problem is, I can get it to work just fine with the uid (e.g. /feed/123), but not the name. As far as I can tell, I have added everything I should need.  What else am I missing?

Thanks


texts:
I'm using the Webform module in a Drupal 6 installation. This webform is appearing in an iFrame, and can be found on every page. The website that contains the iframe is static, the Drupal installation with the Webform module is the only thing being loaded in the iframe. This webform is a quiz with 20 questions. The rest of the site is kind of like a handbook, and I want my users to be able to use the static handbook website as a guide while taking the quiz. Each quiz question is on its own page; I am using webform's pagebreaks to split each question up.

Is there a way to set a cookie that takes the user back to the question they left off at, should they choose to leave the form and return?


texts: The file upload in feeds importer is not working

texts:
I have been reading through all the documentation I can find, but I cant find a simple solution for this problem.

I can upload the first CSV file, and import it to a custom table with error handling and everything; when I try to upload the second CSV file, the importer imports the first file and the new file is not even uploaded to my server.

Does anyone know why this would happen?

So I have still been working on this issue and this is what seems to be happening. I "upload" a local file, this file is not actually uploaded to the server and is not recorded in the database in the "feeds_source," or in the "files" tables. The only available file is the original file that had been uploaded, and this file is being re-imported into the database. This is why I am not getting any errors or warnings or watchdog reports.

Has anyone else experienced this?


texts: Can a module provide a default block with editable content? (editable through the standard block interface)

texts: I have multiple blocks I'd like to include in a module/install profile; (containing markup) but need to be editable through the standard block UI? What's the best way to implement this?


texts: How to place private folder on another server?

texts:
I am designing a file store with Drupal 7. The server provider told me that I am not allowed to put the files in the current server and I have to purchase a download server beside the current server.
All the files that can be downloaded via users must be placed over a separate download server and the rest of the scripts must be placed in a simple PHP server.

Is this possible, With Drupal?

I am selling files via commerce store and commerce file. all of the files are located in a private folder. users that pay the cost of files are able to download purchased files for a limited period of time, while others and anonymous are not allowed.

Now I have to put the private folder into a download-only host separated from current host.

I found some suggestion such as hosting files on the file server and copy the needed file from file server to the PHP server in order to give the download link to users.
I must say that the PHP server doesn't allow me to copy files from the file server, and all content of the files folder must be hosted in a file server.


texts: Setting a default checkbox value in FAPI

texts:
Trying to set a default value on an entity reference field.

$unitid = node_load($unit);
$form['field_choose_a_service']['und']['#default_value'] = $unitid;

  Warning: Illegal offset type in form_type_checkboxes_value() (line
  2390 of
  /homepages/43/d503288075/htdocs/example.co.uk/includes/form.inc).

  Notice: Object of class stdClass could not be converted to int in
  form_process_checkboxes() (line 3316 of
  /homepages/43/d503288075/htdocs/example.co.uk/includes/form.inc).

And targeting the nid from that loaded node...

$unitid = node_load($unit);
$form['field_choose_a_service']['und']['#default_value'] = $unitid->nid;

  Warning: Invalid argument supplied for foreach() in
  form_type_checkboxes_value() (line 2389 of
  /homepages/43/d503288075/htdocs/example.co.uk/includes/form.inc).

The first one actually works, but kicks up the errors. What am I doing wrong?

Essentially I want to check if the nid im passing in the URL as a _GET query matches an option in the entity reference checkbox options, and make that option selected if it does.


texts: Using Drush on shared hosting without `curl` and `wget`

texts:
I have a Drupal 7 site installed on shared hosting.

And installed Drush:8.1.17 with composer and cgr all is working well except drush up because hosting provider does not support curl or wget on shared accounts.

When I ask them they said that there is no plans for giving permissions on shared account users to curl or wget when I run:

$ drush up
$ wget nor curl executable found.

$ curl
-jailshell: /usr/bin/curl: Permission denied

Is there another way of using drush up?


texts: Add a field programmatically to a custom entity

texts:
I am defining a new entity following the steps related here: http://www.istos.it/en/blog/drupal-entities/drupal-entities-part-3-programming-hello-drupal-entity

My question is how I can add a field programmatically to the Entity when I define it. I have read some links but I can't get it work.

My code:

function generador_examenes_entity_info() {
  $return['question_section'] = array(
    'label' => 'Apartado',
    'controller class' => 'SectionController',
    'base table' => 'question_section',
    'uri callback' => 'section_uri',
    'fieldable' => TRUE,
    'entity_keys' => array(
      'id' => 'sid',
    ),
    'static cache' => TRUE,
    'bundles' => array(
      'question_section'=> array(
        'label' => 'Question Section',
        'admin' => array(
          'path' => 'admin/structure/question-section/manage',
          'access arguments' => array('administer'),
        ),
      ),
    ),
    'view modes' => array(
      'full' => array(
        'label' => t('Full Content'),
        'custom settings' => FALSE,
      )
    ),
    'access callback' => 'section_access',
  );
  return $return;
}

Thanks


texts:
I would like to display blocks in region by code, in the same way that I can use context (so: if I'm on a node_view of type "article" display block "user login" on region "Sidebar first", for example).

I know how to load and display blocks but I don't know which is the best place to make it.

Have I to add the render function in regions template?
Or have I to use a theme function to do this?


texts: Format 'Table Of Files' Field Display For Commerce Product Display?

texts:
We have a Commerce Product Display for a Product Variation. If you're not familiar with Commerce Kickstart, it's basically just a form to add an item to a shopping cart. Each Product Display includes links to various PDF documents. The display format for the PDF field is 'table of files'. It works, however it looks clunky.

I'm having trouble locating the tpl or inc file that controls formatting for this type of field ('Table Of Files'). We don't want to globally change table display, we just want to alter it on this one Display.

Where is the php located to theme this? Or is there a function I need to add to my theme to hook into that display?

Specifically, we want to:

Get rid of the header.
Get rid of the file size column.


texts: How to edit Commerce to display more than 3 products in a row

texts:
I'm using Commerce Kickstart, I am not able to figure out how to display more than 3 products in a row. Even if I created a new View mode using Entity View Mode it still behaves the same.

How shall I go about changing this? Is there a setting somewhere in the View UI that's controlling this?

Thanks very much!


texts:
I have installed https://www.drupal.org/project/search_files module to make a search on files. After search prozess I have two tabs - content and attachments
Is it possible to get one (fusion) tab instead?
I find no solution :-
Thanks


texts: drupal commerce conditional checkout panes

texts:
I have used the following module to add a custom checkout pane to get some additional information from the user regarding the order.

https://drupal.org/project/commerce_fieldgroup_panes

I now need to apply a condition that if the order contain a product of specific product type then display this pane else hide it.

Can some one please guide me how can I do this.

I have found the following code from https://drupal.org/node/1807092 but I don't know how to modify it according my need. Looking for some help on how to modify & use this code.

<?php function commerce_conditional_panes_commerce_checkout_pane_info_alter(&$checkout_panes, $form, &$form_state) {
global $user;
foreach($checkout_panes as $pane_name => &$pane_data) {
    // load current order
    $order = commerce_cart_order_load($user->uid);
    // retrieve the value of controlling field
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    $control = $order->field_make['und']['0']['value'];
    // Perform switch to see what to do with each aircraft make
    switch ($control)
    {
       case "value1":
         break;
       case "value2":
         break;
       case "value3":
         break;
       case "value4":
         break;
       case "value5":
         break;
       case "value6":
         // ...we only need to override one of them
         if($pane_name == 'commerce_fieldgroup_pane__conditional_pane' && $pane_data['enabled']) {
           // the pane is enabled by default, so we need to disable it
           $pane_data['enabled'] = 0;
         }
         break;
       case "value6":
         break;
       case "value7":
         break;
       case "value8":
         break;
       default:
         break;
       }
    }
}
?>


texts: Module Error for some content types but not for others

texts:
The Error

  warning: array_keys() [function.array-keys]: The first argument should be an array in /home/vermontbiz/webapps/vermontbiz/modules/int_meta/int_meta_cck.module on line 39.
  warning: Invalid argument supplied for foreach() in /home/vermontbiz/webapps/vermontbiz/modules/int_meta/int_meta_cck.module on line 39.

The Code

function function int_meta_cck_int_meta($op, &$arg) {
  switch ($op) {
    case 'load': {
      if (!empty($arg->int_meta)) {
        $supported = int_meta_cck_supported($arg->type);
        foreach ($arg->int_meta as $key => $tag) {
          if (in_array($tag->field, $supported)) {
            $parts = explode('.', $tag->field);
            if (isset($arg->{$parts[0]})) {
             foreach ($arg->{$parts[0]} as $tmp) {
               $arg->int_meta[$key]->values[] = $tmp[$parts[1]];
              }
            }
          }
        }
      }
    }
    break;

    case 'fields': {
      return int_meta_cck_supported($arg);
    }
    break;
  }
}

function int_meta_cck_supported($arg) {
  $fields = array();
  if (!empty($arg)) {
    $type = content_types($arg);
    if (!empty($type)) {
      foreach ($type['fields'] as $name => $info) {

      //**Error below takes place in the line below but doesn't effect all content**

        foreach (array_keys($info['widget']['default_value'][0]) as $col) {
          $fields[] = $name . '.' . $col;
        }
      }
    }
  }
return $fields; }

My question is why does the line give an error to some content types but not others?

The two content types.


texts: Webform rules: compare a form field to a user field

texts:
I am trying to create a rule that will update a user piece of info from a webform.
The webform is a service request form and the field I want to update is a car license plate field, present both in user fields and webform fields.
I installed the Webform rules module, which exposes the webform in the rules conditions but I cannot see anything changed. No webform or webform field appears in the conditions selections.
Does this module work? Am I missing something?


texts: What to do when you can't upgrade modules?

texts:
I have some old sites running "dead" versions of modules in my drupal (I made the upgrade to the last current Drupal core version).

But some of the modules used in this site are not longer supported or they need a "major" upgrade. This will break my site for sure, because some of them are used.

What do you think it's the best approach to fix this ? Because this represents a serious risk for the security of the website.


texts: Date of Birth in Views: Age is 1 day ahead of desired value

texts:
Drupal 7.15 with Date module version 7.x-2.6

Date, Date API, Date Views enabled.

I added a date of birth field to a content type, and added 'child' nodes with their dates of birth.

In Views, I want to see the age of the children, so in the View I have:

Configure field: Content: Date of birth

Formatter = Time ago

Display = Time ago

My problem is this.

Right now, it is Thursday 6 September 2012 1500

A person has Monday 7 September 2009 as their date of birth.

The 'time ago' is showing as 3 years 15 hours ago.

However in real life they haven't yet reached their third birthday, so I want the result to say 2 years until midnight tonight when the child becomes 3.

How can I fix this?


texts: What order should configuration import and module updates be run?

texts:
Since the schema version of modules is stored in the key-value storage, it is unique to each site and is not synced through configuration management.  That makes sense, since updates may need to make adjustments that are not encapsulated in config (such as database updates), but there are other changes that may also be included in config (e.g. adding a new config value).

Are there any risks to running config import and database updates in either order?
What is the preferred order for running those operations?
Do update hooks need to make any special accommodations for config items that may have already been imported?
Are there any other operations that may be required to fully update the production environment?


texts: Taxonomy term AND (,) operator does not work

texts:
In contextual filters, with

validator = taxonomy term
Filter value type = term ids separated by , or +
allow multiple values = true

Giving argument "1+2" works as espected: OR operator

Giving argument "1,2" works as "1+2": OR operator instead of expected AND operator

In both cases, conditions uses operator "IN":
WHERE (( (field_data_field_tags.field_tags_tid IN('1', '2') ) )AND(( (node.status = '1') AND (node.type IN ('flickr_photo')) )))

This is the contextual filter part of my view:

/* Contextual filter: Content: Tags (field_tags) */
$handler->display->display_options['arguments']['field_tags_tid']['id'] = 'field_tags_tid';
$handler->display->display_options['arguments']['field_tags_tid']['table'] = 'field_data_field_tags';
$handler->display->display_options['arguments']['field_tags_tid']['field'] = 'field_tags_tid';
$handler->display->display_options['arguments']['field_tags_tid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['field_tags_tid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['field_tags_tid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['field_tags_tid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['field_tags_tid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['field_tags_tid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['field_tags_tid']['specify_validation'] = 1;
$handler->display->display_options['arguments']['field_tags_tid']['validate']['type'] = 'taxonomy_term';
$handler->display->display_options['arguments']['field_tags_tid']['validate_options']['vocabularies'] = array(
  'tags' => 'tags',
);
$handler->display->display_options['arguments']['field_tags_tid']['validate_options']['type'] = 'tids';
$handler->display->display_options['arguments']['field_tags_tid']['validate_options']['transform'] = 0;
$handler->display->display_options['arguments']['field_tags_tid']['validate']['fail'] = 'empty';
$handler->display->display_options['arguments']['field_tags_tid']['break_phrase'] = 1;
$handler->display->display_options['arguments']['field_tags_tid']['not'] = 0;

How can I set a AND filter? I want to display contents with all values of tags.


texts: How to programatically change file user owner

texts:
I'm using drupal services module. I can upload files through web services but the problem is all created files has the same owner, that is, the user of the web services. I would like to change this user but I don't know how to do it.

I have been searching in drupal api functions (file.inc), but I haven't found a function to change this. How could I change the file's owner?
Thanks.


texts: How does this Open ID module work in Drupal 7? I would expect something more or less the way StackOverflow and all these StackExchange websites work: you pick up your logging provider, like Google or Facebook, by clicking one of them. If you aren't currently logged in in their service, you are redirected to their logging interface, fulfill username and password and you are redirected back to the parent website and already recognized. It looks like the OpenID module does not work this way. You have to paste an Open ID URL or something... Is there a module that does the process exactlys as in the Stack Exchange websites, or more or less the same? Because I think the process implemented in this website is absolutely fantastic: quick and comprehensive, Dummies proof. Or I am afraid I am behaving like the Dummy myself if the Drupal Open ID module works this way. I have been experimenting with it in my localhost and it requires me to paste an OpenId URL. Thanks for any help clearing this...


texts:
In Drupal 7, my commons wiki gives an error when editing.

  EntityMetadataWrapperException: Unknown data property
  field_target_nodes. in EntityStructureWrapper->getPropertyInfo() (line
  339 of
  /home/content/44/11622944/html/sites/all/modules/entity/includes/entity.wrapper.inc).

According to Drupal, the problem is that when commons is installed, it doesn't reset features because it might cause the user to loose work. So the solution is to reset features.

So I go /admin/structure/features/commons_wikis here and reset all I can, but I'm still having issues. My  FIELD INSTANCES and MESSAGE TYPE are "stuck" in overridden. I've tried clearing the cache too.

I can't install or use drush because I'm on a hosted solution and SSH isn't an option.

How can I reset FIELD INSTANCES and MESSAGE TYPE without drush?


texts:
I'm developing a Drupal 7 website that will be served from multiple servers behind a load balancer.

I want all static files generated by Drupal cache (JS, CSS, and also theme and modules images) to be served via an Amazon S3 bucket.

I already did this for my content types' file upload fields, using the Amazon S3 module, but it's missing the feature I described above.

I saw there's Media Mover module, but it's far from D7 production ready.

What other solutions are there?


texts: How to implement a trial membership using Organic groups?

texts:
I work on a Drupal site with the Organic groups module, where users can create account.

When the process for creating an account is finished, users have access to a specific group and should have og role Trial member (automatically assigned) with state Active, and this for a limited time period.

After that limited time period is passed, user still has og role Trial member assigned, but with state Pending.

Can someone help me with this?


texts:
I installed the xmlsitemap module and would like to customize the sitemap.

For example, I would like to exclude some nodes that have a certain term reference field.
I would also like to be able to create separate sitemaps for each content type.

Is there a way to do that?
Otherwise I could probably generate the xml sitemaps with service_views module.


texts:
I created a function to save the location (city, lat, long) of the user. So when he change the page, I don't need to convert his location again. So I've a problem. The session might be saved because when I close my computer, go to another place and reopen the page, my old location is still saved. How I can forget the location of the user when he leave my website ?

Here is a code example for how I store the user location :

function user_location_update($args) {
    drupal_session_start();
    if (isset($_GET['lat']) && isset($_GET['lng'])) {
        $_SESSION['user-location'] = array(
            'lat' => $_GET['lat'],
            'lng' => $_GET['lng'],
            'city' => $_GET['city'],
        );
    } else {
        $_SESSION['user-location'] = array(
            'city' => $_GET['city'],
        );
    }
}

Then here is an example how I use my data (I send them to JS by settings) :

drupal_add_js(array('userlocation' => (isset($_SESSION['user-location']) ? $_SESSION['user-location'] : array())), 'setting');


texts: Adding referencing entities using hook_entity_property_info_alter

texts:
I have a custom entity "Matching" with a multi value field entity reference jobs that references a node of type job.

function custom_alters_entity_property_info_alter(&$info) {
  $info['node']['properties']['referencing_matching'] = array(
    'label' => t('Referencing matching'),
    'type' => "entities",
    'description' => t("Matchings referecing a job"),
    'getter callback' => 'get_referencing_matching'
  );
}

function referencing_matching($node) {
  if($node->type == "job"){
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'matching')
          ->fieldCondition('field_job_id', 'target_id', $node->nid, '=');
    $result = $query->execute();
    if ($result) {
      return $result;
    }
}

the "getter callback" isn't expecting an id rather than an array


texts: Categorize Feeds with taxonomy terms automatically

texts:
I want to fetch the content from various RSS sources into my site to display them in a section. I have installed the Feeds module and created the feed to fetch from, along with the Content Type that will host the fetched news, but I'd like to categorize them in order to display then in different groups using Views (i.e.: 'news', 'technology', 'sports', etc.).

Is there any way to tell the Feeds module to add a value to the generated node's "Category" field (whether this is a taxonomy term or text field)?


texts: setcookie doesn't work in submit function nor tpl.php

texts:
I just copy and pasted set cookie sample code(http://www.w3schools.com/php/php_cookies.asp) to my module and tpl.php

In my module, I put the setcookie in my submit function as below:

function custom_request_price_form_submit($form,&$form_state){
   $cookie_name = "user";
   $cookie_value = "John Doe";
   setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day

   if(!isset($_COOKIE[$cookie_name])) {
       drupal_set_message("Cookie named '" . $cookie_name . "' is not set!");
   } else {
       drupal_set_message("Cookie '" . $cookie_name . "' is set!
");
       drupal_set_message("Value is: " . $_COOKIE[$cookie_name]);
   }
}

Im my node--XXX.tpl.php, I just copy the code without modification as below:

$cookie_name = "user";
$cookie_value = "John Doe";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day

if(!isset($_COOKIE[$cookie_name])) {
    echo "Cookie named '" . $cookie_name . "' is not set!";
} else {
    echo "Cookie '" . $cookie_name . "' is set!
";
    echo "Value is: " . $_COOKIE[$cookie_name];
}

However, no matter how I refresh the webpage, the message always shows "Cookie named 'user' is not set!"

I also tried user_cookie_save function, but no luck. Does anyone know why my cookie setting doesn't work?


texts: Referring to an image file uploaded as `Image` type field without /sites/

texts:
I am using a content type with Image type fields to hold images uploaded to a web site. I want to display these images both on distinct pages (easy) and inline on other pages (almost even easier).

However, I don't want to expose /sites/default/files/ in the image URL, and I certainly don't want to include it in the image tag's src attribute when I refer to the image from some other page.

How do I include at an arbitrary location on an arbitrary page an image uploaded like that, without exposing the physical directory structure in the link? I tried using the URL aliases feature provided by the Path module, but it wouldn't let me point to anything in /sites as such.


texts: hook_menu, display a form at the top and table at the bottom

texts:
I'm a bit lost trying to create a page with hook_menu that displays a form and a table below it. Preferably the table should only be displayed after the form has been submitted, but that's not the main issue.

I don't have any issue with displaying the table or the form, but I can't get it to be displayed at the same time on the same page.

I have a my_module_table() function that ends with

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

I then have a function for the form my_module_form($form, &$form_state)

I then have this function to put both of these functions in an array

function my_module_page() {
  $output = array();
  $output['form'] = drupal_get_form('my_module_form');
  $output['table'] = 'my_module_table';
  return $output;
}

Than last I try to create the page and get both the form and the table to render on the page using hook_menu

function my_module_menu() {
  $items = array();

  $items['mymodule'] = array(
    'title' => 'My module',
    'access callback' => TRUE,
    'page callback' => 'mymodule_page',
  );
  return $items;
}

I don't have any issues with the form or table functions, they work fine if I don't try to render both at ones.

Can anybody tel me what I'm doing wrong?


texts: When I create a page and add a menu link, it appears above the existing menu items (in the menu tree). Can this be changed so that new items flow under existing items?