texts:
The group module is an alternative to the og module.  The og module allows you to assign permissions to fields per group.  I would like to be able to do the same thing with the group module.  It appears that in order to do this, I need to add a field or fields as an entity in the Group module. All my searches seem to indicate that the GroupContentEnabler plugin will enable me to do this. But I can't find any clear example of how. Can someone point me to some documentation on how to go about coding this?

Follow up:

It appears that hook_entity_field_access() will allow me to do what I wish to do.  I found an example of it's use in the group module:

This is the code used in group.module (not gnode.module):

/**
 * Implements hook_entity_field_access().
 *
 * {@inheritdoc}
 *
 * @todo Move this to a form controller so we can hide the field if it has no
 *       options available to it?
 */
function group_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
  // Can't retrieve an entity from an empty item list.
  if (!isset($items)) {
    return AccessResult::neutral();
  }

  // We only care about the group_roles field when on a form.
  if ($field_definition->getName() != 'group_roles' || $operation !== 'edit') {
    return AccessResult::neutral();
  }

  **// We only care if it is attached to a group content entity.
  if ($items->getEntity()->getEntityTypeId() != 'group_content') {
    return AccessResult::neutral();
  }**

  /** @var \Drupal\group\Entity\GroupContentInterface $group_content */
  $group_content = $items->getEntity();

  // We only care if the group content entity is a group membership.
  if ($group_content->getContentPlugin()->getPluginId() != 'group_membership') {
    return AccessResult::neutral();
  }

  // Now that we know we're dealing with a group_roles field on a group
  // membership form, we need to check whether the group membership belongs to a
  // group yet. If not, we can't check for access and should always hide it.
  if (!$group = $group_content->getGroup()) {
    return AccessResult::forbidden();
  }

  // Only group administrators should be able to change the membership roles.
  return AccessResult::forbiddenIf(!$group->hasPermission('administer members', $account));
}

It appears that all I have to do is create a group permission, then check access to the field in question against that permission using hook_entity_field_access().

My only question is with this code:

// We only care if the group content entity is a group membership.
  if ($group_content->getContentPlugin()->getPluginId() != 'group_membership') {
    return AccessResult::neutral();
  }

Let's say I create a custom field called "my_test_field".  And, I create a group permission called "access test field".  I then change above code:

// We only care about the the my_test_field field.
          if ($field_definition->getName() != 'my_test_field'
...
...
// Only users with 'access test field' should be able to see my_test_field.
  return AccessResult::forbiddenIf(!$group->hasPermission('access test field, $account));

If this field is attached to a node that is in a group, I am assuming that it is now attached to the group node entity.  But what about this?:

 if ($group_content->getContentPlugin()->getPluginId() != 'group_membership') {

Is the field also now automatically a group membership?  I guess I don't understand what that means in this context.


texts: Move file to specific folder after upload in forum

texts:
I am using Drupal 7 with Organic Group and Forum Module.

I have added facility to attach files in Forum posts. Now after forum(node) is submitted, I would like to move the file (which is with forum node) to specific folder.

Actually I would like to move/copy to other folder during node submit only, is is possible with hook_node_submit()


texts: Form is not submit handler is not called

texts:
I have this code for calling a form and than submit it..

<?php
// hook_menu
function pricepackages_menu()
{
    $items = array();
    $items['membership/packages'] = array(
        'title' => t('Manage Membership Packages'),
        'page callback' => 'drupal_get_form',
        'page arguments' => array('pricepackages_form'),
       //'access callback' => TRUE,
       'access arguments' => array('access administration pages'),
    );
    return $items;
}
// FORM SHOW HOOK
function pricepackages_form($form, &$form_state)
{
    $form = array();

    $form['packagename'] = array(
        '#type' => 'textfield',
        '#title' => 'Package Name',
        //'attribute' => array('class' => 'package'),
        '#required' => TRUE,
    );
    $form['packageDescp'] = array(
        '#type' => 'textfield',
        '#title' => 'Package Short Description',
        //'attribute' => array('class' => 'package'),
        '#required' => FALSE,
    );
    $form['price'] = array(
        '#type' => 'textfield',
        '#title' => 'Package Price',
        //'attribute' => array('class' => 'package'),
        '#required' => TRUE,
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
    );
    $form['submit'][] = array('package_get_form'=> array());

    return $form;
}

function package_get_form($form, &$form_state)
{
    drupal_set_message('working');
?>
    <script language="javascript">
        alert("aaa");
    </script>
<?php
return;
    }
?>

but this one is not wokring proerly and form is not being submitted on the specific form...
neither its showing alert or message...

please help me...


texts:
I made a module for displaying nodes(links) from database. And I have simple question, why are the links displayed in the navigation menu? I want to be displayed in a separate menu (like navigation menu with my custom title etc etc...), but whatever I do they show up in the navigation menu.

function test_menu(){

$items = array();

  $items['test1'] = array(
    'title callback'   => 'test_callback1',
    'page callback'    => 'test_output1',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
  );

      $items['test2'] = array(
    'title callback'   => 'test_callback2',
    'page callback'    => 'test_output2',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,

  );
       ..... etc etc
      return $items;
}

This is page-test.tpl.php

<?php
 print $content;
 ?>


texts: Combine fields that has same value in views

texts:
Current view

What I want to achieve

The data are from 2 different entityforms. And then I merged them in my view.
As you can see, in date row, two data(05/29/2014) has the same value.
I want to merge the same value then the field of the 2nd date will align to the first date.


texts: I have used Drupal7 and I want to add Arabic date in Hijri formate; I have used the Calendar Systems module, but it doesn't add dates as block. How can I implement hook_block() to show dates in Hijri format?


texts:
Are there any modules for custom menu positions like Menu position for D8?

I am trying to make custom content types that show up in various places in menus based on certain rules.

For example, content type "main navigation item" shows up under the main navigation menu.

A second content type "landing page" has an entity field that defines its parent in "main navigation item" and accordingly shows up nested inside that menu item.

Alternatively, if there are suggestions to go about it differently, I'd love any advice!


texts: Is there a node hook that runs AFTER a node is fully inserted into the database?

texts: I want to run some code after a node is inserted into the database.  hook_node_insert() is close, of course, but as the doc says, "when this hook is invoked, the changes have not yet been written to the database, because a database transaction is still in progress".  Is there a hook that I can implement that give me access to the newly-inserted node after it's completely in the database?  hook_path_insert() does this, and is related to what I want to do, but it's not optimal for all sorts of reasons.  Thoughts?


texts: Change no results behavior of the result of a link generated from a view

texts:
I created a view that displays links to all of the terms in one of my vocabularies, which was easy enough, but now I am having trouble with what happens when one of those links is clicked.  By default, it will show all content tagged with those terms, which is right, but I want to change the no results behavior when there is not content tagged with a term.

I'm confused as to where I would change the no results behavior for this, do I have to create a separate view, or is this to be done in the view of listing taxonomy terms?


texts: Can I have Composer or something else download a Git repo as a dependency of my contrib module?

texts:
I'm working on a module and there is a sub module for scanning barcodes that requires this, quagga.
Currently you have to manually download the library and put it into the libraries dir. If I add this as a dependency to the module you cannot install it without doing this first.

Can I have composer or something download a git repo to the libraries when installing the submodule?

Edit:
libraries.yml

form:
  version: VERSION
  css:
    layout:
      css/commerce_pos_barcode_scanning.css: {}
  js:
    js/commerce_pos_barcode_scanning.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - commerce_pos/quagga
quagga:
  remote: https://github.com/serratus/quaggaJS.git
  version: 1.0.0
  license:
    name: MIT
    url: https://github.com/serratus/quaggaJS/blob/master/LICENSE
    gpl-compatible: yes
  js:
    /libraries/webrtc/adapter-latest.js: {}
    /libraries/quagga/quagga.min.js: {}

install.yml

function commerce_pos_barcode_scanning_requirements($phase) {
  $requirements = [];
  if ($phase == 'install' || $phase == 'runtime') {
    $path = 'libraries/quagga/quagga.min.js';
    if (!file_exists($path)) {
      $requirements['commerce_pos_barcode_scanning'] = [
        'title' => t('POS Barcode Scanning'),
        'description' => t('To scan barcodes, you need to install the quagga JavaScript library. How To'),
        'severity' => REQUIREMENT_WARNING,
      ];
    }
    else {
      $requirements['commerce_pos_barcode_scanning'] = [
        'title' => t('POS Barcode Scanning'),
        'severity' => REQUIREMENT_OK,
        'value' => t('quagga JavaScript library has been configured.'),
      ];
    }
  }

  return $requirements;
}


texts:
I am developing a Drupal 7 site, where i store the content of a cotent type(with several fields).
So by default, i enter the English text for the content and save it.

Is it possible in Drupal to automatically translate the content in English to other languages like French, Spanish, German, etc? I have been experimenting with several modules like Content Translation, which provide the option to enter content manually in other languages. But i don't like to enter the content separately for each language, rather i like to automatically translate it with the click of a button. Is there such a module or feature in Drupal 7 ?

As a final alternative, i thought to use an API like Google Translator in the background, when saving my node content, but i hope there is a module available for automatic content translation.

Note: I am not interested in using any widget on the front end, for content translation. Instead, i prefer admin to translate content with one click in the backend.


texts: How to display IMCE file browser in overlay or popup window?

texts:
When users access the IMCE file browser from their user profile it gets integrated in the websites main content. I want it to be displayed in the administrative overlay or even as a popup. Does anyone know how to do that?

I have checked the configuration settings, but it doesn't seem to be that easy, or I overlooked something. I also checked the module ThemeKey, but I think that would be a little overkill.

Any help would be appreciated!


texts: Is there a way to create and print a quotation by site admin in drupal commerce?

texts:
I have drupal commerce site, I want to create a quotation  for some cutomers who won't to buy from the site.
For now I create a user and an order with 'in cart' statut for this user and I print it with the browser.
Is there a way to create  that with a correct way, a custom quotation with a print button?


texts: Drush Config Export not working after Site-install Standard

texts:
I have a Drupal starter site created and pushed to bitbucket. For every new project I start I clone this site and start working from there. It worked for a while but I'm trying to get it to work for a new site and I can't.

The Drupal starter is running Drupal 8.5.3 and I am using Drush 9 on my machine. To get the clone to work I do the following:

git clone https://example@bitbucket.org/example/[repo].git

git checkout dev (my working branch)

composer install

cd web (drupal root)

drush site-install standard --db-url=mysql://{db_usr}:{db_pass}@localhost/{db_name} --config-dir=../config/sync

After the install the configuration is imported automatically and that is where it is going wrong. I get the following error:

[error]  Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in Drupal\Core\Config\ConfigImporter->validate() (line 736 of /web/core/lib/Drupal/Core/Config/ConfigImporter.php).
 [error]  The import failed due to the following reasons:
Unable to install the standard module since it does not exist.
Unable to uninstall the Minimal profile since it is the install profile.
Cannot change the install profile from minimal to standard once Drupal is installed.

So looking in to this error I find the following thread #278877. But this patch doesn't seem to work for me.

What I tried is to install the site, after the composer install, via the browser. And for some reason this does work.

I know I can do it via the browser from now on, but I really want to know what is going wrong. I prefer to use command-line over the browser.

Something else I noticed is that in the settings.php file, after installation, there is a line with $settings['install_profile'] the value of this setting is 'minimal' when using the drush site-install even when I'm saying it should use the standard option. When I use the installation via the browser the value is 'standard' and for this reason does work.

I tried changing the settings.php from minimal to standard manually. And tried changing the core.extensions config file as mentioned in some other threads I found but nothing works. Bij core.extensions file is not the problem I think both the standard: 1000 and profile: standard are there.

Am I doing something wrong? Has something changed since drupal 8.5 or drush 9 (instead of drush 8 - I just updated)? Or is this a bug?


texts:
Is there a way to find out the stock level of an Ubercart product on a given date?

I can a) get the total number of items sold between a given date and today, and then b) subtract that number from the current stock level. That's not very useful, though, since the client will likely update the stock level in the interim.

If Ubercart logged changes in stock, something like this, then I think I'd be good to go:

| nid | stock_level | datestamp  |
----------------------------------
| 23  | 15          | 1303707600 |
| 23  | 25          | 1327471200 |


texts:
I've set up cloudflare caching of Drupal's frontpage by adding a Page Rule for my Drupal base URL, with a "Cache Everyting" setting (otherwise, caching is enabled only for certain file extensions). I've installed the Cloudflare module, and enabling $conf['reverse_proxy'].

However, it seems that after authenticating, users see the anonymous homepage. If I go to /drupal/user, I see the user's page (so I know login works). I don't understand how this happens, since the Drupal anonymous pages are supposed to set 'Vary: Cookie' (which Cloudflare supposedly obeys), and authenticated users should send a session cookie.

Is anyone using cloudflare successfully for dynamic content? What settings would help? Any ideas?

NOTE. I haven't set conf['omit_vary_cookie']. Debugging with curl -I shows the appropriate Vary: Cookie,Accept-Encoding. Under Firefox, after authenticating, a request to /drupal/ sends a session cookie.


texts: Moving site to another domain, install appears

texts:
I move the website to another domain on the same server, by copying all files to the other domain's folder.
When I visit the new domain the install.php appears. Trying to navigate to another page like /user/login redirects to the installer as well.

I don't think I need to change database settings because it's on the same server.

Any ideas why?


texts: High CPU Usage From Repeating Dates/Calendar

texts:
My client just discovered that when he publishes 4-6 events that repeat throughout the year/weekly the website becomes really slow to the point of which the server goes down. He even received an email from the hosting company saying that there was a high percent of CPU usage. They lowered his CPU limit from 20% to 10%. In the email it showed that the public_html was using more than 90%.

How can we fix this?


texts:
I created a content type with 3 file fields, and I want all fields to have a specific link.

For example:

file field :file281
file field :file282
file field :file283

Because, I want put background image on this fields. How can I do this?


texts: Looking for a strategy to optimize a big body field on a node

texts:
I'm using Drupal 8.4.x

I have just one node with a big text on its body field (about 2.5 MB). Looking a strategy to optimize:

Page load. Does exist any "content lazy loading" module? (I can see one for D7 but without a stable release).
I'll like to create revisions on this node. I'm gonna use Diff module to see changes and also to enable visitors to see those changes. This a consuming task on a big node and not sure how to cache/optimize those Diffs.

Note: I've tought about spliting the content in different nodes (like a book) and then use something like Views Infinite Scroll but I'll find hard to implement 2 with this aproach.


texts: How to sort name by alphabetically in drupal views?

texts:
I have created view in this drupal 7 views,there are Two pages are created in that view.

page 1:Images page
page 2:List view page

here i have tried in List view page by using sort criteria of Name field(ASC or DESC). but Names are sorted in List view page correctly.

When i am click Name field for sorting in second page(List view) automatically that fields are sorted in first page(Images) page also.
That sorting is not working in views.
First page taking only default sorting order.

Here is screen shorts

Here sorting values are not stored database permanently.If i click refresh button views default sorting behavior is added to that pages.
Is it possible to sort the two view pages permanently?


texts: Filter nodes matching user account field [list (text)] using different field names but same key

texts:
There is a field of type list (text) [field_list_user] on user accounts and a field of type list (text) [field_list_node] on nodes. Both fields have exactly the same keys but different labels [and field names]. Any content of the site can be authored by users.

Is it possible to create a block with nodes for a currently logged-in user filtered like: value (key) of field_list_user = field_list_node?


texts: block_html_id for view comes with uuid drupal

texts:
I am not sure but to my understanding the block_html_id for the views should be with the patter of block-views-NAME-OF-VIEW-MACHINE-NAME, however it is coming up as block-views-UUID...i am guessing it is uuid some kind bunch of letters and numbers. Is this a bug? or this can be configured. The problem with the block-views-UUID pattern is that i am unable to use it in the preprocessor functions such as THEME-preprocess-block()

Any help is much appreciated. Thank you

Env: Drupal 7.26, views 7.x-3.7


texts:
I have a content type and it has a select list field. There are two options Yes or No and this field is not a required field.

The website has about 100,000 nodes and I want to bulk update all nodes in order to select the "Yes" for each node. Is there any way to do this?


texts: Upload file and fill in fields in one step; or trigger a rule when a file is uploaded

texts:
I want to make use of the Media module and the File entity module to upload files, in particular images, to my site without having to attach them to a node. Solely uploading images works like a charm, as the Media module automatically places an "add file" link within the navigation menu.

I also added a couple of fields to my image file type. Unfortunately, the Media module doesn't allow me to choose the image file and fill in the fields at the same time, and then submit. Instead, I have to upload the file, go back to the file, click on edit and fill in the fields afterwards, which in my opinion is pretty annoying.

I am not sure if this issue can be resolved somehow. If it can not be, this could be a workaround:

When I upload a file, a rule is triggered that sends me to the edit page. This way uploading the image and filling in the fields somewhat forms a unit.

However, the Rules module does not offer to react on file uploads.

Does anyone have an idea how to get around this issue?


texts: Creating a vanilla instance from a site already set up

texts:
I have a Drupal site which is set up, running and being continuously used.  It has a variety of content_types, taxonomies and field_collections etc saved in the database.  The plan is to sell on vanilla instances of this Drupal site - which means, clearing out all the content and resetting all table indexes to 1 etc.

Any ideas how to achieve this?


texts: Accessible Checkboxes Using Drupal's Form API

texts:
Im trying to get a set of checkboxes produced via Drupal's form api to pass the WCAG AA accessibility standards, the problem i am facing is with regard to labels and for attributes.

For example i am returning the following form definition via a hook_block_view(), i cant use drupal_get_form as normal as i dont want a form element wrapping the output which means i lose some of the processing that drupal_get_form does which is why i have to add in form_process_checkboxes and am missing some other functionality that gives the individual checkboxes their ID's(which is then used as the for attribute)

$form['tests_taken'] = array(
  '#type' => 'checkboxes',
  '#options' => drupal_map_assoc(array(t('SAT'), t('ACT'))),
  '#title' => t('What standardized tests did you take?'),
   '#attributes' => array(
     'name' => 'example-checkboxes[]'
   )
);

$form['tests_taken'] = form_process_checkboxes($form['tests_taken']);

dsm($form);

return $form;

This produces the following markup.

    <input name="example-checkboxes[]" type="checkbox" value="SAT" class="form-checkbox">
SAT

    <input name="example-checkboxes[]" type="checkbox" value="ACT" class="form-checkbox">
ACT

I need the markup to either have labels with 'for' attributes pointing to the input elements or wrap the input elements with the label tag.

Heres thebest ive managed to come up with so far which doenst seem very satisfying

$form['tests_taken'] = array(
    '#type' => 'checkboxes',
    '#options' => drupal_map_assoc(array(t('SAT'), t('ACT'))),
    '#title' => t('What standardized tests did you take?'),
    '#attributes' => array(
      'name' => 'example-checkboxes[]'
    )
  );

  $form['tests_taken'] = form_process_checkboxes($form['tests_taken']);

  foreach (element_children($form['tests_taken']) as $key) {
       $form['tests_taken'][$key]['#id'] = drupal_html_id('edit-' . $form['tests_taken'][$key]['#attributes']['name'] . '_' . $key);

  }

  dsm($form);
  return $form;

Which now produces this markup

<input name="example-checkboxes[]" type="checkbox" id="edit-example-checkboxes-sat" value="SAT" class="form-checkbox">
SAT

<input name="example-checkboxes[]" type="checkbox" id="edit-example-checkboxes-act" value="ACT" class="form-checkbox">
ACT

Anyone know of a cleaner way of doing this?


texts: How to declare class that extends Drupal d2d Migrate class

texts:
I am trying to follow the guidance from https://www.drupal.org/node/1819738 "Extending migrate_d2d classes".  I am using the Migrate d2d UI.  It brings back the nodes I want to migrate, but there are a couple of fields I need to add.  Essentially I want to extend the DrupalNode6Migration class to add these fields to the source query used by the UI.

I created this class (which appears to be exactly like the example given in the d2d document above):

<?php
class CadeMigrateFields extends DrupalNode6Migration {

  public function __construct(array $arguments) {
    parent::__construct($arguments);
  }

  protected function query() {
    // Get the default query
    $query = parent::query();

    // Get OG stuff as per: https://www.drupal.org/node/2033293#comment-9371471

    $query->leftJoin('og_ancestry','oga','n.nid = oga.nid');
    $query->addExpression('GROUP_CONCAT(DISTINCT og.group_nid)', 'og_group_ref');

    $query->addField('oga', 'group_nid', 'gid');
    $query->addField('oga', 'is_public', 'is_public');

    return $query;
  }
}
?>

This is supposed to include the additinal fields I want in the parent query.  I added the path to this file to my module.info file:

; Migrate from 6.x to 7.x
files[] = cade_fields.migrate.inc

My question is: How do I declare it in the Migrate api so that Migrate sees it and executes it correctly?

If I don't add it anywhere in the api, Migrate doesn't see it. It is ignored and doesn't work.

If I code it as a migration,

   $migrations = array();

   $migrations['CadeFields'] = array(
        'class_name' => 'CadeMigrateFields',
   );

  $api = array(
    'api' => 2,
    'migrations' => $migrations,
   );

  return $api;

I get errors saying that several arguments (source type, description, destination type, etct) are missing.  And it still doesn't work. This missing information should be provided by the arguments passed to the parent query (created by DrupalNode6Migration) by the UI, whose query I am simply trying to extend, not override.

So, how do I declare this type of class so that:

Migrate (d2d) sees it?
Migrate passes the arguments from the parent class (created by UI) it is extending to it?
It extends the parent class query to include the desired fields?

Thanks so much for any assistance!


texts: Is there a way to add a foreign key to a table?

texts:
My question is not regarding hook_schema but regarding hook_update_N: I need to add a foreign key to an existent table in drupal 7.

I was looking Here but it does not seem to exist one explicitly for foreign keys.

Q: How can I create a foreign key in an existent table? Which call should I do?


texts: How can I add extra classes to the title of a node?

texts:
I want to add more classes to the title of a node using the following code.

{{ node.label }}

It doesn't work, despite the fact title_attributes is described as follows.

  title_attributes: Same as attributes, except applied to the main title tag that appears in the template.

I know that is possible to add classes straightly with code similar to the following one.

{{ node.label }}

I'm eager to know the standard way of doing this, and I don't want to miss anything.

My class names follow the BEM Name Convention rules and it's hard for me to break and behave contrary to those rules and change my class names.


texts: Cannot get role information in twig file

texts:
I cannot seem to get the role of the current user in my twig template. I have tried the following:

{{ user.getRoles }}

{{ user.hasRole('content_administrator') }}

and neither return anything.

Notes:

I use a subtheme of radix.
I want to include stuff in the theme if the user has a certain role. Specifically, I have regular viewers and a content admin, and the content admin shall see extra things. I created a view called /revisionhistory which has a contextual link, and shows revisions. The theme should generate a link to /revisionhistory/{{node.id}} if the user has the administer_content role.


texts:
Via the Drupal GUI, I have created the following content types and fields:

ContentType(Company)

ContentType(Site)
    Field(Company) <- entity reference to Company content type

ContentType(Contact)
    Field(Company) <- entity reference to Company content type
    Field(Site)    <- entity reference to Site content type

I'm trying to make a view (via the Views UI) which outputs a table like this:

-------------------------------------------
Company1    Site1   Contact1
-------------------------------------------
Company2    Site2   Contact2, Contact3
-------------------------------------------

I.e if two or more contacts are related to the same Company\Site combination, the output should be one row only, with all Contacts concatenated (with ", " as a separator in the example above).

But all I get is:

-------------------------------------------
Company1    Site1   Contact1
-------------------------------------------
Company2    Site2   Contact2
-------------------------------------------
Company2    Site2   Contact3
-------------------------------------------

Is there any way to get the output I want?


texts:
So I have been setting up my Drupal 8 installation and I'm having troubles with my private folder setup.

I went on to settings.php and specified the path which I wanted for my private folder as sites/default/files/private. It seemed to be working well for a while, but now it isn't.

I have configured Drupal to use the private folder as default location for file uploads and it shows the sites/default/files/privatepath as the private folder path.

Now my issue is that I created a custom content-type with a private folder file upload field. This is for a restricted area I have in the website which I only want authorized (logged in) users to be able to access - both that area, and the files linked there.

The area was successfully blocked via role permissions and works great. The files attached to content - even though the content-type settings are explicitly and correctly set to use the private folder for upload - result in the following behavior:

files served by direct HTTP in sites/default/filesare accessible, regardless of Drupal login state - as intended
files served by direct HTTP in sites/default/files/private are blocked with a 403 forbidden by NGINX regardless of Drupal login state - as intended
restricted files served by Drupal in the restricted area with an URI similar to system/files/YEAR-MONTH don't show Drupal's access denied 403 page (the intended effect), BUT INSTEAD:

if they are images, I get an NGINX 404 NOT FOUND error page
if they are other file-types, they are accessible without restriction (exactly what I'm trying to prevent).

Right now I'm lost as I've been searching around for answers on these issues, but I can't seem to find them.

I'm using a shared web server setup in which I don't have direct access to NGINX's .conf files. I'm also using the IMCE File Manager module. I think that the images issue is related to some NGINX conf and as such I'll have to contact the web server maintainer to fix it, but I'd like to have some insight to share with them about this. Also, what can possibly explain the files being uploaded to the private folder being accessible without any restriction?

Any help would be very welcome, thanks!


texts:
I'm using Drupal 7 with views 3.

I need a list of students who have due payments in a view. The students who have paid the fees are stored in a new table. Now I want to show the students which are not in other table. How can I have this is views 3

EDIT Better explanation of query

I am using views 3 to get a list of students who have due payments. The students who have paid the fees are stored in a new table. Now I want to show the students which are not in fees paid table. How can I have this is views 3.

My Table structure is:

I have a table structure for fee details as

fid
name
description
currency
fee
instalments
created

This fee schedule has N no of instalments and storing in a cross ref table as

iid
fid
instalment_no
amount
payable_by

This fee schedule has associated students and are storing in a cross ref table as

fid
uid

The table structure for paid students who has paid fees.

pid      Payment ID serial
fid      Fees ID details
iid      Instalment No
uid      Student who has paid the fees
paid_on  Payment date

Thanks in advance for your help.


texts: Exclude configuration from import/export

texts:
I thought this was a simple use case of the new Configuration management system, but I haven't had any luck finding out how to solve this:

Problem

I want to store configuration in git and use drush to export configuration during development and then on deployment import the configuration. Pretty similar to doing a features revert in Drupal 7. My problem is that I don't want to store access codes in git for various integrations. This results in these configurations being deleted on
$ drush cim -y

Where I looked

I was hoping there would be a simple list/configuration for configs that should be excluded on import/export. It seems there was at some point but it must have been removed again, since it's available at present Drupal 8 release.

I looked into how config changes are being made comparing the active and sync storange to see if there as a place where I could remove changes, this didn't seem to be the case.
I looked at how drush does the configuration import as it has some configuration excludes of it's own, but it didn't look like this was extensible.
I looked at ConfigEvents, but these all seem to happen after an import, so doesn't look like this can be used.

Am I missing something, or is it not possible to simply exclude configs from import/export?


texts: Firefox is caching ajax form values from previous submit after if I press the browser back button

texts:
I've implemented a custom multistep AJAX form like:

STEP #1
Question 1: A or B (radiobutton Ajaxified) -> AjaxCallback: step + 1

STEP #2
Question 2: C or D (radiobutton Ajaxified) -> AjaxCallback: step + 1;

STEP #3
Question 2: E or F (radiobutton Ajaxified) -> redirect to other page (ajax command)

Everything works as expected but after being redirected to the new page if I click the browser back button in firefox the form shows the first step with the option [A] selected of the first step. This does not happen in Chrome.

I'm running Firefox 54.0.1

Does it make sense to anyone? How could I fix it?

Thanks in advance!


texts: Create a link to a private file from just a file id?

texts:
I am building a controller that returns a rendered HTML Response object to an AJAX request in the theme. I need to display a button that contains a link to a private file. I tried to mimic what the System module does, but this code seems like a lot just to generate an accessible private file path:

  /**
   * Returns a render element for the download paper link.
   *
   * @param int $id
   * @return \Drupal\Core\Link
   */
  protected function getDownloadLink(int $id) : Link {
    /** @var \Drupal\file\Entity\File $file */
    $file = $this->entityTypeManager->getStorage('file')->load($id);

    $url = Url::fromRoute('system.private_file_download',
      ['filepath' => str_replace('/system/files/', '', $file->createFileUrl())],
      [
        'absolute' => TRUE,
        'path_processing' => FALSE,
        'attributes' => [
          'class' => $this->button_classes,
        ]
      ]
    );

    return Link::fromTextAndUrl('Download Paper Anyway', $url);
  }

Is there a simpler way of obtaining a file path from the file object to satisfy the route parameter here?


texts: Why ConfigFormBase does not goes through custom construct() when using managed_file?

texts:
First I want to state that this is a question. My Form is working, but I had, strangely, to add clauses for the case when my CustomForm extending ConfigFormBase did not goes as expected throught the __construct()
I created a config property in the __construct(). Then, I could access it from any function, and it worked fine.
As soon as I added a managed_file, things went wrong. Specifically, $this->config was null in validateForm and submitForm. I could restore the property easily by calling the factory again (and that's what I end up doing), but I'm confused.
What I see is the managed_file module send the form in XHR when updating the managed_file input. So when I'm validating the form, maybe there is a cache version or something that gets loaded, or the callback_func works differently. Anyway, the __construct() is executed on the XHR request (I checked with xdebug) but not after when I'm (re) submitting the form with the button.
I compared the stack when $this->config is null and when it's not, and did not spot any difference.
Maybe it's part of a multi-part Form functionality ?
I'm sure I'm getting it wrong somewhere.
Relevant parts as follow :
  /**
   * Constructs a \Drupal\system\ConfigFormBase object.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->setConfigFactory($config_factory);
    $this->config = $this->config('custom.settings');

    parent::__construct($config_factory);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('config.factory'),
    );

     }

/**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state): array {

    $form['section5'][self::TAB_IMAGE] = [
      '#type' => 'managed_file',
      '#title' => $this->t("Image de l'onglet"),
      '#default_value' => ($this->config->get(self::TAB_IMAGE)) ? [$this->config->get(self::TAB_IMAGE)] : NULL,
      '#upload_location' => 'public://',
      '#upload_validators' => [
        'file_validate_extensions' => ['gif png jpg jpeg'],
        'file_validate_size' => [Bytes::toInt(Environment::getUploadMaxSize())],
        'file_validate_image_resolution' => ['300x300'],
      ],
    ];
}

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    // When submitting a Form with managed_file, weirdly no __construct().
    if (!$this->config) {
      $this->config = $this->config('custom.settings');
    }


texts: Ubercart conditional payment, no stock level data

texts:
I have Ubercart up and running on Drupal 7 and I would like to add a condition to a payment. The condition would be that if one of the products in cart is currently out of stock, then won't let the payment method.

The problem is that there is no stock level in the data selector. How could I do this?


texts: How to get the active #comment-cid when a comment permalink is clicked?

texts: I am trying to get the comments on my website to change color when they are active. More specifically, I am looking to do something very similar to what StackExchange sites do when you click on a notification in your inbox (like this). So what I initially tried to do, was to wrap the comment class in another div class called comment_active using an if statement to see whether the current page url contained the string "#comment-". (being that the permalink for a comment is /node/nid#comment-cid I am trying to get drupal to know what the current cid is) I am having some problems figuring out how to do this. Is placing, for example #comment-1 even part of the url? or does it just bring you to the part of the page that contains that element id? is there a way that I can have the comment.tpl.php know whether a comment is active? Or should I be doing it some other way entirely?


texts: How can I collect data on authenticated versus anonymous traffic?

texts: One of the important metrics I miss while planning for performance optimization is the type of traffic my site is receiving. What are the ways for collecting data about the type of traffic? I am mostly interested in anonymous versus authenticated requests.


texts:
I'm able to load node create forms like so

$node    = \Drupal\node\Entity\Node::create(['type' => 'avenue']);
$content = \Drupal::service('entity.form_builder')->getForm($node);

return $content;

However what if I want to load an edit form for a pre-existing node? I looked on this page https://api.drupal.org/api/drupal/core!modules!node!src!Entity!Node.php/class/Node/8.2.x but I can't find anything that would relate to the edit form. Is there a way to load the edit form for a specific node?


texts:
I'm trying to install drush 8 via composer:

composer global require drush/drush:dev-master (source)

but it gives me drush version 7.0.0 which is without D8 integration...
I'm using Linux Mint 17.


texts: How to create entity relation of counselor to client?

texts: I'm trying to create a relation in D8 between a counselor and clients.  The counselor would have to record counseling hours for each client.  I've looked at the group module, even building the relation using RedHen CRM.  Just curious, anyone have suggestions?


texts:
I use get_class_methods to get classes for Drupal classes, for example I go to devel/php and run:

$coupon = \Drupal::entityTypeManager()
  ->getStorage('commerce_promotion_coupon')->load(3);

ksm(get_class_methods($coupon));`

But If I want to get list of classes for some vendor library I don't know how to get them.


texts: How to use the uc_csv module for getting reports

texts:
I am using the ubercart module for purchasing products. I want to export the order records/history as csv file and view it in spreadsheet. So I searched and got the uc_csv module. I have installed the module for Drupal 7. When I click the csv export link from store administration option it shows:

  "THERE ARE CURRENTLY NO CONFIGURED EXPORT REPORTS".

How can I configure this option? Please suggest some ideas.


texts: Metatags and Commerce - pass taxonomy metatags to commerce product view

texts:
I have a Commerce Product view that pulls in products based on a taxonomy term in the url (category/taxonomy-term).  This is done using relationships.  Ideally, I would be able to edit metatags for each individual term (which I can) and have those metatags populated on the view page (which I can't figure out).

If I create a metatag default for taxonomy term, it works correctly on /taxonomy/term/%tid, but not category/term-name.  If I create a metatag default for that view, I don't have access to the metatags as token replacement values for the term being used.  There is a [metatags:description] token, but it is empty when using it on the view.

Thanks for any direction/insight/help!


texts: Drupal7 and Hiphop Missing index.php in the Urls

texts:
I built and installed HipHop VM based on the steps from https://github.com/facebook/hhvm/wiki/building-and-installing-hhvm-on-ubuntu-12.04

I am running Drupal7 and Ubuntu 12.04. Everything works fine but when I click on a link in the page the resulting URL is missing index.php in it.

For example when I click on a link for adding node, the url in browser is http://10.11.x.x:9001/?q=node%2Fadd& and it is resulting in a File Not Found

Can I handle this using Drupal or is it something that I need to tweak in HHVM.


texts: How to remove blocks as a Context reaction?

texts:
I must be missing something here, I hope someone can shed some light on this, but I can't see how to remove blocks when using the Context Reaction - Blocks on the context configuration screen.

I can add blocks using the checkboxes and the add buttons, and I can remove them once added but how do you remove blocks that are already being rendered?

thanks

Jack


texts: Save language preference for future visit

texts:
I would like to achieve this:When a user selects a language in a multilingual site,when he visits this site into future,the site remembers its language previous selection and shows this language for the user.
Is there a module for this or I need to write something with cookies?
thanks


texts:
I am trying to add a new text field to the menu in Drupal 8, and I have done it using the instruction in the following post:

Add field(s) to menu link?

function my_module_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface
$entity_type) {
  if ($entity_type->id() === 'menu_link_content') {
    $fields['location'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Location'))
      ->setDisplayOptions('view', ['label' => 'hidden', 'type' => 'string', 'weight' => 0, ])
      ->setDisplayOptions('form', array('type' => 'string', 'weight' => 0));

    return $fields;
  }
}

But I am not sure how to go about using hook_update_n to update the schema to reflect this change.

function menu_link_content_update_8201() { 'what do I put here to add the new field that I created'? }

I was able to workaround this issue by manually adding the location column in the mysql db and I can see the field showing up in the menu link editor and able to load and save it just fine in the cms UI.

But then I am not sure how to access this field in the twig file.

Any help would be grateful.  Thanks!


texts: Generate unique barcode for each registered user

texts:
I'm using D7 and I would like my website to create unique barcode for each user when they register an account, and send the barcode to them through email. This barcode should be part of their profile.

I found that "Barcode" module can generate barcode in a page, but I'm not sure how to use this module to create barcode for user. Is there any way I can modify the codes to do this?

Just some background information:

I need a barcode generated to each user as I want to scan it in mobile as taking attendance when web admin is having an event. After event ends, web admin will export the attendance list in excel or any document style, to check on the attendance detail (name, userid, date, scanned barcode)

Anyway the scanning and retrieving list is mobile app issue. I need to start with generating barcode first.

Any suggestion on this?


texts: Multilingual Panels does not allow content translation

texts:
Drupal 7.26
Multilingual Panels  7.x-1.0
Panels  7.x-3.4
Domain Access   7.x-3.11
Domain + I18n Variables Integration   7.x-1.0

Hello, I am attempting to use Multilingual Panels to translate panel content.
I followed the instructions given by the Multilingual Panels module owner, but when
I try and translate panel content I get an error in the "Configure Content" section:

"You can translate settings for different languages, but you must set Multilingual Standard as display renderer in order to see result."

Here is the error when I view content on a page. Note the "Default", "English", "Spanish".

If I click on "English" or "Spanish", I get this error:

I did set the Multilingual renderer for this particular Page.

If you go to Panels-->Settings you can set the default renderer. It has been set.

Oh, I also have both english and spanish hooked up through configuration-->regional and language->language.  I am also translating non panel content as a confirmation that spanish and english are set up.

Anyone know why it would be doing this?

Thanks,

David


texts: How can I turn a list of Aliases into a menu structure?

texts:
I'm in a massive migration from a home grown CMS. So far I've been successful at using Feed Import to slurp in CSV exports of the old MySQL database. The old database contained page URLs. So I just mapped this over to Page Alias!

Now I'm searching for a more automated way to take this

/program/science/thesis
/program/math/core_requirements
/program/science/projects
/program/literature/great_works_collection
/program/literature/great_authors_showcase

into a menu structure like this:

Navigation Menu
+- Program
  +-science
    +-thesis
    +-projects
  +-math
    +-core_requirements
  +-literature
    +-great_works_collection
    +-great_authors_showcase

Yes, I could do this manually, but I have over two thousand imported pages.

Is there an Alias URL to Menu structure script or module that may help me along?

Update:

Based on feedback below, I decided to pull a list of URLs from the CSV file using the following pipe line. That is, I pulled only 5th column (the URLs), sorted the output, filtered urls that had "/programs/", and cut off the trailing quote

awk -F ',"' '{print $5}' programs.csv | sort | grep programs | sed "s/\"//g"

After that was exported to a file, a ran the following to generate the child items of the menu:

cat programs.just.urls.txt | awk -F '/' '{print $3}' | egrep -v "php$" | uniq


texts:
For some reason CRON seems to be deleting all 404 errors reported at

admin/reports/page-not-found

Is there any way to disable the deleting of the 404 errors?


texts: added to Views header (global unfiltered text) disappears with inspect element

texts:
I'm trying to wrap a  tag around some content in my View header but it's not working as intended.

I'm using the Global: Unfiltered text as the type of header content. I'm inserting the div like so:

header

It saves it alright and when I go back and view it it's still in there...but for some reason it doesn't show up in the HTML when I inspect element. The h2 tag shows up but not the div wrapped around it.

Thoughts on how to fix this?


texts: Can't create foreign key using SCHEMA API

texts:
I am trying to create 2 tables, linked together, using this code:

$schema['parent'] = array(
    "fields" => array(
        "id" => array(
            'description' => 'The primary identifier',
            'type' => 'serial',
            'unsigned' => TRUE,
            'not null' => TRUE,
        ),
        'data' => array(
            'description' => 'The stored data.',
            'type' => 'varchar',
            'length' => 255,
            'not null' => TRUE,
            'default' => '',
        ),
    ),
    'primary key' => array('id'),
);

$schema['child'] = array(
    // {{{fields

    "fields" => array(
        "id" => array(
            'description' => 'The primary identifier',
            'type' => 'serial',
            'unsigned' => TRUE,
            'not null' => TRUE,
        ),
        "parent_id" => array(
            'type' => 'int',
            'unsigned' => TRUE,
        ),
        'data' => array(
            'description' => 'The stored data.',
            'type' => 'varchar',
            'length' => 255,
            'not null' => TRUE,
            'default' => '',
        ),
    ),
    // }}}
    'indexes' => array(
        "parent_id" => array("parent_id"),
    ),
    'foreign keys' => array(
        'parent_id' => array(
            'table' => 'parent',
            'columns' => array('id' => 'parent_id'),
        ),
    ),
    'primary key' => array('id'),
);

foreach ($schema as $key => $value) {
    print $key . "\n";
    db_create_table($key, $value);
}

The tables are created, but the foreign keys are not. Using MySQL/InnoDB. How to fix it?

Also how to set ON DELETE CASCADE and ON UPDATE CASCADE?


texts: How to trigger the click on the field collection button "add another item" using jQuery

texts: I want to trigger click on "Add Another item" button of field collection on some jQuery event.


texts: Standards/recommendations for Drush make files included in contrib modules

texts:
What are the standards/recommendations for Drush make files that are included in contrib modules? Specifically, should these make files be included by default (module_name.make) or not (module_name.make.example)?

If they should be included, what is the recommended/supported method of overriding/ignoring them? Is there any documentation to point module maintainers to when discussing this in their issue queues?

EDIT: Found this post by jhedstrom from June 2012 recommending naming make files with '.example' suffix. Is this still the recommendation, or have things changed since then?
https://drupal.org/comment/6160018#comment-6160018


texts: Is there a module that saves the node while you are creating it?

texts:
I have a blog, I write blogposts everyday. Today I was creating a blog post, I was almost finished, but for some reason my computer turned off. I lost all that I had in my article I have to write it again.

Is there a module or something that saves the node while you are creating it?


texts: Dynamically added params for a link not found when the link is opened with a dialog

texts:
I do not know if it has to do with JavaScript/Ajax or with Drupal's dialog modal. Any advice is appreciated.
On our project we open several links in a modal. For this the link is rendered in the following way:
$classes[] = 'use-ajax';
$renderArray = [
  '#title' => $text,
  '#type' => 'link',
  '#url' => Url::fromRoute($route, $route_params, $url_options),
  '#attributes' => [
    'class' => $classes,
    'data-dialog-type' => 'modal',
    'data-dialog-options' => json_encode([
      'width' => '95%',
      'dialogClass' => 'ui-dialog--form'
    ]),
    'rel' => 'nofollow'
  ]
];

This works as desired: The link is opened in a modal window.
We want to add query parameters to these links dynamically, using JavaScript. This is done by JavaScript in the following way.
$(document).ready(function() {
  let positionParameter = getParameterByName('position');
  if (positionParameter) {
    let link_target = $('.politician__questionform__button a.button').attr('href');
    link_target = updateQueryStringParameter(link_target, 'position', positionParameter);
    $('.politician__questionform__button a.button').attr('href', link_target);
  }
})

or in this way:
Drupal.behaviors.addParametersToQuestionFormLink = {
  attach: function () {
    let urlParams = new URLSearchParams(window.location.search),
      pk_campaign = urlParams.get('pk_campaign'),
      pk_kwd = urlParams.get('pk_kwd');
    if (pk_campaign || pk_kwd) {
      document.querySelectorAll('a.js-add-parameters').forEach(link => {
        let link_target = link.href;
        if (pk_campaign) {
          link_target = updateQueryStringParameter(link_target, 'pk_campaign', pk_campaign);
        }
        if (pk_kwd) {
          link_target = updateQueryStringParameter(link_target, 'pk_kwd', pk_kwd);
        }
        link.setAttribute('href', link_target);
      })
    }
  }
}

In both ways the following can be seen:

The links get the correct parameters
When I open these links in a new browser tab the controllers which are used for these links receive the parameters as desired
But when the links are opened by simply clicking on the link which opens the link in a modal the controllers do not get the parameters set by the JavaScript code.

I bet it has something to do with the fact that the link's href attribute is changed after the document was ready but I thought Drupal's dialog / ajax would use the href attribute value as it is when the click event fires - not the value as it was set on the initial document loading / rendering?! What can I do to make the links have the parameters even when opened via ajax/ modal?


texts: IMCE browse server image upload button not displaying on ckeditor toolbar

texts: I just installed and enabled IMCE for drupal 7 and assigned the IMCE icon in the full html input format page, but the icon is not appearing in the ckeditor toolbar. I even set the permissions for the IMCE.


texts: Render a drupal form retrieved by drupal_get_form

texts:
In Drupal 7, I have a preprocess function retrieving a form like so:

$contact = drupal_get_form('privatemsg_new');

$contact is then a fully populated form array with the right fields and elements. After that, I tried drupal_render and render, but neither one show a themed output in the node. What do I have to do to display the form?


texts: restrict user from certain role to change their email

texts:
Is there any way I can restrict users from certain role to change their email address. Once they are registered I need them no to be able to change it in the edit settings page. I found how to restrict to change the username but not the email.

I am using Drupal 7. Thanks in advanced :)


texts: Overriding region theme file for user profile pages

texts:
I am on D7 using Omega as a base theme. The <h1> tag of my theme can be found in the region--content.tpl.php theme file.

But I want to override this theme in one specific situation: on the user profile pages, I don't want the title to be set on region--content.tpl.php. I will take care of the title on the user-profile.tpl.php theme file. So what I want is a theme file that will override the custom default region theme file in the specific situation where user profiles are being viewed. That theme won't have a title set in it.

I have tried creating specific themes called region--content--user.tpl.php and region--content--user-profile.tpl.php, but they didn't override the default region--content.tpl.php theme. Any ideas? Thank you.


texts: error with phpunit execution: how to set PHP Test class path in phpunit.xml?

texts:
I installed the conditional_fields module:

the tree is the following:

root project
  - phpunit.xml
  - web
    - modules
      - conditional_fields
        - tests
          - src
            - FunctionalJavascript
            - Unit
              - ConditionalFieldControllerTest.php

and this is the declaration of the php class I want to test:

<?php

namespace Drupal\Tests\conditional_fields\Unit;

use Drupal\Tests\UnitTestCase;

use Drupal\conditional_fields\Controller\ConditionalFieldController;

    /**
     * ConditionalFieldController units tests.
     *
     * In unit testing, there should be as few dependencies as possible.
     * We want the smallest number of moving parts to be interacting in
     * our test, or we won't be sure where the errors are, or whether our
     * tests passed by accident.
     *
     * @ingroup conditional_fields
     *
     * @group conditional_fields
     */
    class ConditionalFieldControllerTest extends UnitTestCase {
     ....
    }

In the phpunit.xml file I wrote this:

<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
         backupGlobals="false"
         colors="true"
         bootstrap="vendor/autoload.php"
         verbose="true"
        >
    <testsuites>
        <testsuite name="drupal-composer-project tests">
            <directory>web/modules/conditional_fields/tests/src/Unit</directory>
            <file>ConditionalFieldControllerTest</file>
        </testsuite>
    </testsuites>
</phpunit>

but I get this error:

Fatal error: Class 'Drupal\Tests\UnitTestCase' not found in C:\xampp\htdocs\drupaltest2\web\modules\conditional_fields\tests\src\Unit\ConditionalFieldControllerTest.php on line 21


texts:
How to write the same code in Twig?

<?php print l(t('Edit this node'), 'node/' . $entity->nid . '/edit'); ?>


texts: Check if the page is a node using arguments in D7

texts:
In Drupal 6, to check if current page is a node, we use the following snippet:

if (arg(0)=='node' && is_numeric(arg(1))) { /* Do stuff. */ }

Since this is a frequently used statement, I wonder if there's a shorter way to do this in Drupal 7, such as something similar to the following:

if (is_node()) { /* Do stuff. */ }


texts: What is the best way to track unique and overall clicks at my newsletters

texts:
I send newsletters from my Drupal-7 website and I want to track how many times the links where clicked and how many unique click events I had.

I use Simplenews module and I use some basic GA utm parameters, but the results I get are not satisfying. What do you suggest I use. Is there a method, or a way to get that? Everywhere I search there is not a valid answer to my question.
Thanks in advance.


texts: Control display of post date as standard field?

texts:
Like many who came before me... I have a problem with the way drupal 7 allows me to control the display of the post datetime of a node.

I would like to be able to control the display of the post date as a standard field so that I can just simply order it within my fields. I know that I can edit the node.tpl.php but that's not what I'm trying to do. I want it rendered within the content fields.

Is there a module that will create a virtual field that mimics the post date or something like that?

Or is there a module that provides a date time which will automatically set itself to "now" when a new node is created?


texts: Entity template file/suggestion not working

texts:
I've created a entity template file but it's not working.   I've looked at the theme registry and I can see the template file is in there but it's not getting applied for some reason.

Thank for you help,


texts: Permissions to create a database with drush command?

texts:
If I use this line to install a drupal site it only runs fine if the 'mydb' database already exist.

If the database doesn't exist I get an error. Is there other drush command to make an installation when the database doesn't exist?

drush si --db-url=mysql://root:root@localhost:8889/mydb

I don't think is a user permission since the root user has all privileges enabled. Look the picture. I use MAMP (the free version)

I this other capture you can see the connection parameters:


texts: Is there a way to downsize images on upload to save server space?

texts:
Ok, so I have a content type with an image field that gets cropped using the Image Widget Crop. My users will potentially be uploading images directly from their DSLR cameras which are anywhere from 8 to 12 MB each. I want to reduce them down to 1080px x 720px where they'll be around 300kb and drastically cut down on server space.

I've been using hook_ENTITY_TYPE_presave() to reduce the image size however I just discovered this is messing up my cropping. The Image Widget Crop is cropping the original full sized image but after the image size reduction in the presave hook the cropping is no longer valid.

So, is there a way I can hook into the image file as it's being uploaded to then reduce the image size before it hits the Image Widget Crop?

Alternatively, is there a way to convert the crop settings after the image size reduction?


texts:
I need to patch .htaccess file which is located in project's root (docroot in this case), my project is written using composer and I created a patch using git, added it to the /patches directory and wrote a composer.json entry:

"drupal/drupal": [
          {
            "title": "htaccess patch",
            "url": "docroot/profiles/laeg/patches/redirects.patch"
          }
        ]

Sadly after running composer update my patch doesn't appear in the patches list therefore it is not applied. I was told that I should patch drupal/drupal but it seems to not be a case, has some done anything like this and could suggest me something? Project is running Drupal 7.


texts:
I try to run typical commands like drush cc all or drush pm-uninstall while in the folder of my local site (in my pc, win 7 sp3), and yet I get error say:

  "'mode' is not recognized as..."
  "There were no modules that could be uninstalled".

I've never seen the first error in windows 7, and I do have modules to uninstall, so why won't I see a list? thanks,


texts:
I just installed Commerce Kickstart and got a prompt to upgrade from 7.x-2.20 to 7.x-2.21.
drush cannot update throws error:
The commerce_kickstart directory could not be found within the modules directory at                          [error]
/var/www/planetwigs.com/profiles/commerce_kickstart, perhaps the project is enabled but has been deleted from
disk.
Now, the directory exists and the modules are there.
In the GUI I am offered the option to download module, which I did and replaced all modules with new version, just overwrote since I did not modify anything yet and the old sftp method worked, but drush did not.
BTW it is impossible to use the dropdown to selected version 2.20


texts:
I have a list and I only want to print the label once. Right now, it prints for each variable.

if (isset($vocabularies));
$vocabularies = taxonomy_get_vocabularies();
if ($vocabularies) {
  foreach($vocabularies as $vocabulary) {
    if ($vocabulary->vid == 5) {
      $terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid);
      if ($terms) {
        foreach ($terms as $term) {
          print '
Event Type:

' .$term->name;  '

';
        }
      }
    }
  }
}


texts: Updating taxonomy terms with vbo and workbench

texts:
I'm using VBO to bulk update taxonomy terms on my nodes. I'm running into an issue when using workbench that VBO only updates the published revisions, and doesn't touch any of the drafts.

The problem with this is that when there are drafts, the published revision is not the newest revision. So by updating the published revision via VBO, then later publishing a draft, the taxonomy changes done with VBO do not carry forward, since they are part of an older revision.

How do I use VBO to only update the latest revision (whether this is a draft, or published content)?


texts:
I created a custom profile with a custom theme for Aegir. I would like to enable that theme by default when a user install hostmaster during the Aegir installation. In the Aegir installation hostmaster is installed when the user runs the below drush command

drush hostmaster-install

I would like to know is there any way to modify this command or any other way to set my custom profile as defautt one during the Aegir install process.

Thanks


texts: In code, only create a revision if a field is changed

texts:
I have a custom revisionable entity with a few dozen fields. I'm importing data about the entity on a periodic basis. If the entity has changed, I'd like to save it and create a new revision.

$dogs = \Drupal::entityTypeManager()
  ->getStorage('my_entity')
  ->loadByProperties(['my_entity_id' => $my_entity_id]);

$dog = reset($dogs);

$dog->set('name', $record['TheName']);
$dog->set('birth_date', $record['Dog Birth Date']);
// Lots more ->set happening here.
$dog->set('notes', $record['Notes']);
if ($dog->someMagicComparisonFunction()) {
  $dog->setNewRevision(TRUE);
  $dog->save();
}

I searched for the someMagicComparisonFunction but didn't find it. Does it exist?


texts: How can i get the value from the Dynamic query

texts:
$query=db_select('node','n');
$query->join('field_data_field_cmp_playerid','b','n.nid=b.entity_id');
$query->join('field_data_field_cmp_id','c','n.nid=c.entity_id');
$query->join('field_data_field_cmp_userscore','d','n.nid=d.entity_id');
$query->join('field_data_field_cmp_usersupport','e','n.nid=e.entity_id');
$query->join('field_data_field_cmp_status','f','f.entity_id=c.field_cmp_id_nid');
$query->join('field_data_field_cmp_attend_time','g',' g.entity_id = n.nid');
$query->join('field_data_field_cmp_end_date','h',' h.entity_id = c.field_cmp_id_nid');
$query->fields('n',array('title','nid'),'d',array('field_cmp_userscore_value'),'e',array('field_cmp_usersupport_value'),'f',array('feld_cmp_status_tid'),'g',array('.field_cmp_attend_time_value'),'h',array('field_cmp_end_date_value'));
$query->condition('b.field_cmp_playerid_uid',$userid,'=');
$query->condition('n.type','Campaign_PlayerList','=');
$result=$query->execute()->fetchAll();

i use foreach loop to get the value of the query

foreach($result as $value)
{
    drupal_set_message(t('The variable is %va',array('%va'=>$value->title)));
    drupal_set_message(t('The variable is %va1',array('%va2'=>$value->field_cmp_userscore_value)));
    drupal_set_message(t('The variable is %va2',array('%va2'=>$value->field_cmp_end_date_value)));
}

the value i get is  "title" and i can't get the field_cmp_userscore_value and field_cmp_end_date_value value.

what could the problem be?

Thank you


texts: How to calculate the user's average rating on all his/her nodes with Fivestar?

texts:
On my website, users can rate each other's nodes via a Fivestar field called Stars in a comment. I'd now like to calculate the overall average score of a user. That means, I'd like to display the user's average score for all his/her nodes.

For example. Let's say a user created 2 nodes: Node 1 and Node 2. Some people rated his content:

Scores of Node 1: 4/5, 5/5, 3/5
Scores of Node 2: 4/5, 4/5

The overall average would then be (4+5+3+4+4)/5=4.

Preferably, this result should also be displayed as stars.

How can I do that?

Edit 1: Working with the Computed Field module seems to be a general idea to solve this matter. It looks fine to me and I think it's best to store the users' average score in a user field, in order to make it easily accessable. (Working with a view is also fine.) I'm planning to display the average score on their profile page, but perhaps I'm going to use it elsewhere on the website in the future too.

Can you please help me with (a scetch) of the code I'm supposed to use?

Edit 2: I created a user field called Gemiddelde and pasted @Thomas4019's code in my custom module hiderating (the module's title refers to an earlier question), but it gave me the following error:

  Warning: Missing argument 5 for    computed_field_field_gemiddelde_display(), called in C:\wamp\www\mysite\sites\all\modules\computed_field\computed_field.module
  on line 341 and defined in computed_field_field_gemiddelde_display()(line 24 of
  C:\wamp\www\mysite\sites\all\modules\hiderating\hiderating.module).
  Notice: Undefined variable: entity in    computed_field_field_gemiddelde_display() (line 30 of C:\wamp\www\mysite\sites\all\modules\hiderating\hiderating.module).
  Notice: Trying to get property of non-object in computed_field_field_gemiddelde_display() (line 30 of C:\wamp\www\mysite\sites\all\modules\hiderating\hiderating.module).

The Gemiddelde field in the view on my profile page has the following value:

0

No votes yet

Edit 3: After reinstalling the Computed Field module and clearing caches, the error messages are gone, but the Gemiddelde field in my view still displays the following CSS code:

3

Average: 3 (1 vote)

What went wrong?


texts: What is the difference between the "complete" and " checkout complete" order statuses?

texts:
I am using the Drupal 7 Commerce module. I would like to execute a special code when the payment of the order is completed.
What is the difference between checkout complete and complete?
I googled and I found suggestions for these hook implementations.
First option
function mymodule_commerce_order_update($order) {
  if ($order->status == 'completed' ) {
    // ...
  }
}

Second option
function my_module_commerce_order_presave($order) {
  if ($order->status == 'completed' ) {
    // ...
  }
}

###Third option
I found some suggestions to implement hook_commerce_order_updated().
Fourth option
function mymodule_commerce_checkout_complete($order) {
  if ($order->status == 'completed' ) {
    // ...
  }
}


texts: How do I bulk update the alt and title tags of images

texts: Is there a way to bulk update image title and alt tags? Where do alt and title tags are saved in the database?


texts: Panels vs. Entity View Attachments (EVA)

texts:
Just digging into view, panels, contextual filters, etc. do build and render related entities. In this context I got the EVA module and now asking myself if I need EVA when using Panels? In a panel (page) I can include a pane to insert the result of a view - at least that is what I understood so far. Isn't EVA about the same thing? If I don't use Panels I see the point of EVA but if I use Panels anyway do I need EVA?

Thx for help,
Marc


texts: How do I enable Clean urls within a migrated site?

texts:
I am currently assisting a client with a Drupal 6 to 8 upgrade. After migrating a copy of the site into a development localhost environment. I noticed that I was not able to enable clean URLs. I have checked the .htaccess and found the following:

RewriteEngine on
RewriteBase /clientname
RewriteBase /
#Redirect /clientname

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

I have have checked other forums, and according to them the issue should be fixed. However, I am dealing with this same issue.

Any new advice would be much appreciated.


texts: Putting sent private messages into a block

texts:
I used this tip to put private the Drupal 7 private messages into blocks, in order to put those blocks on a quicktabs block:

<?php
/**
 * Implements hook_block_info().
 */
function MYMODULE_block_info() {
  $blocks = array();
  $blocks['messages_list'] = array(
    'info' => t('Messages List'),
    'cache' => DRUPAL_NO_CACHE,
  );
  $blocks['messages_sent'] = array(
    'info' => t('Sent Messages'),
    'cache' => DRUPAL_NO_CACHE,
  );
  $blocks['new_message'] = array(
    'info' => t('New Private Message'),
    'cache' => DRUPAL_NO_CACHE,
  );
  return $blocks;
}

/**
 * Implements hook_block_view().
 */
require_once('sites/all/modules/privatemsg/privatemsg.pages.inc');
function MYMODULE_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'messages_list':
      global $user;
      $block['subject'] = t('Private Messages List');
      $block['content'] =
        drupal_get_form('privatemsg_list', 'list', $user);
      break;

    case 'messages_list':
      global $user;
      $block['subject'] = t('Private Sent Messages');
      $block['content'] =
        drupal_get_form('privatemsg_list', 'sent', $user);
      break;
    case 'new_message':
      $block['subject'] = t('New Private Message');
      $block['content'] = drupal_get_form('privatemsg_new');
      break;
  }
  return $block;
} ?>

It works quite well, but I have the following issues:

Tab 1 (Inbox): Why I can't delete messages on the message list, or change their status.
Tab 2 (Sent messages): How do I see the sent messages list? Is there a separate form?
Tab 3 (New message): After sending a new message, how to I redirect the user back to the messages list?
How to avoid needing to include sites/all/modules/privatemsg/privatemsg.pages.inc (If I want to put this block on a non-standard URL, not starting with '/messages', I get an error that a function in that file is not found.

Notes (EDITED):

Drupal 7 Privatemsg views integration module is stuck (you can see the latest patch here). Forms integration works, somewhat.

Alternate approachers:

Edit it with the data module (which allows to make a view on any table) + VBO. IF they work together.
Recreate the whole solution with Views + VBO.

Please advise

Thanks

Amnon


texts: Count multivalue image field values in views-view-fields.html.twig

texts:
Making a presentation template for the gallery. The photo gallery has an image field with multiple values. I need to output the number of gallery photos (in the field_gallery_photo). How do I do this? I tried adding a field with a photo to the view, and all the values are shown in one line. The result is not accurate:
{{ fields.field_gallery_photo.content | length }}

In version 7 I did the following:

added the nid field

redefined the template for it

specified the following in the template:
$node = node_load($output);
print sizeof($node->field_gallery_photo['und']);


texts: Will removing the X-Drupal-Cache header break anything?

texts:
I have a client that wants to get rid of as much server information as possible from their headers, including "X-Drupal-Cache".

I know that anyone technical enough to be looking at headers can very likely tell that Drupal in plenty of other ways  but that's beside the point.

It is easy to remove the header but if I do will it potentially break anything?

Note: I'm aware that there is a similar question at X-Drupal-Cache http header but that issue has long ago had an accepted answer that does not cover my specific question.


texts: Drupal setup one language: locale vs. stringoverrides

texts:
I was wondering what would be the best way to build a website which has only one language. In order to make existing strings translatable we can:

use the Locale module and add a 'dead' language which we set default and use to translate all our custom strings
Use the String Overrides module to translate our custom strings

What should we do with bigger websites?


texts:
Is there any way to call hook_entity_view() from a theme?

I tried adding the implementation to the template.php file, but the function is not called.

I know I can do it via custom module, but as it's a rather UI addition, it would make more sense to do through theme.

Thanks!


texts: Strict warning: Only variables should be passed by reference (node.tpl)

texts:
Hello im getting this error message and its relating to this code in my node.tpl. Could anyone advise me on how i can clean it up a bit to suit. thanks?

 <?php print render(field_view_field('node', $node, 'body', array (
 'label'=>'hidden',
 'type' => 'text_summary_or_trimmed',
 'settings'=>array('trim_length' => 150),
  )));

 ?>


texts: How to hide the profile2 header for profile?

texts:
I have the module profile2 for user profiles with different fields on my site. At the moment I am theming the user profile page.

I want to hide the header for profile-specific fields and show them with the common fields. How can I do this?


texts: How to add different installation profiles in drupal 7

texts: I have my own custom built theme. I want to add installation profile like many premium themes have. Is this is achievable by any module?


texts:
I have a view with a table that has a pager to show 5 items at a time:

Items to display:Display a specified number of items | 5 items

In another display I have a chart that is attached to the table. How can I set the view so that the chart display the same content that is in the table? There is the Inherit pager option that I set to Yes but the chart always show the firts 5 items and not the 5 items showed in the table.

You can see in the image below that the chart is in fact limited to 5 (as the table) but the dates (x-axis) don't match.

Am I missing something here? Or is this a limitation?


texts: Should I ignore the vendor directory in git for Drupal 8?

texts:
I'm finally trying to get on board with using Drupal 8 and want to know if I should ignore the vendor directory in git with .gitignore. I would assume not, but I've seen a few example .gitignore files that do.

Thanks!


texts: How to properly add a Commerce Shipping Service option via AJAX during checkout

texts:
I have the Payment and Shipping service block in the same
checkout pane.
I update the Shipping service block with AJAX when
selecting a Payment method, as available Shipping services depend on
the selected Payment method.

But once the Shipping service block is reloaded, if I select another Shipping service and submit the form, I will be redirected to the initial pane as if my selection was unvalid - with no error message.

This is the code I use to update the Shipping services block, after saving the order to update the available Shipping services. (Inspired by some other posts)

And I can't find a way to make the Shipping selection work on submit after being reloaded via AJAX.

Should I also update the form state?
commerce_shipping_service_rate_order($service, $order) didn't change
anything
Nor commerce_shipping_pane_service_details_refresh($form,
$form_state)

Would someone have an idea what could go wrong?

/**
 * Alter checkout shipping form.
 */
function mymodule_checkout_shipping_alter(&$form, &$form_state) {
    // Replace AJAX callback by a custom one.
    $form['commerce_payment']['payment_method']['#ajax']['callback'] = 'mymodule_payment_pane_checkout_form_details_refresh';
}

/**
 * Checkout shipping pane AJAX callback function.
 */
function mymodule_payment_pane_checkout_form_details_refresh($form, &$form_state) {
    // Commands initialization.
    $commands = array();
    // Load the current order
    $order_id = $form_state['order']->order_id;
    $order = commerce_order_load($order_id);

    // Set the newly selected payment option to the order
    $order->data['payment_method'] = $form['commerce_payment']['payment_method']['#default_value'];
    // Refresh the current order (more specific: update it's line items
    commerce_cart_order_refresh($order);
    // save the refreshed order (more specific: recalculate the order total and save it)
    commerce_order_save($order);

    // Default Commerce AJAX callback for the payment pane.
    $commerce_wrapper = '#' . $form_state['triggering_element']['#ajax']['wrapper'];
    $commerce_output = commerce_payment_pane_checkout_form_details_refresh($form, $form_state);
    $commands[] = ajax_command_replace($commerce_wrapper, render($commerce_output));

    // Update Commerce shipping pane.
    $panes = commerce_checkout_panes();
    $shipping_pane = drupal_get_form('commerce_shipping_pane_checkout_form', $panes['commerce_shipping'], $order);
    $form['commerce_shipping']['shipping_rates'] = $shipping_pane['shipping_rates'];
    $form['commerce_shipping']['shipping_service'] = $shipping_pane['shipping_service'];
    $form['commerce_shipping']['service_details'] = $shipping_pane['service_details'];
    $commands[] = ajax_command_replace('#commerce-shipping-service-ajax-wrapper', drupal_render($form['commerce_shipping']));

  return array('#type' => 'ajax', '#commands' => $commands);
}


texts: Specify which Migrate entries need to be updated using prepareRow

texts:
I have made a Migration that i run with Cron. My highwater field is the date changed, which is present in the XML (source) document. Then I do this in my cron function:

 $result = $migration->prepareUpdate();
 $result = $migration->processImport();

Problem is is this will update ALL nodes from the XML. I would like to only update those that have been changed, according to their modifiedAt date. If I just do:

 $result = $migration->processImport();

Then nothing at all updates. I think processImport() would work if it were just about importing new items, but I also need to update any existing items that have changed. The ones that don't need updating can be skipped, of course. Is there another method I could call here? Is there a way I need to set up some kind of prepareRow to mark items as needing updating?


texts: How to customize the markup of radio buttons in the edit/create node view?

texts:
So I have a content type with several fields.
One field is a set of two radio buttons. The output code while content creation/moderation looks like this:

    Group content visibility *

            <input type="radio" class="form-radio" checked="checked" value="1" name="group_content_access[und]" id="edit-group-content-access-und-1">
            Public - accessible to all site users

            <input type="radio" class="form-radio" value="2" name="group_content_access[und]" id="edit-group-content-access-und-2">
            Private - accessible only to group members

Now I want it rather to be something like this:

  <input type="radio" class="switch-input" name="group_content_access[und]" value="1" id="Public" checked>
  Public
  <input type="radio" class="switch-input" name="group_content_access[und]" value="2" id="Private">
  Private

How can I change this markup? (I run Display suite and tried to ajust it somehow with DS settings; did not work out.)

Troubleshooting

Issue #1

In how far is $output not used anymore for radio buttons?

Issue #2

How do I add  after my second radio-button-label? (See the example above.)

Issue #3

The front page shows the following message.

  Notice: Undefined variable: output in themename_form_element() (line 309 of D:\root\sites\all\themes\themename\template.php).


texts: how to value from one view to another view filter in drupal

texts:
I want to pass the value from one view to another view's filter I have view 'filter' which is having the select box with taxonomy list as option 'category_taxonomy' having fruits,vegetables. I want to pass the taxonomy value to next view in on change event to filter the value in view 2.My both 'view1' and 'view2' are in same tpl.If I select the value from view1 I wat to send the argument to the second view and and filter the result and then reload only the second view(view2).

$vocabulary = taxonomy_vocabulary_machine_name_load('service_line');
$terms = entity_load('taxonomy_term', FALSE, array('vid' => $vocabulary->vid));
// print_r($terms);
echo '<select class="filter"><option value="">select</option>';
foreach($terms as $data){
  echo '<option value='.$data -> name.'>'. $data -> name.'</option>';
 }
echo '</select>';


texts:
I know how to change edit and create permissions of a content type to one role.

But what i need is that a user that has the role 'consultant' is the only one that can see the content that was created of the type 'consultant info'.

I can only find a way to watch "own published content" but that isnt enough because their are multiple consult accounts that need to see each-others content.

Ive already looked at modules like content_Access but they also don't provide this.


texts: Features + user permissions: what are the pros and cons of all in one versus separate?

texts:
I need to carry out a review of our user roles and permissions. Currently some roles and permissions are already bundled into existing features (usually custom content types), but most are not. I would like to get everything committed into features to kick-start the review.

What are the pros and cons of either of these approaches:

Have one 'roles and permissions' feature that collects all of the roles and permissions? (This adds a lot of modules as dependencies.)
Include roles and permissions into other features when needed? (This might still require a separate feature for the permissions that don't fit into other features.)

Alternative methods (eg to help reduce the amount of roles/permissions) welcome too!

Note: a lot of our custom content types share reusable fields, which will need to have user permissions defined for them.


texts:
I am looking for the equivalent or at least a way to run a snippet of code only when the session starts and at now other time do i want this code run.  Can anyone help me with this?  Ive looked around and cant seem to find an answer and all i read about is how drupal is not good with sessions.

What im trying to do is:
Retrieve a value from the URL when the session starts and set a couple variables and cookies according to that variable.  I need to use those cookies throughout in order to retrieve correct results.


texts: what's Taxed line items in the ubercart tax module?

texts:
does anyone know what is referring to the fields :
Taxed line items : Shipping,Empty line,Tax in the tax configuration?
i couldn't find an explanation


texts:
I'm trying to allow anchors in my ckeditor but they always get wiped out by the WYSIWYG filter module.

For hyperlinks, my allowed attributes in WYSIWYG filter are "a[!href|target<_blank|title|id|name]". Then in the Rules for Element IDs section, I put "anchor*".

So in my content, when I add an anchor named "anchor1", it adds

 to the markup, which get replaced by
&nbsp;
 once I save the content.

What am I missing to get this to work ?

Thanks !


texts:
What I have installed on my site is the Entity API and Entityform modules. The Entityform module allows me to create forms that any user can submit and the forms fields are available for me to use in views, similar to how a content type would work.

Normally to pull a field's value from a node into my template with php I'd do the following:

<?php echo $node->field_name[$node->language][0]['value']; ?>

However this does not work with entityforms/entities.

Does anybody know of a way to do this for a field within an entityform? Some people have suggested to use devel and the dpm() function but I have no idea how to use those either.

Some specific examples on how I can get this field's value would really help me a lot.


texts: What hook_form_alter code do I need to change an exposed filter from a text field to a select box search?

texts:
I have a view that has an age to and and from fields, and others also that I want TO and FROM.

These are integer fields, so drop down select doesn't work, better exposed filters is also not an option.

What CSS, or Java script can I put in the Hook_form_alter to make this work?

Website that has the form is www.vuxi.com


texts:
I have installed easy chart plugin with Drupal 7 website.

My pages are generated with views using nodehierarchy and quick tabs plugin.
To speed up page load, I have enabled views cache.

I noticed easy chart displays while page loads for the first time after cache is cleared. But as soon page speeds up(cached) charts are not displaying.

We have APC cache installed on our website.

Can anyone help with?

Thanks!!!


texts:
Is there a way to disable the top admin menu (not default toolbar), for a particular page? I am not looking for a JS or CSS workaround, but a proper solution such that the rendering of the admin menu does not happen.

Thanks and help appreciated...


texts:
There are 12 or so similar questions but not drupal related.
Here is my site on a digitalocean  droplet: http://104.236.27.226/

It is apache2 on ubuntu16 php7.
I am using: 000-default.conf:

ServerName casey.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory "/var/www/html">
  AllowOverride All
  Require all granted
</Directory>

I made file permission as permissive as possible:

drwxrwsrwx  4 casey    www-data 4096 Sep 20 12:15 www/

I put an echo in the settings.php, at the very end to show the user for  apache:

casey@dchouse02:/var$ tail -n 3 www/html/sites/default/settings.php
echo('
ECHO: from setting.php after databases array; and apache user is (via exec whoami): ');
echo exec('whoami'); echo ('
');

Knowing that settings.php is being read, I moved to indx.php for this D7 site:

casey@dchouse02:/var$ tail -n 3 www/html/index.php
echo('
from index.php: before menu_execute_active_handler:
');
menu_execute_active_handler();
echo('
After menu_execute_active_handler
');

At this point the error appears:

The web service endpoint returned a "HTTP/1.1 403 Forbidden" response

The list of apache processes look similar to what I get from the ubuntu on my laptop:

casey@dchouse02:/var$ ps aux | grep apache
root     16068  0.0  4.7 327752 23512 ?        Ss   16:59   0:00 /usr/sbin/apache2 -k start
www-data 16071  0.0 10.2 345548 51244 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data 16072  0.0 10.2 343656 51176 ?        S    16:59   0:01 /usr/sbin/apache2 -k start
www-data 16073  0.0 10.7 347648 53632 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data 16074  0.0 11.1 349660 55520 ?        S    16:59   0:01 /usr/sbin/apache2 -k start
www-data 16075  0.0 10.1 345548 50888 ?        S    16:59   0:01 /usr/sbin/apache2 -k start
www-data 16099  0.0 10.0 343428 50248 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data 16764  0.0 10.3 345600 51792 ?        S    18:37   0:00 /usr/sbin/apache2 -k start
www-data 17344  0.0  1.3 327784  6612 ?        S    21:38   0:00 /usr/sbin/apache2 -k start
www-data 17347  0.0  1.3 327784  6612 ?        S    21:38   0:00 /usr/sbin/apache2 -k start

I don't know what else to do to troubleshoot  this.


texts:
I've created a form using D7 Webform 7.x-3.20. This form works in the following manner:

Fill out form and attach image.
Email is sent to admin to approve where you click through to admin approval pages.
Approve information and upload image (no issue).
Page generation page where you select the image to thumbnail.
Save and publish page which is added automatically to a gallery.

One issue; on step 4 the thumbnail will occasionally break and not generate in the specified folder I've defined after so large a size. I've tested to confirm it's not a file type since all JPG, GIF and PNG work just fine. It is only after about 10MB of size the issue presents itself. I've also checked my form to confirm it allows for larger file uploads than that. Additionally my php.ini file is currently allowing for up to 150 MB file size during this time of testing.

Hopefully we can brainstorm this issue together and come up with a solution.

Thanks in advance!


texts: drupal 7 lack of understandig location of bartik's color.css

texts:
I liked to change some css color styles. I created my own css file and let bartik theme (my enabled theme) know this in its info file. But no changes took effect.
Then i realized, that there are two color.css files. One is in bartik/css/ and the other in sites/default/files/color/. The second one is used. Can someone explain to me, why not all css are just taken from bartik/css. I think i didn't get the concept yet.


texts: hook_module_implements_alter() not working for me. What am I doing wrong?

texts:
I use D7 and need 2 different modules to parse article text on save. For simplicity's sake let's say module_one changes all f's to z's and module_two changes all foos to bars. So basically "F foo fo foo" is to become "Z bar zo bar". To accomplish that I need module_two node_presave event to fire before module1. Otherwise the result will be something like "Z zoo zo zoo". But hook_module_implements_alter() doesn't seem to do the thing. I write it like this:

function module_one_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'node_presave') {
    // Move module_one_node_presave() to the end of the list. module_implements()
    // iterates through $implementations with a foreach loop which PHP iterates
    // in the order that the items were added, so to move an item to the end of
    // the array, we remove it and then add it.
    $group = $implementations['module_one'];
    unset($implementations['module_one']);
    $implementations['module_one'] = $group;
  }
}

This hook executes but I still get module_one's node_presave hook executed before module_two's. So what am I doing wrong?


texts: Multisite- different localizations and domains but same codebase and user base

texts:
I have an established site which caters to Australian market and now I want to launch a similar site for US market.

New site will have a different domain
New site will have different content

However, I want both sites to share code and users so that someone who has an account on Australian site should be able to log in to US site plus any changes in code should reflect on both sites.

Sorry I am bit a knoob and will appreciate some guidance.


texts:
I installed HTML purifier because the default input format is filtered HTML and my users need to be able to add inline styles to the elements in their nodes. I'm trying to get it to work, but it is not very intuitive and there doesn't seem to be much documentation out there.

Can someone please suggest a tutorial or tell me how I can add the style attribute as well as width and height?


texts: Views: alter data of a View of another module

texts:
I wanted  to add a relationship to data in a View of an existing module, so I've hacked the code (the function modulename_views_data) and it works.

Now I want to create a new  module to do this extension, leaving clean the original one. I guess I should use the function views_data_alter(&$data) but I don't understand how to bind it to the other module.


texts: How to save database connection easy and safe?

texts:
I'm trying to let Drupal7 connect to several databases(pgsql) and update data automatically. So I use Database::addConnectionInfo($name,'default',$connString) And db_set_active($name).

It works perfectly until I realize it's dangerous to save database password in fields while the connection string actually needs it.

Is there any way to do so easy and safe?

Thank you! :)


texts: Google analytics profile not retrieved to my site

texts:
I'm using google analytics counter. I have Google analytics account and created OAuth2 credentials. My site got authenticated to Google analytics API after adding credentials to my site. But no Google analytics profile retrieved on my site, and below warning thrown.

Please help in this regard.

thanks

Notice: Trying to get property of non-object in google_analytics_counter_auth_admin() (line 90 of /home/bytescom/public_html/sites/all/modules/google_analytics_counter/google_analytics_counter_auth.inc).
Notice: Trying to get property of non-object in google_analytics_counter_auth_admin() (line 91 of /home/bytescom/public_html/sites/all/modules/google_analytics_counter/google_analytics_counter_auth.inc).
Warning: key() expects parameter 1 to be array, null given in google_analytics_counter_auth_admin() (line 117 of /home/bytescom/public_html/sites/all/modules/google_analytics_counter/google_analytics_counter_auth.inc).
Warning: Invalid argument supplied for foreach() in google_analytics_counter_auth_admin() (line 126 of /home/bytescom/public_html/sites/all/modules/google_analytics_counter/google_analytics_counter_auth.inc).
Notice: Undefined variable: current_profile in google_analytics_counter_auth_admin() (line 146 of /home/bytescom/public_html/sites/all/modules/google_analytics_counter/google_analytics_counter_auth.inc).
Notice: Trying to get property of non-object in theme_google_analytics_counter_profile_label() (line 273 of /home/bytescom/public_html/sites/all/modules/google_analytics_counter/google_analytics_counter_auth.inc).
Notice: Trying to get property of non-object in theme_google_analytics_counter_profile_label() (line 273 of /home/bytescom/public_html/sites/all/modules/google_analytics_counter/google_analytics_counter_auth.inc).


texts:
I have a field (field1) where users can enter in a date that's in the future. Another field (field2) depends on field1 in a way that if todays date < field1, display field2. What's the best way to approach this? I cant find a way to do this using Rules and the Date module unless I'm not looking at the right place.

Also if todays date >= field1, dont display field2 at all but instead display a 3rd field (field3).


texts: Advance search between two content types that are linked by entity reference fields

texts:
I have "linked" 2 content types (Type A and Type B) by a field using the entity reference module.  They are "linked" by the other node's ID number.  For example, the entity reference field would have an input that says: "Select the node ID which is related to this content".  Now I would like to implement a smart search.

For example, if someone searches for Type A, the search should also return the content of Type B that is "linked" to Type A based on that entity reference field.  Can this be done with search or Views?  In quasi-SQL, it would be something like:

"SELECT * FROM TypeA, TypeB WHERE TypeA.field_A=TypeB.nid"


texts: Metatag: How to programmaticaly set a node's canonical URL

texts:
I am using the metatag module for defining several meta tags. As a default value, canonical tags use '[current-page:url:absolute]'.
Now I want to create a module that sets the value of the canonical tag to some other url.

Setting $node['metatags']['und']['canonical']['value'] to another string doesn't seem to work. Unfortunately, I also can't use an entity_wrapper, since metatag doesn't define information for its custom fields, which is needed by entity_wrapper.

Is there something else I could do?