texts: How can I display a picture from a field as the user picture rather than the drupal default with user-picture.tpl.php?

texts:
Because my site requires user pictures to be approved, the default Drupal user picture is not suitable.

Instead, I want to show a picture from a field in each user's profile as the user's profile picture.

The field is "field_profile_picture".

The image style is "profile_picture".

Based on this tutorial, I put the following code in user-picture.tpl.php in my theme's templates folder:

if (!empty($user->field_profile_picture['und'][0]['filename'])) {
  echo theme('image_style', array('style_name' => 'profile_pic', 'path' => file_build_uri($user->field_profile_picture['und'][0]['filename'])));
}

This doesn't result in any PHP errors but no picture is displayed.  It appears that field_acc_profile_picture is evaluating as empty because even if I put a print "Hello world"; inside the {} it doesn't appear.  However, I am sure that the field has a value because I can see the picture displayed in views.


texts: How to get country list array with their corresponding country codes

texts:
I have used $countries = \Drupal\Core\Locale\CountryManager::getStandardList(); to render array of countries with country code as their keys. But when I debug the variable $countries; print_r($countries);die; it goes into infinite loop and result does not get rendered. It shows 404.

How to get country list array?


texts: How to make content creation form more organized. Taxonomy Checkbox list

texts:
I am preparing to allow users to edit specific fields of content. I have until now used autocomplete for myself.

I would like to start using the Check boxes, but as of right now it show my 30 terms as a one column list.

Is there a way to have these terms show in 4 columns instead of one long column. (to organize it better and utilize page space)


texts:
I am building a multi-seller commerce site, where a user can register and sell their product.  I need to display a menu link if the user is anonymous to "become a seller", where they are directed to log in and a create store form.

If the user is logged in, I want to display a menu link that displays "My Store" if they previously created a store.  To determine if they have a store, how can I load a store via their user ID?

I have been unable to find an example where someone can load a user's store.


texts:
I want to make possible for the user to SORT Apache Solr results based on some taxonomy terms.How can I do that?
I also want to make possible for a user to change the number of the results on the page.
How can I achieve both of them?
Thanks in advance


texts: Show comment module but have it disabled for anonymous users

texts:
I have what I believe is a slightly unusual requirement for comments. I'm trying to figure out how to implement this:

Comment form should always appear at the bottom of the page (this helps
users understand they can submit a comment especially if there are no comments yet for a given article)
If the user is registered the comment form should be enabled.
If the user is anonymous the comment form should be disabled and provide a
link to registration

It seems like the comment module is generally built to be on or off. Any recommendations on exposing it as a disabled form?


texts: Can't figure out how to set a context with t()

texts:
This is a follow-up to this question on setting contexts using t().

I am attempting to set a context using t().

I am trying to set the context for the translation of State to geo.  My code looks like this:

$format['locality_block']['administrative_area'] = array(
  '#title' => t('State', array('context' => 'geo')),
  '#size' => 10,
);

This doesn't give any errors but it also doesn't create the translation unit with the context, either.  Any clue what I'm doing wrong?  (It's probably something obvious; I'm not good with PHP.)


texts: What should a bilingual site look like from the backend?

texts:
Suddenly I have lost track on my new build D7 German/English site. Nothing I attempt seems to work. I will tell more about the problems below but I think its hard to help me there as long as I am not sure if the base is correct. So, my concrete question is:

How should the mainmenu of a bilingual D7 site look like, i.e. is there only one main menu and the translations of the links can just be seen after clicking on them?

Home
About Us
-Team
-Jobs

Or should there be a menu tree for German and another one for English?

Home
About Us
-Team
-Jobs
Start
Über uns
-Mitarbeiter
-Karriere

(Both is possible and I am still strugelling to understand if this is a bug or a feature. See Why are there so many different ways to translate menus?)

Well, here are some of the problems I thought I overcome and which now seem to be everywhere on my site:

Sometimes, a translated site appears as an item on its own in content list, sometimes the translation seems to be stores in the main language item.
On some pages I may not click on English although there exists a translated version of the site although it should be linked as far as I see.
If a link works, the bread crump path differs from the real path:

German:

Start / Über uns / Karriere

English:

Home / Jobs


texts:
I'm using migrate upgrade drush command to generate migrations from a live DB of website.
So content is created during my migrations. How can I do an update of these migrations to import new content when re-run migrations ?

Thanks


texts: How to add taxonomy term reference field in a custom form

texts:
In the previous version of Drupal, it was possible to reference taxonomy tags in Drupal's forms using the following option:

'#autocomplete_path' => 'taxonomy/autocomplete/'.$vid,

However, in the Drupal 8, taxonomy term reference field has been removed in favor of Entity reference, more info here.

So, is there any alternative available?


texts: $form_state['rebuild'] and AJAX handlers

texts:
I have form with the most common AJAX handler (managed_file field). In this field the user can upload a picture and after some processing a preview is available.

Also i have some inline JS which does some substantial work, which i want to be present when the form is submitted with wrong data. The solution for this problem was setting

$form_state['rebuild'] = TRUE;

Here a new problem occurred - the AJAX handler stopped working properly. Going to the log I found this message:

Invalid form POST data.

which was pointing to a URL with the error itself, here it is:

[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"da\/","ajaxPageState":{"theme":"jv","theme_token":"ARZs9c7X77Aasa2fbJm0jb1KLUtqYD7h7UcVA6gygpM"}},"merge":true},{"command":"insert","method":"replaceWith","selector":null,"data":"\u003Cdiv class=\u0022messages error\u0022\u003E\n\u003Ch2 class=\u0022element-invisible\u0022\u003EError message\u003C\/h2\u003E\nAn unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (92 MB) that this server supports.\u003C\/div\u003E\n","settings":null}]

What i get from this message is that the upload memory limit is exceeded.

This also happens to my custom AJAX callbacks - they also do nothing, but there is no error, just blank.

Can anyone help me what's going on and what's the best workaround if there is no solution to this?

Thanks in advance!


texts:
I'd like to create a content type "Enterprise" where user can define N services and, for every service, N tasks. I have already created the other fields for this content-type (name, description, ..., easy fields) but I don't know how to start with the services and tasks.

I'd like to be able to create services and tasks in the same form. What would be the best way to do it?


texts:
Where is the comment notification when anonymous users send a comment?
I don't find any notification in dashboard, or other pages to approve comments.


texts: Custom entities created time is always the same

texts:
I have a custom content entity type. When I create an instance, the first one got the right created time stamp. But starting with the second one, they all have the same created time stamp: as the first one have!

Why is this happening?

Base field definition:

$fields['created'] = BaseFieldDefinition::create('created')
  ->setLabel(t('Created'))
  ->setDescription(t('The time that the entity was created.'))
  ->setReadOnly(TRUE)
  ->setDisplayConfigurable('view', TRUE);

Setter / getter methods:

  /**
   * {@inheritdoc}
   */
  public function getCreatedTime() {
    return $this->get('created')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setCreatedTime($timestamp) {
    $this->set('created', $timestamp);
    return $this;
  }


texts: How to get user photo to appear in node panel

texts: I'm overriding a node template with panels, I'm trying to add the user photo, but the only thing I can seem to add is the username. Does anyone know how to do this? do I have to do something weird like create a mini-panel that loads the user?


texts: How to rediret to specific page depends upon user roles

texts: I have 2 user roles. When a user logs in, I want to redirect the user to a specific page based on their role. I tried the Login_destination module, but it has not worked for me. I have also tried using the trigger action, but it has also not helped me. When I used this trigger action, the ajax module threw an unexpected error message.. SO please help me.. How do I solve this problem...


texts: How can set a custom action with a custom attribute selected in form?

texts:
I have a view of persons. I like to add the persons to an event. I also like to set the status of the resulting relation to one of the values "optional" or "required".
Therefore I use VBO on a list of persons. With the submitted NIDs I like to build a relation from the person to the event and fill the relation data field "status" with the selected value from the from.
To create only the relation it was easy to create a new action with custom php code, which builds my relations programmatically.
To add a parameter to the relation I have to edit the view's form programmatically. So I hook into the form alter of the views form and add a custom dropdown with the two values "optional" or "required".
The questions are:

Is it possible to use the selected dropdown value in the vbo action with custom php code? I only know how to handle the selected nid's. This option would be easier for me to implement.
If 1) is not possible: Should I use a custom submit function for the vbo form? And where to assign the function?

I tried the following code to assign a custom submit custom_webform_pre_build_list_vbo_submitfunction but it isn't called.
function custom_webform_pre_build_list_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == "views_form_person_list_panel_pane_9"
    and $form['#id']=='views-form-person-list-panel-pane-9') {
        $form['#submit'] = array('custom_webform_pre_build_list_vbo_submit');
    }
}


texts: Why are the labels for two different form elements so different? Can I make them the same?

texts:
I created a webform that has one textfield and two radio button fields.
When displaying, the textfield label is themed correctly, but the radio button labels are not.
When I look at the tags and classes, the texfield label has a "label" tag with "control-label" class like this
Textfield label

but the radio labels have "span" tags with "fieldset-legend" class, inside "legend" tags, like this
<legend>
    Radio element question
  </legend>

Why are they different? Can I ake them the same, or is add a CSS style to make the span.fieldset-legend match the label.control-label the only way to make them the same?
I am using the Bootstrap 3 theme and I enabled the webform-bootstrap module.


texts:
How can I check if a user has access to create a new node of a custom node type?

In 'admin/people/permissions' I have an item named "Custom Type: Create new content" and it is enabled for authenticated users.

How can I use user_access() to verify against "Custom Type: Create new content"?


texts: Why am I getting a 403 error with this route?

texts:
I'd like to apply the admin (or other) theme to user /user/login page. Since ThemeKey isn't available I'm attempting to implement via routes. "View admin theme" permission is granted to anonymous.

Using this route:

my_module_name.user_login:
  path: '/user/login'
  options:
    _custom_theme: 'my_custom_theme'

gives the correct theme, but a 403 response on the /user/login page. Why am I getting a 403 response (with the anticipated theme) instead of the standard login page?


texts: Template file is not overriding drupal 7 defaults

texts: Why node--type.tpl.php is not working? I've cleared drupal cache 100 times no results. Is there something else i must to do?


texts: Content teaser view, Read more shows only in admin mode

texts:
I manage a Drupal 7 site with custom theme and I have no FTP access and was not involved in development but I have to manage the content and have every right on the web surface.

The situation

I created some content based on the type article (which has a Body of "Long text and summary" field type and of "Text area with a summary" widget), and a view to show this content.

In the view display (created both Block and Page), Format is set to "Unformatted list" (Force using fields is disabled at the settings), and Show is set to "Content | Teaser". Check the image for the settings.

With these settings, the content on the editorial view is fine for me: title, a picture, a text and a read more link. Check the image for the result.

Unfortunately, "Read more" does not appear on the page shown for the visitors. Not even not shown, it cannot be found in the html source code.

Note: Read More Control and Read More Link modules are not installed.

Question

Is this behavior intended? Is there a bug in a module? Did I miss something, and there's a way to show "Read more" on the page for the visitors too? Can you please tell me how can I manage to show a "Read more" link to the visitors with the same view settings? I neither understand why modifying the Block style implies the modification of the Page Display, i.e. I modify one of them (like the displayed fields), the other display is modified too automatically.

I already have a workaround, but it is not a solution. What I've done is that I changed the setting and checked the box "Force using fields" at Format: unformatted list and manually added the title, image, text, a manual texted link to read more and a horizontal rule.


texts: How to do an EntityQuery on a custom User field?

texts:
I'm having trouble figuring out how to use the EntityQuery on custom field values. As an example I have a custom field under the User bundle that stores the country in which the user lives. There are three options: US, Canada and Mexico. I'd like to use the EntityQuery to directly query the 'field_country' to get a count of how many live in one country and get their uids. Here is an export from the database for this field:

The closest I've gotten is the code snippet below. This however is not working and I'm not sure where to go from here.

$results = \Drupal::entityQuery('user')
      ->condition('field_country', 'Canada')
      ->execute();

Does anybody know? Does the entityquery give me the ability to look specific columns in a field? Thanks!

P.S. I know I could do this with a database query but I'd prefer to do it the Drupal way.


texts: Avoid duplicate entries when programmatically adding field values

texts:
This pretty cool answer taught me to push new term references like this:

$node->field_tags[] = 6;

... but if that reference already exists you get a duplicate.

This isn't possible through the UI and isn't what you would usually want. The duplicates show up in the rendered view.

Here's the horrible thing I did to check for the reference I'm trying to add:

$term_refs = $node->field_tags->getValue();
$has_ref = count(array_filter($term_refs, function ($term_ref) use($tid) {
return in_array($tid, $term_ref);
  }));
if (!$has_ref) $node->field_tags[] = $tid;

Is there a hasValue() method or magic PHP function I'm missing that I can use instead?

The structure of $term_refs (the field_tags value) looks like this:

Array
(
    [0] => Array
        (
            [target_id] => 6
        )

)

Update: Clive's solution is what I'm looking for but I couldn't get this to work. So I modified George's answer to this so I can skip existing refs:

if (in_array($tid, array_map(function ($i) { return $i['target_id']; }, $term_refs))) continue;


texts: How to include multiple taxes to a product's price?

texts:
I am using Drupal commerce and have multiple taxes and tax types.

The product price in my site includes 2 types of taxes already added to them (inclusive of both the 2 taxes).

In the product edit page, I get an option to add one of the taxes to be included in the product price.

My doubt is that, how can I select multiple taxes to be included in the product price?

Any help is much appreciated. Thanks.


texts:
In a custom module of mine, I have two custom entities A and B with a one to many relationship from A to B.
This is Edit form for EntityB:

I want to have this check in validateForm: if 'Contact' (boolean) is checked, 'Adhérent' (entity_reference to EntityA) shouldn't be empty.

Here is my validateForm:

  public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form, $form_state);
    $values=$form_state->getValues();
ksm($values);
    if ($values['estlecontact']['value']==1 && $values['adherentid']['target_id']==NULL) {
      $form_state->setErrorByName('estlecontact', t('L\'Adhérent est obligatoire quand la Personne est désignée comme Contact.'));
    }
  }

In this case, I should not have the error message and still...
What am I doing wrong?
Here is the result of ksm:


texts: How do I set a Node's Paragraph field in a different language programmatically?

texts:
I have a node that has different translations already and I'm trying to populate Paragraph fields in different languages programmatically. I can edit the node and update the paragraph fields manually and they work correctly, so I know the translation configuration is setup correctly.
However, when using the code below, when I create a new paragraph in, say Dutch, and save it to the translated node object it always overwrites the English translation with the Dutch one.
For example:
English Node->MY_PARAGRAPH_VALUE = "English Paragraph Text"
...run code...
English Node->MY_PARAGRAPH_VALUE = "Now has Dutch Paragraph text "
<?php
  /*
   * $node is an existing Node entity with empty multi-value paragraph
   *  fields to populate in different language below
   */
  $lang_code = 'nl';
  $lang_node = $node->getTranslation($lang_code); // copy En node into Dutch Node

  /*
   * Using a Paragraph View to verify,
   * this part works and creates a paragraph with the correct language
   */
  $paragraph = Paragraph::create([
      'type' => 'images_descriptions',
      'field_product_image' => $img[$key],
      'field_product_description' => $desc[$key],
      'langcode' => $lang_code,
  ]);
  $paragraph->save();

  $current[] = [
      'target_id' => $paragraph->id(),
      'target_revision_id' =>$paragraph->getRevisionId(),
  ];

  $lang_node->set('field_images_descriptions', $current);
  $lang_node->save();

?>


texts: How to theme the node edit form to group fields into collapsible containers?

texts:
I'd like to tidy up an unwieldy node edit form using collapsible fieldset elements.

I can do this by implementing a form_alter hook but will this affect Drupal/other modules' ability to process/validate the fields? Obviously it will change the #parents of several elements, and I'm unclear whether this change will also affect $form_state['values'].

Is it safe to do this, or is there another way to achieve the same?

Example code

$form['group1'] = [
  '#type' => 'fieldset',
  '#title' => 'My Grouped Fields',
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  'children' => [
    'body' => $form['body'],
    'field_smallprint' => $form['field_smallprint']
    ],
  ];
unset($form['body'], $form['field_smallprint']);

It seems to me that this is probably safe unless #tree is TRUE, but I don't want to implement something that might lose data, hence the question here.


texts: Upload a file to Drupal server from an outside URL

texts:
I am trying to cache in the server the profile images provided by the Facebook Graph API.
So far what I did unsuccessfully was getting the path of the image then calling:

$file = file_save_upload($big_pic_url, array(), $dest, FILE_EXISTS_RENAME);

This returns NULL every time. I tried several syntax for the destination path, and also for the Pic URL path, nothing seems to work.

I am doing this the right way? Can file_save_upload() take an external link as part of its argument?


texts:
I'm working with drush & git and I would like to create a custom drush alias to perform a "git pull" action on a remote server.

This is possibile creating a drushrc.php file in drush home directory with this command:

$options['shell-aliases']['git-checkout'] = '!git checkout';

So if I run

drush @mysite.test git-checkout

the system performs a "git checkout" on the test server.

The problem is that I would like to send parameters, like:

$options['shell-aliases']['git-checkout'] = '!git checkout %branch';

and so:

drush @mysite.test git-checkout my_custom_branch

should checkout a specific branch.

Is there a way to do this?


texts: Manually Send Ajax request to a PHP file

texts:
It seems that the Drupal Ajax  API are comming a little un handy for my current project so i was trying to do the ajax request the good old way with actual Javascript.

I have this code

valdBut.click(function(event){
    event.preventDefault();

            jQuery.ajax({
            type: "POST",
            dataType: 'json',
            data: grabValue(),
            url: urkl,
            success: function () {

                alert(back)

            }
        });
    alert(grabValue())

})

What i am wondering is how should i link that URL value to my module page, so that my user_login hook receive the data sent via Ajax ?

Thanks for any help,
Manu


texts: How to pass the node id from a View Block to an associated Views Attachment for use in filters so that both operate on same content node id?

texts:
What would I need to do to pass the node id from a View Block to an associated Views Attachment for use in the filters in the Attachment View so that both operate on same content node id?

My specific example is for generating preview/teaser output from a media gallery with a certain tag:

The title of the latest gallery with that tag
The latest 3 thumbnails of that gallery

(I know how to build a block view to fetch thumbnails from galleries (i.e plural) that have a certain tag - my solution is here: https://drupal.stackexchange.com/a/13559/1082 I am using the Acquia Media module)

BUT what I don't know how to do is to get the title latest gallery (singular) with a certain tag followed by the latest 3 thumbnails of that gallery.

I attempted to create a block view that fetched the title of the gallery with the certain tag and I also created an view attachment to fetch the thumbnails of that gallery. But I could not work out how to pass the node id of the gallery from the block view to the attachment for it to use in its filters when fetching the thumbnails.

I tried various options including enabling the attachment to inherit arguments and filters from the block view and also contextual filters but no success so far.

Further to this, I may wish to out put more than one gallery in the teaser/preview but if I set the count to more than one on the view block I get the other gallery titles listed together followed by the thumbnails. I would want each gallery in turn to display the title followed by thumbnails that belong to it.

I would prefer to do this all withing Views i.e. not have to use PHP. I would want the solution to be as forward compatible as possible, i.e. not break with future updates - if we can stay within Views then the migration to those might be easier.


texts: How to send email using Rules from user references CCK Field?

texts:
I have 2 types of content that are: Videos and Customers.

A video can be related only by 1 customer. I want that when a video is created or edited, will send an email to the customer associated with the video.

"Videos" has a Node_reference that is the customer reference. "Customers" have a user_reference referencing the corresponding user.

Then, using Rules for send mail but I don't know how to get the email of the user from the field node_reference from "Videos" to user_reference of "Customers".

How can I do this?


texts: Can't login to local site (Already tried some things)

texts:
Apache Rewrite module is working. tried using the following addresses in aim to login (I am not logged in and therefore can't enable Clean URL's):

localhost/Benos/?q=user/

Both of the addresses brings me back to localhost, and thus I kinda stuck and can't login... Why would this happen? Thx.


texts: How to show the data returned via hook_views_data() in a page?

texts:
I have hook_views_api as follows :

function hook_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'faq') . '/views',
  );
}

and i have the hook_views_data() function in views folder as follows :

function hook_views_data() {
  // faq_questions table.
  $data['faq_questions']['table']['group'] = t('FAQ');
  $data['faq_questions']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );
  $data['faq_questions']['question'] = array(
    'title' => t('FAQ short question'),
    'help' => t('The short question text for FAQ nodes.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
  );
  $data['faq_questions']['detailed_question'] = array(
    'title' => t('FAQ detailed question'),
    'help' => t('The long question text for FAQ nodes.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
  );

  return $data;
}

How can i show the results returned by the hook_views_data() in a page ?


texts: Error when using hook_form_comment_form_alter()

texts:
I am using the following function in template.php to modify the comment form to remove the form title and add a default value inside the form:

/**
* Implements hook_form_comment_form_alter().
*/
function mytheme_form_comment_form_alter(&$form, &$form_state, $form_id) {

    $form['subject'] = array(
      '#type' => 'textfield',
      '#maxlength' => 255,
      '#attributes' =>array('placeholder' => t('subject')),
      '#required' => FALSE,
    );

    $form['comment_body'] = array(
      '#type' => 'textarea',
      '#maxlength' => 255,
      '#attributes' =>array('placeholder' => t('comment')),
      '#required' => TRUE,
    );

}

It does the desired task but it causes an error where the form will submit but the contents entered into the body are not submitted and will not display. The following error gets generated:

Notice: Undefined property: stdClass::$comment_body in comment_submit()

Am I missing something within the function so the text inputed is actually submitted when saving the form?


texts: How should I add ID or classes to secondary tabs?

texts: I'm developing a site in drupal 7. I see that the function theme_menu_local_tasks() in includes/menu.inc is responsible for generating the secondary tabs. However the <li> elements do not have any IDs or classes. How do I start adding IDs and classes to the list elements?


texts:
We have themed the user registration page by hook_theme() as follows

function ourmodule_theme(&$existing, $type, $theme, $path) {
  $hooks = array();
  $hooks['user_register_form'] = array(
       'render element' => 'form',
       'template' => 'user-register-form',
 );
 return $hooks;
}

This is getting reflected in the user creation page when we log in as admin as well. We want to use the custom template only for anonymous users.
How can we do this?
We prefer to do it via module itself.


texts: How do I put a reset button on my view's exposed filters?

texts:
This a really basic question, but it stumped me for a moment and there was little I could find on the net that answered this most basic need.

By default when you expose filters in a view, the only button that shows is 'Apply'.  I have seen reset buttons elsewhere on the site and on example sites but I don't know how to make it appear on my view.

How do I put a 'Reset' button on my view to reset the exposed filters?


texts: Seller and Buyers Own Comments (Commerce Communicae)

texts:
I would like to have a way for my seller/author (author of node) and my buyer/user (not author of node) to communicate.

First, I have looked at the comments. If I allowed buyers to only start one comment and seller only able to reply to that buyer's one thread.. I envision buyer adding comment and seller only being able to reply to that comment. the seller would also see comments from other buyers; one thread per buyer so the conversations are grouped by buyer; for the seller to see. The buyer would see only their initial starting comment and any replies from the seller.

If used a view to contextually filter for same exact node and contextually filter for logged users authored nodes. basically showing the same node if logged user is seller. then I just use view mode to display the comments only. this results in the seller/author seeing entire comments.. in this case id only have to limit buyers/users to making one comment thread and the seller/author view would be 'finished'

How do I limit buyers/users from posting only one initial tread that buyer and seller reply back and forth. so from sellers view, they see buyers only once in comment list and the conversation there.

For the buyer I haven't been able to use view block to make correct relationships to get the buyers initial comment thread as well as the authors replies to it..

Should I use two views and better filters and relationships, (or
even 1 view?)
Should I make new content types or entities instead
of using comments? (id hope to leverage the comment form, and email
alerts and rest of comment stuff instead of making new framework
Should I consider other modules or organic groups? (again comments is
so close id hate to reinvent the wheel.
Should I consider livechat module and have it make a separate chat channel per item, per buyer/seller?

Edited
It seems to me that if I can keep user making only 1 comment, if I can target the start of the thread I can then say grab only the buyers comment starting tread.

Added
So tried entity construction kit and was further than comments is already from my goal. used entity reference field so in node edit you saw a message text field; didnt want that.

Also tried some modules for buyers to only start one comment thread. onecomment, one_comment_only... did not have what I was looking for.


texts: display views3 output at page--mypage.tpl.php

texts:
Using drupal7 views3 i created views(products) to display an image and relevant title of my content. I selected in products to display content as block not page. I created an overriding page template page--mypage.tpl.php, where i impose my own html-css layout. My question is, that i want to display the content of newproducts block at page--mypage.tpl.php:

[title] [image], [title2][image2], [title3][image3]

I have created the html/css in page--mypage.tpl.php for the above layout. Now, i don't know how to retrieve the produts output to populate the above layout. For example, I used , or content);?>, but i couldn't accomplish my objectives. Someone who knows this theming could let me figure out this issue please![my html/css layout][1]!


texts: How to hide webform label from email only?

texts:
I'm currently using the Webform module to build a warranty support form for Drupal 7.
Here is a screen shot of the webform:

Below is the email output I receive when the form is submitted:

James Blunte.g. Joe Smith (jamesblunt@123.com) has submitted a warranty request.
Order Number: 39840e.g. 1248

I've used the right label to show examples of what to enter in the field on the webform. My question is how do I hide the label from showing on the email template? As you can see the label follows right after the value.
Here is a screenshot of my 'Edit Components' page:

I can see how it's useful for the label to appear, but in my case I don't need it in the email.
Thanks for your time!


texts:
I recently developed my first module. Part of its functionality is to store names, e-mails, and phone numbers of people on a newsletter. They sign up through the front-end and the admin can review and modify them on the backend.

In addition it also stores SMS messages and their details (date sent, number sent from, message, etc) that come in from a short code. This process is triggered by an HTTP request. Again, the admin can review and modify these in the admin of the website.

And finally, the same install will host 15-20 tables with ~20 columns and ~170 rows of health, education, and water quality statistics that can be queried from the website.

So that's everything: newsletter list, sms messages, data

I've never worked with a CMS and added so much to the default database. I also lack a lot of knowledge about databases. So my question is Should I store all this extra information in a different database? My current hosting allows for 20, and I'm only utilizing one.

Let me know if you need any extra information. Thanks in advance!


texts: How can I add a cancel button to the content add form for a single content type?

texts:
I have several content types on a site and most of them are user-editable but not user-creatable.  However, one content type, Image, allows users to upload a picture.  Sometimes, however, users upload the wrong picture and they panic because they don't want that picture to be submitted to the site.

Of course they could always hit the browser's back button, but I'd like to add a Cancel button for additional assurance.

I found this thread that gives various solutions for adding cancel buttons on Drupal.org as well as this feature request for adding a cancel button to D8.  However, there are several different general approaches and I don't know how to limit one to a given content type (in this case, my_image).


texts: What does `OWNER` value mean in Rules export?

texts:
When exporting a rule from Rules module you get some serialized representation of that rule.
I understand everything but the 'OWNER' property in the export string - it has 'rules' value, but what does it mean specifically?

If I want store this rule in code within my module, do I need to change this value to 'module_name'? What are the implications here?


texts:
What I have is a view that shows couple of nodes of type "product", they are related by an SKU ID.

What I'm trying to achieve is a way to switch between those related product produced by the view without refreshing the page.

Checking "Use Ajax" in my view did not achieve what I want.

Thanks,


texts: On node creation date field is huge when there is end date (required), so i would like to have it inline like on this image:


texts: Search API Solr Configured, Content Indexed, No Search Results

texts:
I'm running a Drupal 8.6.13 site with Search API 8.x-1.12 and Search API Solr Search 8.x-2.7. Everything seems to be properly installed and configured - my Solr admin panel shows a configured core and everything looks fine on my Drupal admin interface. I have the index set to process the body fields of my content and custom blocks using the fulltext type; I have 198 items indexed:

{ "response":{"numFound":198,"start":0,"maxScore":1.0,"docs":[] }}

The problem is that a search for a word that definitely appears in my content isn't producing any results. I'm using the config files from the Search API Solr Search module.

Solr Search Devel shows the request being sent to the server and an HTTP "200 OK" response being received. The logged response was:

{ "response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[] }}

What else could I be missing?

Some more detail:

I can retrieve documents from the index using a command line query, like this:

$ curl "http://localhost:8983/solr/mycore/select?indent=on&q=:"

Here's an example of one of the returned documents:

  {
    "id":"6a1a2p-content-entity:node/100:und",
    "sm_context_tags":["search_api_X2f_index_X3a_content",
      "search_api_solr_X2f_site_hash_X3a_6a1a2p",
      "drupal_X2f_langcode_X3a_und"],
    "tm_body_1":["Ignition Timing (Vacuum advance disconnected, lines plugged) 6° BTDC Dwell Angle 30-33° Point Gap .020\" Spark Plug Gap .035\" Idle RPM * (Manual Transmission, no A/C) 725 Idle RPM * (Manual Transmission, with A/C) 725/500 ** Idle RPM * (Automatic Transmission, no A/C) 675 Idle RPM * (Automatic Transmission, with A/C) 675/500 ** Firing Order 1-5-4-2-6-3-7-8 * Set idle speed with headlights on high beam, air conditioning off. ** Higher RPM, solenoid energized. Lower RPM, solenoid de-energized.  "],
    "spell":["Ignition Timing (Vacuum advance disconnected, lines plugged) 6° BTDC Dwell Angle 30-33° Point Gap .020\" Spark Plug Gap .035\" Idle RPM * (Manual Transmission, no A/C) 725 Idle RPM * (Manual Transmission, with A/C) 725/500 ** Idle RPM * (Automatic Transmission, no A/C) 675 Idle RPM * (Automatic Transmission, with A/C) 675/500 ** Firing Order 1-5-4-2-6-3-7-8 * Set idle speed with headlights on high beam, air conditioning off. ** Higher RPM, solenoid energized. Lower RPM, solenoid de-energized.  "],
    "site":"http://example.com/",
    "sort_title":"PRD2\u0005\u000eRH\u0004NH2.:4:.*P:FDN\u0000",
    "_version_":1630197909793275904,
    "ss_search_api_datasource":"entity:node",
    "sort_body_1":":6D:P:FD\u0004P:B:D6\u0004\t<8e>T*.RRB\u0004*0T*D.2\u00040:N.FDD2.P20\u0006\u0004@:D2N\u0004H@R6620\t<90>\u0004\u001f\fS\u0004,P0.\u00040V2@@\u0004*D6@2\u0004\u0019\u0013\u0005\u000e\u0019\u0019\fS\u0004HF:DP\u00046*H\u0004\b\u0013\u0017\u0013\tx\u0004NH*L>\u0004H@R6\u00046*H\u0004\b\u0013\u0019\u001d\tx\u0004:0@\u0000",
    "index_id":"content",
    "ss_title":"Tune-Up Specifications",
    "hash":"6a1a2p",
    "ss_search_api_id":"entity:node/100:und",
    "timestamp":"2019-04-07T22:57:56Z",
    "ss_search_api_language":"und"}

So then I tried a query using a term found in the content above:

$ curl "http://localhost:8983/solr/mycore/select?q=solenoid"
{
  "response":{"numFound":0,"start":0,"docs":[]
  }}
$

Why might the second query fail to produce results if the search term is included in the document as shown in the full list of results?


texts: Correct way to add language switcher to a menu

texts:
I'm trying to add a language switcher to one of my menus using the hook_preprocess_page():

function <MODULE>_preprocess_page(&$variables) {
  // append language switcher to top_menu
  if(drupal_multilingual()) {
    global $language;
    include_once DRUPAL_ROOT . '/includes/language.inc';
    $info = language_types_info();

    $lang_types = language_types_configurable(FALSE);

    $path = drupal_is_front_page() ? '' : $_GET['q'];

    foreach($lang_types as $type) {
       $languages = language_negotiation_get_switch_links($type, $path);
       if(isset($languages->links)) {
         foreach($languages->links as $lang => $link) {
           if ($lang != $language->language) {
             $alias = drupal_get_path_alias($link['href']);
             $info = path_load(array('alias' => $alias));
             if(drupal_is_front_page()) {
                $alias = '';
             }
             $variables['page']['top_menu']['menu_block_2']['#content'][] = array(
                '#theme' => array('menu_link'),
                '#title' => $link['title'],
                '#href' => $alias,
                '#attributes' => array(),
                '#query' => array('language' => 'sv'),
                '#localized_options' => array('query' => $link['query']),
                '#below' => array(),
                '#original_link' => array(),
                '#bid' => array('module' => 'menu_block', 'delta' => 2)
             );
          }
        }
      }
    }
  }
}

I display the normal top menu in my page.tpl.php like this:

      <?php if(isset($page['top_menu'])): ?>

        <?php print render($page['top_menu']); ?>

The above code works fine for my normal menu, but I also have a mobil menu which content I store in the following two variables:

function <THEME>_preprocess_page(&$variables) {
  $main_menu_tree = menu_tree_all_data('main-menu');
  $variables['main_menu_expanded'] = menu_tree_output($main_menu_tree);
  $top_menu_tree = menu_tree_all_data('menu-top-menu');
  $variables['top_menu_expanded'] = menu_tree_output($top_menu_tree);
}

Then in my page.tpl.php file I output the contents for my mobil menu like this:

  <?php print render($main_menu_expanded); ?>
  <?php print render($top_menu_expanded); ?>

The strange thing is that the language switcher isn't added to the mobile menu, while it turns up without any problems in the normal menu.


texts: Which is the difference between the Full content and the Default mode?

texts:
The FieldUI uses the default as default value for entity form/view displays. But the EntityViewBuilderInterface uses the full as default value.

Also template_preprocess_taxonomy_term() uses the full value to find out if the current page is taxonomy term.

So which one should I look for to know if "default" mode is being used? Should I be checking both values?

I think this applies to D7 too but I'm working with D8 so I'm looking for information within this context.


texts: How to download programmatically a module?

texts:
I need to programmatically download projects from drupal.org, and then eventually enable it with modules_enable. Anyone knows how to do it?

Here's the final solution :
I'm sharing the code i used for those who'll face the same problem.

    /**
     *
     * Function downloading the last version of the module in MY_MODULE_MODULE_DIRECTORY
     * $modulename correspond au nom system du module
     *
     * @param string $modulename
     */
    function MY_MODULE_download_module($modulename) {
      // DEBUT CODE TELECHARGEMENT

      $base_url = 'http://updates.drupal.org/release-history/' . $modulename . '/7.x';
      // @TODO MODULE NAME

      $xml = drupal_http_request($base_url);
      if (!isset($xml->error) && isset($xml->data)) {
        $data = $xml->data;
      }
      try {
        $xml = new SimpleXMLElement($data);
      }
      catch (Exception $e) {
        // SimpleXMLElement::__construct produces an E_WARNING error message for
        // each error found in the XML data and throws an exception if errors
        // were detected. Catch any exception and return failure (NULL).
        return;
      }
      $json = json_encode($xml);
      $array = json_decode($json, TRUE);
      $download_link = $array['releases']['release'][0]['download_link'];

      $path = MY_MODULE_contrib_dowload($download_link);
      MY_MODULE_archive_extract($path, MY_MODULE_MODULE_DIRECTORY);

      // FIN CODE TELECHARGEMENT
    }

    /**
     * Fonction downloading a file
     * Inspired from update_manager_file_get($url).
     * Upload the file in the temporary folder
     *
     * @param url $url
     */
    function MY_MODULE_contrib_dowload($url) {
      $parsed_url = parse_url($url);
      $remote_schemes = array(
        'http',
        'https',
        'ftp',
        'ftps',
        'smb',
        'nfs'
      );
      if (!in_array($parsed_url['scheme'], $remote_schemes)) {
        // This is a local file, just return the path.
        return drupal_realpath($url);
      }

      $cache_directory = _update_manager_cache_directory();
      $local = $cache_directory . '/' . drupal_basename($parsed_url['path']);
      // load the file in the right directory

      return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE);
    }

    /**
     * Function inspired from update_manager_archive_extract($file, $directory)
     * extracts a file to a directory
     *
     * @param path_to_file $file
     * @param path_to_directory $directory
     * @throws Exception
     * @return A path
     */
    function MY_MODULE_archive_extract($file, $directory) {
      $archiver = archiver_get_archiver($file);
      if (!$archiver) {
        throw new Exception(t('Cannot extract %file, not a valid archive.', array(
          '%file' => $file
        )));
      }

      // Remove the directory if it exists, otherwise it might contain a mixture of
      // old files mixed with the new files (e.g. in cases where files were removed
      // from a later release).
      $files = $archiver->listContents();

      // Unfortunately, we can only use the directory name to determine the project
      // name. Some archivers list the first file as the directory (i.e., MODULE/)
      // and others list an actual file (i.e., MODULE/README.TXT).
      $project = strtok($files[0], '/\\');

      $extract_location = $directory . '/' . $project;
      if (file_exists($extract_location)) {
        file_unmanaged_delete_recursive($extract_location);
      }

      $archiver->extract($directory);
      return $archiver;
    }


texts: Content type select field is not listing in front end

texts:
I created a content type field called  which have widget type select list

But its not displaying the field in frontend. When I changed the widget type to the text field it displays the field in frontend. I  given the edit and view permissions to the filed too

But its not displaying in the front end.


texts: Rate widget 1.4: Ajax does not work any more

texts:
Since I have updated the rate module to 1.4 Ajax does not work any more for voting. That means, that the whole page is reloaded by clicking the rate button. The cause of that problem is, that the rate.js is included before the jquery.js. This leads in Javascript error:
ReferenceError: jQuery is not defined @ */sites/all/modules/rate/rate.js?mcndu4:60

What could I do?

I changed line 292 in rate.module from:

drupal_add_js(drupal_get_path('module', 'rate') . '/rate.js', array('scope' => 'footer'));

to

drupal_add_js(drupal_get_path('module', 'rate') . '/rate.js', array('scope' => 'footer', 'group' => JS_DEFAULT,  'weight' => 200));

Just for testing, but did not help. The I commented the line out and added the line

scripts[] = rate.js

to rate.info.
Now it works again. I know that this is not a good solution, because now the JS is loaded every time on every page. But I am a bit helpless at that point not having any idea what could be the cause of that strange issue.

An other problem is, that rate widget refuses to work with ajax, if it is loaded via ajax it self.


texts: where does the drupal6 cck field default value stored in database?

texts:
Is there a way to get the default value in a cck field (in drupal 6)?When I set the default value,the nodes created after that, are having this default value.(in database also ,table name is content_type_contenttypemachine).

Initially I set the default value as '1000' and later changed it to "4000" but when am trying to get the value from the content type table its retrieving the first value as "1000" and not the recent value "4000".

Is fetching the last record is the only way to get the latest default value I have set?

Thanks in advance,
cheers.


texts:
I have a theme that uses several template files like page.html.twig, page--title.html.twig, etc.

I installed Metatag to make my website more understandable when sharing links to it via LinkedIn. However, after installing the Metatag module, my  tags in all pages except admin are blank. I also tried to specify the title tag's content within Metatag as [current-page:title] | [site:name], but the title tag is still empty

I know this is a common issue. I have found this online

  When using custom page template files, e.g., page--front.tpl.php, it
  is important to ensure that the following code is present in the
  template file: <?php render($page['content']); ?> or <?php render($page['content']['metatags']); ?>. Without one of these
  being present the meta tags will not be displayed.

However, that looks like an advice for Drupal 7 only - and I don't know how to do this in a TWIG file used by Drupal 8. Any advice would be appreciated.

EDIT: My TWIG files are as follows:

page.html.twig: https://codeshare.io/5ezppb
html.html.twig: https://codeshare.io/2KWnnE
page-title.html.twig: https://codeshare.io/G8XeeD


texts: I'm working with the Workflow module, and I'm trying to validate fields before a state change is allowed. What mechanisms exist to allow this?


texts: I am working with user pages and I have styled a user page with a custom .tpl and I am using a block to bring in the latest post from that user using views. I am having a problem sorting out the posts with contextual filters. I have set up the contextual filter to work if the URL was /user-name but because it is a users page the URL is /users/user-name and this is screwing up my filter. Any advice someone can give me?


texts: How to make a user role expire after 1 year?

texts:
I'm looking for a way to make a user role expire after 1 year. In Drupal 7 there is the Role Expire module. I found this post using the Rules module. But I can't seem to figure out how to do this in Drupal 8.

More specific, what I want is for a user to buy a Commerce product when payed, the user gets a user role to read articles behind a paywall. This role should be active for a year.

The only option I found is building a custom module but I want to try and find an other to do this first. Hope someone can help with a good suggestion or a push in the right way.


texts: How to add custom attributes to description meta tag?

texts: I need to add 'class' and 'data-type' attributes to meta tag containing description attribute. I was able to locate the core Metatag module, however I'm unable to find any documentation on how to customize output without altering the core.


texts: how to order grouped fields in the sidebar on a node form

texts:
On my old Drupal 7 site, I was able to group a set of fields and display them as a tab in the sidebar. I'm moving it to Drupal 8 and using the adminimal theme. I created groups and am using the details sidebar widget. I'd like my custom groups to appear at the top of the sidebar. I've assigned a weight of -5 in Manage Form Display, but they still appear in the middle of the sidebar (even after clearing caches). Is there a way to control the order of groups in the sidebar, or am I maybe using the wrong widget? Thanks.
I have tried using Vertical Tabs Config, but even after clearing caches, the order is unchanged.


texts: Safe change of field type from text to email or link

texts:
I have some field types that are in text and have data and I need them to be a link or email type (ie. email module.) I realize there are several approaches:
change in D7 database.
Use the migration module.
Export as Feature and re-import.

Does someone have experience addressing this and a suggested approach?


texts:
In my project I would like to add the following attributes to my "Login" main menu item:

data-toggle="modal" data-target="#login-modal" (Am using the Bootstrap theme)

I checked out the menu attribute module but it does not allow for these attributes.

Please is there a way?


texts: How to create views to views that leads to final destination content item?

texts:
I've been stuck with this problem for 2 weeks now, and I can't get it  working properly. It's so hard to explain that I made an infographic for it!

Basically I need a view that links from view to view until reaching final content items.

I know that it is a contextual filter setting or path, but I can't figure out the settings.

This is what I'm trying to achieve:


texts:
I am creating a custom template for my theme and I am constructing a page.html.twig page. I want to call of the individual node fields into separate rows. I have been able to successfully display everything except the paragraph field.

I have tried.

{{ node.field_benefits }}
{{ node.field_benefits.value }}
{{ paragraph.field_benefits }}
{{ paragraph.field_benefits.value }}
{{ node.paragraphs.field_benefits }}

And nothing has worked. Does anyone have any idea of the correct structure to call in the paragraph module?

Or would a for function work

{% if node.field_benefits %}
{% for field_items in node.field_benefits %}
{{ field_item.value }}
{% endfor %}
{% endif %}


texts: Rule that sends one email out at specific time each day with view content in it

texts:
I have 5 different views that show different metrics within blocks on the front of my website. I want a rule that can send this information to me by email each day at a certain time. How do I do this, as there are 5 views, so I need the information put into one textual email. An ideal world would actually be a screengrab or pdf of the front page of my website, but I assume this is a bit more complex. I installed the module called Once Per Day

I started with:

EVENTS: Once per day

CONDITIONS: Current day of the week
Parameter: Day of the week is a: Working day (Monday to Friday)

But I have no idea how to set the actual time of this or how to get any of my view data into the email.


texts:
I imported some translations using the locale update module but the translations are horrible and it would be better to revert to English.

How do I bulk delete all the imported translations in Drupal 8?

I found an issue on adding back the D7 translation string deletion option to the UI, but I want to mass delete all strings, not individual strings.

Drupal 7 version of this question

EDIT: Deleting the language is one approach, but I can't do that because I already have a lot of content translated into the language.  I want to keep the content that I have translated into the language, but delete all the user interface strings that were imported through localization update.


texts: Moving data from a Drupal 6 site to a new Drupal 7 site

texts:
This is not an drupal 6 to 7 upgrade question, at least not in the way it's conventionally asked or done. I have an ill pressflow 6.17 site with loads of not necessary modules, configurations, etc, which I need to convert to Drupal 7 (Pressflow 7 doesn't seem to be round the corner as work on Drupal 8 has just started) so this will be a new site with its own set of modules and configurations but with the same data as the old site. I don't want anything from the Pressflow site to creep into the Drupal 7 site except for content; I don't want the views, imagecache presets, etc. I am looking to get advice on just moving the data (content) from Pressflow to Drupal 7 site; therefore, the usual upgrade process will not work for me.

I have used the migrate module before for an ASP to Drupal migration and it works great, but it's also kind of messy with source tables residing in the same database, and since task at hand is to move data from one Drupal version to another I am hoping for a much simpler/quicker technique.

What would be the best/quickest way to move content and only content (including ratings, comments) from Drupal/Pressflow 6 to Drupal 7 site (except migrate and table wizard, not that they don't fit the bill).

[UPDATE] - I am currently investigating nate's approach when he migrated his site from drupal 5 to 7. It might work for me; I will update.


texts:
I have vocabularies "destinations" and vocabulary "places". Destinations vocabulary is for example : Europe>France>Paris Place vocabulary is: museums, restaurants, pubs...

I set the path pattern (url alias) for destination content type: [node:field-destinations:parents:join-path]/[node:title]

I also have Place content type [node:field-destinations:parents:join-path]/[node:field-destinations:name]/[node:field-place:name]/[node:title]

Every Destinations content is tagged with destination term and every Place content is tagged with destination term (where is that museum, pub or... located) and also with place term (what kind of place is, is it museum, pub...)

Basically, I want to make views page so when user is visiting Paris page (url alias is europe/france/paris) he should have All places link (in the menu block) pointing on the All places page where he will see listed and grouped museums(3), restaurants(7), pubs(9) or as much as exist for that destination...

I tried everything, I'm sure there is the way to achive it, but I'm missing something...Or am I doing something wrong from the beginning. I'm still not so familiar with Drupal API so I cannot make my own module at this moment.

I suppose that i need views page for all places (grouped by taxonomy term from location vocabulary) and then somehow to pass destination term filter from previous page (europe/france/paris) when the user click to paris he will go on views page europe/france/paris/all-places where he should see Museums (number of museums) and other locations. All that links should link to separate page europe/france/paris/museums views page with, again, listed place content for that destination.

I know this is more than one question but I needed to explain what kind of things I'm trying to achieve.

So, short resume: Can I pass filter term from previous page (term paris) and is there I way to make this grouped place link (Museums (8) Restaurants (22)...) and make them link to separate term page. And, the crucial is to preserve url in views pages, for example all-places page: europe/france/paris/all-places, and for specific place page: europe/france/paris/museums

Can this be done with views module, contextual filters and with some kind of arguments in views url (but Drupal dont allow argument at the first position in url).

Any advice would be helpful, if you have any idea how to achieve this... Thank you very much for your time and help!


texts: Getting white screen in Login /user and the page content

texts:
I was recently editing a website with Drupal 7 installed, and was integrating twitter feed.

I created a block twitter_feed_block and assigned the block to the content section of the front page. It worked fine.
Then I tried to move to twitter_feed_block to multiple places (like right sidebar, header, menu etc). This move caused multiple contents on the main page to disappear.

Now every link in the website is showing a white screen. Sadly i tried to log out and login again and found the login at WEBSITE/user has also disappeared.

Attached a screenshot


texts:
Possible Duplicate:
  What are the recommended directory permissions?

I have recently installed a site on a debian LAMP server. I've finally got to work by changing the permissions to -

/sites                - 755

/sites/all                    - 755

/sites /default           - 755

/sites /files                 -777

/sites /default/settings.php  -755

/private            -777

/public              -777

/sites /files/tmp                  -777

However, i am unsure if these are the correct permissions to use and they don't create any vulnerabilities.

Thanks in advance.


texts: Views: Multiple AND/OR operators in contextual filters

texts:
I have created a page view that displays customer nodes. The result is filtered by a contextual filter based on a taxonomy term id from url. To allow multiple filter values i'm using OR (+) and AND (,) operators in the url. However, combining those operators doesn't work.

  Url's like this work:

  /finder/220+300+121
  /finder/220,300,121

  This doesn't:

  /finder/220+300,121

So i'm looking for a view setting or a module that allows multiple OR/AND operators. Here is a screenshot of what i'm trying to build.

Show me all customer nodes that are in industry3 OR industry5 AND are from Product1. This would be this url: /finder/220+300,121

Any ideas? Thx...


texts: Automatically shorten URLs on website with other domain name that I own

texts:
Yesterday I purchased the domain stps.me to be able to shorten URLs for my other website setups.co.

I found two modules, Shorten URLs and ShURLy, that were able to shorten URLs.

However, I can't find the option to use my own domain name, and therefore I'm asking you for help.

I know there's a free tool to make your own URL shortening service called Yourls, but I can't figure out how to implement this to Drupal to automatically shorten and display a URL when I upload new nodes.

Thanks in advance :)


texts: Distributed authentication system (different domains, separatate databases)

texts:
We got multiple small websites (microsites) and one main high traffic one with big users base. Right now the requirement is to build authentication system which should allow users to loign with the same identity across the network.

All website are running on different domains, powered by Drupal 6 CMS and have separate databases (so sharing tables with prefix is not an option + it creates a huge mess in the db).

Here is the set of core requirements I came up with:

Users should be able to login with the same credentials to all sites within the network
User’s data sharing between Main site (storage) and all micro sites within the network
Data synchronization across the network when user changes the data (update email or password for example)
The login/registration process should be seamless and consistent
Register on any of the sites across the network and use that identity to login later on.

In the future there might be a need to add openid authentication options.

Basically we are looking at something similar stackexchange does, but not sure if they have central users base on not.

I was thinking about custom solution which will include 2 parts (modules), one will be stored on the Main site for users data storing and responding to requests from clients. Second part (module) will be placed on each microsite, which is going to send requests to the Master. Some kind of client - server setup.

One of the complications I see right away is #3. Data Synhcronization across the network.

I just don't want to reinvent the wheel and maybe some work is already done in this direction.

Looking forward to your ideas on how to approach this project.

EDIT:

Recently I've found couple related threads on the topic:

http://groups.drupal.org/node/24916
http://drupal.org/node/744400


texts:
Is it possible to use views to render block with add to cart button, then add a contextual filter, so I can use it in panels?

For testing, I tried to make a simple view consisting of add to cart buttons and use it on a product page, but it displays nothing.

The same is with displaying pictures attached to product. I can see them when creating view in view UI but how do I pull out data from product so I can display them on product page using using views or just placing a block on a page.

Any help would be appreciated. Thank you


texts: Managing featured content the drupal way

texts:
I currently have a homepage layout similar to the illustration below:

The featured nodes are all Views in separate block regions displaying a teaser. I'm using  a taxonomy term to filter in the specific node that I want appearing there.

As I'm new to Drupal, I'm wondering if:

a) My choice of using 4 separate block regions was wise. Would it have been wiser to use a view that shows a grid of 4 teasers?

b) If there is a better way of displaying featured content in the region below the slider (such as a 4 column panel)

Any insights into an effective workflow here would be greatly appreciated, thank you!


texts:
I have a an embedded view display (type = embed) with an exposed form and pager. Ajax is enabled for the display. The pager reloads the display via ajax, however the form does not. I'm all but certain the form used to trigger an ajax reload, but no longer does, and I'm not sure why.

I have used the viewsreference module, viewfield module, and straight views_embed_view() to embed the display and none produce a display where the form reloads via ajax. I have other sites using all three of these methods and those sites all have properly functioning views with ajax forms.

I have used the "Duplicate this display as Block" option in the views ui, placed the block on a page, and that form does reload via ajax properly.

I have tried different themes, including core themes, and the form still doesn't reload the display via ajax.

As far as I can tell, there's no markup difference between displays where views exposed forms are processed via ajax and those that aren't. (Comparing with another site. It seems that all embed display forms on this site won't filter the view via ajax.)

I don't have any custom code interacting with the views or their forms.

Does anyone have any idea what may cause Drupal views exposed forms to not process via ajax? Or can anyone recommend a way to further debug this?


texts: How to return all the tags from a specific vocabulary for the current node

texts:
I am trying to return all tags from a vocabulary but the code below keeps giving me error.

$vid = 1;
$nid = arg(1);

$getterms = db_query('SELECT t.tid, t.* FROM {taxonomy_term_data} t INNER JOIN {taxonomy_index} r ON r.tid = t.tid WHERE t.vid = :vid AND r.nid = :node_nid ORDER BY weight', array(':vid' => $vid, ':node_nid' => $nid->nid));

I am getting 2 errors:

Notice: Trying to get property of non-object in eval() ...
Recoverable fatal error: Object of class DatabaseStatementBase could not be converted to string in eval() ...


texts: Facet not filtering proper data using Solr Slop

texts:
I am using facet to filter the solr search result. It's working fine, but if I use solr slop to retrieve data all the records are proper and then try to filter the records using facet Sector, then the result displayed in location facet is improper.

E.g: initially search for England, it retrieves all data of England record include location, Sector Contract type data.Location details are displayed in location facet block. But when I do deep filter using Sector facet (sector records are within location searched I.e. England), I get records from Scotland location too. Scotland location is listed in the location facet along with England. Not knowing what is going wrong after using Solr slop as without it all the data retrieved is properly.


texts: how could the global $user be different between the Drupal interface and Services module?

texts:
If i do:

hook_node_view($node, $view_mode, $langcode) {
        global $user;
        var_dump($user);
        die();
        // i get the correct dump of the current pre-authorized user
}

HOWEVER, if I dump global $user from one of my public Service endpoints an anonymous user. That dump comes from a GET service resource defined as:

'retrieve' => array(
       'help' => 'Retrieves a note',
       'file' => array('file' => 'inc', 'module' => 'noteresource'),
       'callback' => '_noteresource_retrieve',
       'access callback' => '_noteresource_access',
       'access arguments' => array('view'),
       'access arguments append' => TRUE,
       'args' => array(
         array(
           'name' => 'id',
           'type' => 'int',
           'description' => 'The id of the note to get',
           'source' => array('path' => '0'),
           'optional' => FALSE,
         )
       )
     )

How could that be?

For my Drupal configuration:
I am using LoginToboggan and Generate Password to handle registrations with only an email address. Alongside I am using the Services module which drives the API for our mobile app to tell the app if the user is logged in or not.

Under /admin/config/system/logintoboggan I have:

  I have "Set password" checked
  a "pre-authorize" permission selected for the "non-authenticated" role prior to email validation.
  I "never delete" unvalidated users
  I allow "immediate login" checked

Under /admin/config/people/accounts (regarding passwords), I have:

  Selected "Users may enter a password on registration. If left empty, a random password will be generated. This always applies when an administer is
  creating the account."
  Selected "Do not display" under generated password display.

The flow works well from the Drupal interface. That is, the registration is successful, the email is sent, and the user is logged immediately with the pre-authorize role applied even before validating their email. HOWEVER, my API endpoints still show that same user as anonymous users session when accessing it with global $user. I can literally reload the two pages as if there were no connection between them.

I have cleared all caches.
I have weight-ordered the roles with pre-authorzed 2nd, after anonymous and before authenticated user
I have verified the JS cookies are identical between the API page and Drupal interface  (see the side by side comparison in the screenshots below) and that the $_SESSION globals shows nothing pre-authorized or more.

Is there another way I should access the pre-authorized user other than global $user?


texts: Services module retrieve node with PHP text format

texts:
I have successfully connected to a Drupal instance using JSON and even retrieved a node using the service.

Problem is that the node has php content type, and the service returns the raw php content instead of the eventual value.

What am I doing wrong? Is there a work-around to this?


texts: Stop css file renaming when working locally

texts:
I've followed this guide to setup settings.local.php:
https://www.drupal.org/node/2598914

And in my custom subtheme I have a stylesheet style.css which is working correctly. However when I look in the network tab in Chromium I see that the file is being renamed and loaded as the following instead of style.css

css_vUzTZgnz_vbCKVrMpGH7w6mCDpJcmKbwfvLonjhF6Yo.nbvVRORIA_VOZ9jlIN0xvyy_2wDJZdAeRBMnmfGNre0.css?poey84

Is there a way to stop this renaming using settings.local.php during development? I've tried turning off css aggregation through the GUI but I believe the changes in settings.local.php override this anyway?

Cheers


texts: Which is the equivalent of php drupal format_interval for javascript?

texts:
I want to use with JavaScript and Drupal.t() the equivalent of format_interval().

With PHP I would use the following code.

print t("!date ago", array("!date" => format_interval(time() - $lastActivity, 1)));

What would the equivalent in JavaScript be?


texts: How to display fields of an entity reference field?

texts:
My content type have an "entity reference field" related to another content type.

The only option I have is to display a link to the entity.

How can I display other fields from this entity?


texts:
I want get the pathInof in my template twig :

How i can reach pathInfo please in my template ?


texts: Clear example on how to use #theme for form API

texts:
I cannot find a good example of how to accomplish custom theming on a field level within a form:

$form['test_2'] = array(
  '#type' => 'textfield',
  '#title' => t('Test Field #2'),
  '#required' => true,
  '#description' => t('This is a test field which we hook into.'),

  '#theme' => 'custom_func'
);

Inside my template.php I have:

function MYTHEME_theme() {
    return array(
      'custom_func' => array(
        'render element' => ??? // WTF goes here???
      )
    );
}

function MYTHEME_custom_func($variables) {
  return 'Something';
}

This code obviously does not work...what am I missing?


texts: Permanent Deleting of files still doesn't work for me (make_unused_managed_files_temporary = true)

texts:
make_unused_managed_files_temporary didn't work for me.
I am using Drupal backend for the REST API frontend application.
Thats how the File input looks (because I am not sure if that setting is for that File elements, but guess so).

I read some informations about permanent files deleting, because I would like to delete files permanent from the file system and also database.
I was set the make_unused_managed_files_temporary to true and debuging, this is really true in the code.
I also found the configuration in Backend / File system - Delete temporary files after (6 hours), so this is on.
I am checking also the database file_managed before and after (and after 6 hours) file deletion for the flags like status that indicates isTemporary() method. But after uploading file, saving... then editing, and removing file, the file is still in the database as a status 1.
I am also checking DB table file_usage where there is still the item with count=1 too, that should be not true (because of deletion).
And files maybe should move to /tmp folder, but that doesnt.
I am working on Drupal 8.5.6 and 8.7.2 on production, but the behaviour is the same.
I am doing something wrong? Is there some cron to be configured? Or another futher settings?
Edit 1: I think it is not a Media, but simply file widget - /core/module/file
Edit 2: The main problem is that, when I delete file, it stay in the database as a permanent flag (status=1), and also it has a count of usage 1 (file_usage=1). When I manually update database to set status=0 and count=0, the cron works OK. Why the file usage and count stay on?


texts: How To Show Node Comment Count in node.tpl?

texts:
I have had the bright idea of changing my user permissions so as guests cannot see the comments on a node. I have no problems with Views around my site, as they can clearly see there are comments on nodes, and they will be more inclined to register. The problem seems to be when they arrive on my site directly to a node, they don't see any comment, and think "that's a bit crap; let's go."

Is there a way I could show the amount of comments below a node?


texts: Programmatically loaded taxonomy form ajax errors

texts:
I load a taxonomy term in the edit form via the following code:

module_load_include ( 'inc', 'taxonomy', 'taxonomy.admin' );
$vocabulary = taxonomy_term_load ( $tid );
$form = drupal_get_form ( 'taxonomy_form_term', $vocabulary );

The vocabulary has a custom text field with unlimited values, so this appears on the form, but when I click the "add another item" button, I get:

  Call to undefined function, taxonomy_form_term_validate() in [truncated path].../form.inc" on line 1513.

I appreciate any guidance I can get in solving this.


texts: Getting 'Page not found' when trying to post a comment using the Busy theme

texts:
I'm having a heck of time trying to get comments to post to my nodes. I've done all the obvious:

Enable comment module, set appropriate permissions, etc.

But every time I try to enter a comment it simply redirects to a "Add new comment" page and nothing gets posted. There is no comment in the Content -> Comments section and my database comment table is empty.

The only thing I can find relating to the issue is an error report in my log messages which displays a warning "page not found." I'm using the Drupal Busy theme.

Type: Page not found
Location: http://mysite/public://color/busy-0970ccd8/style.css?m
Message: public://color/busy-0970ccd8/style.css
Severity: Warning

I've ran the schema module and nothing is funky in with my database. Any thoughts on this? Much appreciated.


texts: Headless Drupal for managing multilanguage resources for Web/Android/IOS apps?

texts:
A company has content in 10 languages and 3 channels (web, ios, android). It creates a lot of overhead related to translation (external translation company has to be managed, translations sent etc.). Currently there's a dedicated tool to manage translation resources (basically a spreadsheet of strings with key name and values in up to 10 translations) and sometimes global variables (eg. user name) interpolated within. Potentially hundreds of them.

I'm considering using Drupal 8 as a single place to manage both rich content (articles) and low level UI strings. Additionally it would exposed a REST API for these clients. I'm not too concerned with the typical articles, but I want to make sure that working with these low level internationalised strings will be convenient in Drupal.

Some specific requirements are listed below:

1) structure strings hierarchically to allow easy identification of relevant app section by translators:

channel1 (eg ios)
 |--section 1 (eg. screen or step)
       |---key 1 (eg. en:confirm fr: confirmer de: ... )
       |---key 2

2) allow mass exporting of keys via API within whole section or full channel using single request for performance (in some cases such a bundle would be converted to static resources specific for given platform).
Graphql would be great here, any ideas on how to do it generically with REST API (to be able to fetch data hierarchically, either on leaf nodes or more aggregated on higher nodes).

3) Allow editors to search by key or by value in any language.

4) integrate with translation agencies APIs

5) Allow storing multiple versions / workflow states at the same time (published / new keys just added to specific app and waiting for translation / translation awaiting approval). Ideally tag specific versions to mirror various parallel development branches and allow fetching the individual key/ the whole set via API for specific branch for preview purposes.

6) Efficiently edit multiple keys at once in a single screen grid-like manner, rather than having to click x times to switch from one to another. Switching between language values should be really convenient.

I'd really love to know your opinions around how would you model this kind of content, eg/. each key separate entity? or section = entity and key = field? use taxonomy for categorisation? What if I want to store additional data about section, eg. Screenshot - with taxonomy it wouldn't be versioned. Wouldn't using CMS that stores content items in a tree out of the box make more sense?

Also it would be fantastic to get some ideas around whether any additional modules would be useful here (I'm thinking about Drupal 8) and what kind of Admin UI would you expose to manage it (built-in? custom?).

Also there's a key question lurking behind - do you think using Drupal for this is a good idea at all?

Thanks for any suggestions!


texts: hook_theme() in a custom file of my module

texts:
I'm facing an issue for a few hours now. I created a new module that must render an admin page with some settings and another one with analytics data. The second one must use a custom template file that I created for the occasion.

I added a hook_theme() in my .module file and everything worked fine for a while.

When refactoring my code I wanted to move the hook_theme() in a subfile.inc of my module. Even though I cleared the caches, I always get the issue Theme hook "my_custom_template" not found..

After moving back the hook in the .module file everything work again.

Are they some hooks that must be in the .module file only. As the hook_install() and hook_uninstall() must be in the .install file?


texts: Recoverable fatal error on nodes after leaving Maintenance mode

texts:
Our site was in maintenance mode for several days, and when we came out of maintenance mode a bunch (we don't know how many) of our nodes display this error:

  Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2136 of includes/database/database.inc).

This error can be found on this page -> http://www.relevantmagazine.com/node/109771
we are able to edit and save the node, but nothing we change fixes the issue.

Any ideas?


texts: Webform Conditional is not firing when using a hidden field

texts:
I am trying to hide/show a field from the user based on a hidden field, whos value is set from the server. I have set up a conditional so that if the hidden field 'X' value is 'a', then field 'Y' will be shown.

However, field 'Y' is being shown no matter what. I have tried reversing the logic (if hidden field 'X' value is not 'a', then hide 'Y'), but that did not change anything.

After much testing, it seems as though the conditionals of Webform will not actually do anything based on the value of a type 'Hidden' field. If I create the same logic with a 'Textfield' instead, the conditional fires as expected.

Is this a bug? Am I doing something wrong? The end result I am trying to accomplish is to hide or show a field based on an input that the user cannot change themselves.


texts: Cancel if condition not met, show status

texts:
I have the Mimemail module set up to send HTML mails out, after a form is filled in an email is sent to the user based on a custom template.
But the email should only be sent out if the user has previously filled in another form, if they haven't a message needs to be displayed and the email cancelled.
I'm simply using the following code to check that they have filled in the other form previously:
$query_result = db_query("SELECT MAX(sid) as max_id FROM webform_submitted_data WHERE data = '" . $email . "' AND nid = ###" )->fetchCol();

So if this returns an empty array then a message needs to be displayed and the email cancelled, but I can't seem to stop the email being sent, how do I do this?


texts:
I'm having a really strange problem with my test website. When users (both admin and non-admin) visit node pages, they are logged out and are being logged in again as the user who commented last on the node.

I've no idea what causes this behaviour, as I've never experienced this before. I don't have any caching modules and clearing caches multiple times brings no solution. What can cause this problem?


texts:
I have a strange situation where my Drupal 7 Omega 4 site appears to not be using a page.tpl.php template. The page renders and content appears but when I alter all of my page templates to indicate which one is in use (By adding a "
TEMPLATE NAME.tpl.php
 above the "print render($page['content']);") I see nothing in the rendered output on screen.

I have cleared the caches. Many times.

Is it possible for Drupal to somehow not use a page template and still render a page's content? I would have thought not but can't figure out how this could be happening.
I'm guessing I'm completely forgetting something quite basic here.

Any help greatly appreciated.


texts: Images only visible when logged in as administrator

texts:
All the images used on my site (e.g. user profile pictures, photos used in a slideshow, images inserted in content types, an image gallery, etcetera) are not shown anymore after logging in using a role other than that of administrator.

I am sure the problem is related to permissions (in fact, the error log shows Access Denied errors) however, after a lot of searching on the internet, testing (including disabling a number of modules), I still can not find the root cause and need help.

Some relevant information:

Site originally developed on a Synology NAS (Linux) (using Omega 4 theme).
Site exported to Acquia Dev Desktop (v. 7.26.29) on a Windows PC.
The version on Acquia Dev Desktop is used as developing environment.
Site on NAS server used as test environment.
Drupal version: 7.28
Site is developed with a section for members only.
Default download method: 'Private local files served by Drupal'.
The public file system path: sites/default/files.
The private file system path: sites/default/files/private.
All the images, except for the site logo, are stored within the private file system.
Using the "Content Access" module for setting permissions.

The moment I log out from a user account with administrator role, all the images (except logo) disappear. This happens on both sites (which is to be expected).
The error log clearly shows Access Denied errors for non-administrators, so there is a permissions issue.

What have I tried so far?

Play with file permissions: I have read dozens of posts on checking & changing file permissions in the files folder & the files/private folder (and sub folders). On Windows handling permissions is less straightforward than on the Linux NAS. However, on the NAS I have even changed the permissions on the private file folder and files to 777, and still the images are not shown for non-administrators.
Disable modules related to permissions: I have disabled modules that enforce access/visibility restrictions (like "Content Access", or visibility settings in "Panels"). But disabling these restrictions did not have any effect on the issue.
Change default download method & store files in public file system: new images stored are saved in public file structure and are shown also for non administrator roles. But I do not want the files to be open to the public.
Looked at impact of Drupal update since version 7.20: Some people suggested changing the setting "$conf['image_allow_insecure_derivatives'] = TRUE;" in the settings.php file. Did not test this, as this negates the security issue, so not an acceptable method.

Right now I do not know where to look & test any further, I spend almost a week finding out myself. Can anyone give me any pointers based on the above?

There is one element that I do need to mention, although I am not 100% sure it is (directly) related:
All the images I use are making use of image styles. Even as the Administrator, the modified sample file in the Image Style editor (dummy image on the right) is not shown. The link to that sample file goes all the way into the private file system (when download method is private). However, the dummy image is not shown and when I click on its place holder, I get an "Access denied" error (as Administrator!). Changing the default download method to "Public" resolves this particular problem, the dummy image is shown now.
The reason that I am not sure if this is in any way related, is the fact that I also added two image fields to an existing content type. Both without an image style, with one using the public file system, the other using the private file system. Upon logging in as a non-administrator, only the public file was shown. As the element of image styles was not part of the test, I assume that the image styles are not directly influencing here.

As said already, I could use some expert help to show me the right direction, as I am not seeing it anymore I am afraid.....


texts: How do i dynamically import changing feed links within a feed

texts:
I am uncertain how to approach this.

I have a feed with housing cases that is changing constantly. The feed consists of a case number and a feed link to that particular house. Each house has so much information that it has its own feed. Over time, more will be added and these feed links will change.

For each of these feed links, I want to create a single node. My issue is that I don't really see a solution on how to create these dynamic feeds from the one "main" feed.

It's going to be about 75-150 feeds within the "main" feed. So I have this list of changing feed links that I need to dynamically import.

This is in Drupal 8 and I have been trying to use the module feeds to accomplish this.


texts: How to hide "Include file in display" in File Field?

texts:
I'm using File Field in Drupal 7 to let users upload files, but after uploading there is a choice for users to let the file be included in display or not (radio button with "Include file in display" description). Now I want to remove this choice, because I need all of the files display for download, OR at least hide this for non-admin users. What should I do?
Thanks.


texts:
I want to Create like this type of Image preview on particular related images. I have image fields with multiple images for a content type, and I would like to obtain this effect.

Is there any possibility by creating views? Is there any way to obtain this effect with other ways?


texts: scandir error with quote inside $field->original_value

texts:
Can you explain why in my views-view-field--path-1.tpl.php this code:

$dir="sites/default/files/calibre_server/".$field->original_value;
$files=array_diff(scandir($dir), array('..', '.',''));

give me :

  Warning: scandir(sites/default/files/calibre_server/Patten, Lewis
  B_/Pour l'amour de Kate (1747)): failed to open dir: No such file or
  directory in include() (line 55 of
  /volume1/web/drupal/sites/all/modules/calibre_server/themes/views-view-field--path-1.tpl.php).
  Warning: scandir(): (errno 2): No such file or directory in include()
  (line 55 of
  /volume1/web/drupal/sites/all/modules/calibre_server/themes/views-view-field--path-1.tpl.php).
  Warning: array_diff(): Argument #1 is not an array in include() (line
  55 of
  /volume1/web/drupal/sites/all/modules/calibre_server/themes/views-view-field--path-1.tpl.php).

But

$dir="sites/default/files/calibre_server/Patten, Lewis B_/Pour l'amour de Kate (1747)";
$files=array_diff(scandir($dir), array('..', '.',''));

give NO ERROR/WARNING

it's like $field->original_value wasn't a string


texts:
I have a FB login button in the User login block. The login button has been working perfectly for months, but last night it broke. The functionaly still works (you can login), but the button shows tags to users:

<fb:intl>Login with Facebook account</fb:intl>

I upgraded Drupal core yesterday, but it should not have done anything to this. Today I tested it with old core version and the problem was still there. I have cleared all the caches, but no luck whatsoever.


texts: How to automatically create subitems based on node entries?

texts: I have a content type called "brand", and about 30 brands. I want them to automatically appear as a list of items below a main parent menu item. Is there something that does this already?


texts:
Question: Drupal 8 master site for managing customer Drupal 8 sites? Possible?

Goal:

There will be a master drupal 8 site developed for managing basic business modules.
These basic business modules should be available to all customer sites. (shared)
Also the user roles and users must be shared.

There is no 1 shared codebase.
There is also the need for customer site-specific modules that can be installed.
So log in with the credentials from the master site at a customer site is also needed.

A picture of the goal:

Research:

I have researched several solutions like:

Multi-Site
Domain Access

These solutions I have explored share the same code base.

Expected solution:

The solution that I want to achieve is no shared code base, each project has its own code base,
but also the modules of the master Drupal 8 installation.
This would come as basic business modules required for each customer site like
autopath and xmlsitemap.
So if I install a module on the master site must also be available in the customer site.

The master site code may be shared thus not 100%, but also not completely independent from each other.

Is that possible ? Are they better/other methods for achieving this goal ?


texts: Create Empty User as Admin, and force entering info on login

texts:
For my website, user accounts should only be created by the admin. However, the only fields that should be given by the admin are his full name. All other fields should be supplied by the user himself. For this, I have 2 things I would like to do:

1: Allow the admin to create a new user without supplying required fields.

2: Redirect the user to their profile edit page as long as there are required fields that have not been given.

For 2, I imagine it should be possible with the rules module, although I have not yet tried this. But is there a way to do 1? One thing I have considered is to add a custom page with a simple form to create the user, and to have custom PHP code that will actually create the user. However, I am hoping this is possible without resorting to that.

Edit: The only information I do have are an email, username and full name. All other fields, such as address, profile picture, etc. should be provided by the user themselves.


texts: Is there a way to Embed Facebook Videos?

texts:
D7.37:

I am Trying to embed Facebook Videos and cannot find a way to do it.  Points:    Have already installed: Media-Module, Oembed, Media-YouTube, but cannot get Oembed to actually embed anything.  The Media-YouTube works; I can embed YouTube Videos.  I can embed SoundCloud Audio.  I can embed Flickr Images.  I cannot get anything Facebook related to embed.  Is this even possible in D7?   I tried downloading the Video-Lightbox software, but it would not take URL's from Facebook.

When I try to “cut & paste” the Facebook URL into the Video-Light-Box software, the URL seems to be loading then just terminates producing nothing.  If I do the same thing with a YouTube-Video an actual file is embedded.

When I try to embed the Facebook URL via the Media-Module-Browser, I get an error “SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'oembed://https%3A//www.facebook.com/AnimalsAustralia/videos/1015' for key 'uri'”; however the file brokenly loads and then is only available as a Link to Facebook NOT an Embed.

When I try to embed the Facebook URL via the WYSIWYG-Editor-AddMedia Button, either as a new Facebook URL or an entry from the Media-Library, a small Icon appears which is also only a Link and not an Embed.

When I try to embed the Facebook URL via the WYSIWYG-Editor-AddMedia Button, but wrapped in [embed] {Facebook URL} [/embed] tags, I receive an “Unable to handle the provided embed string or URL” error message.

BTW I have scoured the settings to be sure that "Rendered-File" is selected in the Media-Display settings of this Content-Type.  I have a Content-Type set up specifically for handing Media and configured to allow Remote Media Types of Video.

What might I be missing?


texts: Store user test results against their profile in Drupal Quiz Site

texts:
I have created a drupal quiz site without depending any quiz modules. I want the user to be able to save their Test result against their profile. So they can see when they log in.

The Result will be like this usually:

  Total Result: 24/30.
  Main Subject: Main_Subject_Name.
  Sub-sub1 score: 12/15.
  Sub-Sub2 score: 12/15.

There can be any no. of sub-subjects depending on test. It would be great if I could be able to pull them later with views.

This is what i have in mind. Create a content type results with 2 fields.  User Id and Data.
User id will hold the uid and in data i will add a json(ified) version of the result for later use. Is this ok? or are there any drupal specific ways to do this?


texts:
I have a Drupal 7 site and on some pages, such as the front page. I don't want a list of teasers to show; I just want a Basic Page to show.  How do I do this?

I have looked in content types, blocks, and in the edit screens of the content items themselves, to no avail!


texts: Show fields on webform based on a value in the session

texts:
I want to use a webform to do a feedback form but want it to act on data provided by the user. That is, if the user has answered a question about location which is stored in a session, then I want to show a webform field, otherwise don't show the field at all. Any ideas on if this is possible and how to do it in webform?

Thanks.


texts: How to hook into access control of node/add menu handler?

texts:
Looking at Drupal code, I noticed the following function.

function _node_add_access() {
  $types = node_type_get_types();
  foreach ($types as $type) {
    if (node_hook($type->type, 'form') && node_access('create', $type->type)) {
      return TRUE;
    }
  }
  if (user_access('administer content types')) {
    // There are no content types defined that the user has permission to create,
    // but the user does have the permission to administer the content types, so
    // grant them access to the page anyway.
    return TRUE;
  }
  return FALSE;
}

What is node_hook()? How can I implement this hook for additional access control?


texts: EntityFieldQuery - ordering by multiplication of two fields

texts:
I need to order my news by their importance value (1, 2 or 3) which is in the field field_importance and the date they are published. So I would need to order my news by this calculation: created * field_importance and I haven't figured out a way to do it with EntityFieldQuery. If someone knows a way to do it without EntityFieldQuery, that's equally good. This is my code so far:

$query->entityCondition('entity_type', 'node')
      ->propertyCondition('status', 1)
      ->propertyCondition('type', array('news'))
      ->propertyOrderBy('created', 'DESC');


texts: How do I programmatically validate reCaptcha?

texts:
In Drupal 7, I use the Commerce_Checkout_Redirect module which uses custom validation functions. It uses the following code.

// Use the username as order email.
// Email validation for the username form element
if (variable_get('commerce_checkout_redirect_username_as_order_email', FALSE)) {
  $form['name']['#title'] = t('Email');
  $form['actions']['continue_button']['#limit_validation_errors'] = array(array('name'));
  $form['actions']['continue_button']['#validate'][] = 'commerce_checkout_redirect_username_as_order_email_form_validate';
}

The validation function is the following.

function commerce_checkout_redirect_username_as_order_email_form_validate($form, &$form_state) {...}

The form ID is user_login, the reCaptcha is enabled for this form and it is shown, but it is ignored by the validation process when users submit the form.

How can I "force" the validation of the reCaptcha inside a custom validation function?


texts: return all content types name containing text files

texts:
I want to get the content type name instead of the file name:
I have this function that access to the files folder: site/all/default/files and get all the file with a text extension and put the text files in an array, is there a possibilty to retun all content types names that contain text files instead of the text files names?

function get_projects(){

$directory= variable_get('file_directory_path', 'sites/default/files');
$filenames = array();
$extension =".txt";

$iterator = new DirectoryIterator($directory);
foreach ($iterator as $fileinfo) {
if ($fileinfo->isFile()) {
    //check the extension ".txt"
    if (strpos($fileinfo->getFilename(),'.txt') !== false)
    {
        //Delete the extension ".txt"
        $filenames[$fileinfo->getMTime()] =substr($fileinfo->getFilename(), 0, -4);
        //$filenames[$fileinfo->getMTime()] =$fileinfo->getFilename();
        //$fileinfo->getFilename().get
     }
 }
}
 return $filenames;

}


texts: Is there a way to reorder the content types shown on node/add?