texts: How to create a User Feed using the modules Message and Flag?

texts:
What I'm trying to do is in theory easy : **User** flagged **Article**. But I'm having hard time figuring out how to build a user feed like this with Message and Flag modules.

I looked a little bit at the Message UI to create a message type, but can't seem to find a "Flagging user" token. The only related flag token I've found is Users who flagged the entity with flag flag which prints all users that liked an article like this:

User A, User B, User C flagged Article

What I really need is to print a message for every flag, like this:

User A flagged Article
User B flagged Article

And finally show everything in a view to the Article author.

Any suggestions?


texts: Assign different taxonomy terms to translations of content

texts:
I've got some custom content translated with entity translation with custom taxonomy also translated.
Actually taxonomy terms are correctly shown inside the content page.
The problem is I need different taxonomy terms for different translation.
When I change the taxonomy terms in the translation edit page every translation of the content gets updated with the terms variation.

The logic behind would be:

- content A (english) --> taxonomy term 1 (english)
- content A (french)  --> taxonomy term 2 (french)
- content B (english) --> taxonomy term 2 (english)
- content B (french)  --> taxonomy term 3 (french)


texts:
Question: I have a content type "VIDEOS" and have added 20 videos - 1 through 20. I want to achieve a functionality like if you are watching video x, the next 3 videos are showing in the sidebar, example -> when you are watching video 2 in a block in the sidebar videos 3, 4, 5 are showing up. When you watch video 7 - in the sidebar videos 8, 9 10 are showing up and so on.
Any ideas? I know it will be done somehow with Views but cannot figure it out.

BR, Ivan Ivanov


texts: Rule for allowing purchases based on country

texts:
I'm running a commerce shop where we're gonna sell stuff we don't have worldwide rights to.

By using the countries module I've ticked of which countries we can sell each product in by having a countries field on products. (see screenshot below).

I'm thinking it must be possible to make a rule banning to sell a product in a territory that hasn't been ticket of. It should be the billing country of the customer that needs to be validated against what countries the product is sellable in.

Any ideas on how to configure a rule (or another solution) that does this check?

Cheers


texts: filter fields of type date with the view module filters

texts: I have a field in my database of type: timestamp in this format: yyyy-mm-dd hh:mm:ss , with the view module I would like to filter this field so for example I want to select an interval: dispaly only date from x to y. I taked a look in the view module code and there is a date filter that handel data of type date or time in this format, but when I tired to create a new view with view module and set up this kind of filter I didnt found it in the exposed filter list, the availble filters works only with int or string type: like is equal to, starts with...so how to get the time filter from the view module user interface.


texts: Configuring Lightbox2 to Pop-Up Images embedded in nodes

texts:
all my nodes have an image added to them (uploaded the usual way when creating new content for a content type), so when the viewer is viewing the node they can see the image inline with the text.

It's styled to look nice, but the image is small, and sometimes a user might want to see the details of the image more clearly (however we still want to keep it small on the page by default).

So I was thinking it would be nice for the user to be able to click the image and have the image get larger (possibly as a pop-up or overlay) on the page.

My research led me to Lightbox2 and so I installed that module. I enabled it and when into the settings in the configuration page and made sure it's loading on all pages. I also made sure the setting for 'Automatic Image Handling' > 'Image Node Settings' was set to 'Lightbox'. [I actually tried all of the options available there]. I then cleared the cache as usual.

It seemed all too simple no doubt. And indeed I went to one of my nodes and clicked on the image and nothing happened.

Can someone please help me configure Lightbox2 correctly to achieve my objective? (or perhaps give me an alternative solution).

Thanks!


texts: How do I install the kurti devi 10 font for CKEditor?

texts: I want to use the kurti devi 10 font in my new project. How do I install it for CKEditor?


texts: Boost – Cache expiration does not clear cache in views pages

texts:
When a node is edited and saved the Cache expiration module should clear the cache on that node, which it does. However if that same node is used in a View, I have discovered that the old content still shows. Unfortunately 90% of the main content is shown using Views.

So in the cache expiration configuration page I have ticked the "Custom pages" option and entered products|wildcard, because all sub pages after products/ contains views that need to be cleared. But this does not work.

I have tried to use drush cc views (success message), which does not work, drush cc all does not show the new content either. The only thing that actually works is to go to admin/config/performance and click the Clear all caches button.

What is the best way to sort this problem, so that the Cache expiration module also works on Views?

EDITED:

  I haven't found the solution for this problem yet. Any ideas would be
  really helpful. Anyone?
  I should probably also mention that I use the Boost module to chache my pages, along with the Cache Expiration module.


texts: Which nid to use for translated node in a menu

texts:
I'm not using the Entity Translation but only the i18n modules.

For example in the main menu I want to translate "contact us". So in the German translated menu do I need to give the nid of the German version of English node "contact us" ? Or the original English version one?

EDIT: In the figure node/59 refers to English node while the German version is node/800. So for German menu("contact us") which one do I need to feed? node/59 or the node/800. I fed node/59 for all the translated menu items but then they'd all redirect to English one. I thought that i18n should be able to figure and select the translated node automatically. Looks like I'm missing something.


texts: Remove orphaned module data after uninstall

texts:
I have installed the xmlsitemap module, which is in alpha state. The module has an incomplete uninstall routine. Right now I am getting this error at /admin/config:

  User warning: The following module is missing from the file system:
  xmlsitemap in drupal_get_filename() (line 240 of
  core/includes/bootstrap.inc). drupal_get_filename('module',
  'xmlsitemap') (Line: 263) drupal_get_path('module', 'xmlsitemap')
  (Line: 134) module_load_include('install', 'xmlsitemap') (Line: 93)
  module_load_install('xmlsitemap') (Line: 82) drupal_load_updates()
  (Line: 109) Drupal\system\SystemManager->listRequirements() (Line: 96)
  Drupal\system\SystemManager->checkRequirements() (Line: 102)
  Drupal\system\Controller\SystemController->overview('system.admin_config')
  call_user_func_array(Array, Array) (Line: 123)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
  (Line: 574)
  Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object)
  (Line: 124)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array,
  Array) (Line: 97)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
  call_user_func_array(Object, Array) (Line: 144)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line:
  64) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
  (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
  (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object,
  1, 1) (Line: 99)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line:
  78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
  (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1,
  1) (Line: 50)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1,
  1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line:
  656) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

There are dozens of entries in my database, which are related to this module. Is there any quick way, to remove the module's orphaned data?


texts: How to login drupal to magento single sign on?

texts:
I want to login drupal to magento and magento to drupal . can any body help me how it possible ?

Thanks


texts: How to move commerce kickstart database to other domain

texts:
How to move commerce kickstart database to another domain.

When i copied my files and database tables and edited the settings.php the site just redirects to install.php


texts: I am using the Hansel breadcrumb module to generate the breadcrumbs. When I visit the /user page, I get a breadcrumb that is like "Home -> admin"; what I want is "Home -> My account." I am not sure from where this "admin" is generated. I would like to remove that "admin" in the breadcrumb so that I can use Hansel to generate "Home -> My account."


texts:
How can I edit the user profile template in Drupal 7?

I've created a module called sporthron in my project.

sporthron.module contains :

/**
 * Implements hook_theme().
 */
function sporthron_theme($existing, $type, $theme, $path) {
  $theme = array();
  $theme['user_profile'] = array(
    'template' => 'user-profile',
    'path' => drupal_get_path('module', 'sporthron') . '/templates',
   );
  return $theme;
}

And here is the path to the template :
/sites/all/modules/sporthron/templates/user-profile.tpl.php which contains :

<div class="profile"<?php print $attributes; ?>>
  <?php print render($user_profile); ?>
</div>

TEST

But this template is never used. Whatever edit I made is not applied.

And yes my module is enabled. Do you know how can I apply this template


texts: AJAX error from Entity Browser modal: "The container is serialized." What does that mean?

texts:
When I use Entity Browser, and I edit a media field... lets say its an image - when I click on "remove" and upload a new image, nothing happens. There is a JS
 AJAX error in the console that says:

"The container is serialized."

The modal is then stuck and goes nowhere - but the file operation still occurred in the background (refreshing the page displays this behavior).

I have seen this mentioned a few times, some people say to use DependencySerializationTrait - why? What does this error mean exactly?


texts: How to properly attach a library to CheckoutPaneForm

texts:
I'm attempting to attach a library to a CommerceCheckoutPane plugin.  I first started with using $pane_form['#attached']['library'][] = 'commerce_paypal/express-checkout';.  There were some errors in my commerce_paypal.libraries.yml file but once those were resolved the libaries still don't appear to be loaded.

Right now, my setup looks like:

commerce_paypal.libraries.yml:

paypal.checkout:
  remote: https://www.paypalobjects.com/api/checkout.js
  license:
    name: MIT
    gpl-compatible: true
  js:
    https://www.paypalobjects.com/api/checkout.js
express-checkout:
  js:
    js/paypal_ec.js
  dependencies:
    - commerce_paypal/paypal.checkout

Drupal\commerce_paypal\Plugin\Commerce\CheckoutPane\ExpressCheckout:

public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
  $pane_form['#theme'] = 'commerce_paypal_express_checkout';

  return $pane_form;
}

commerce-paypal-express-checkout.html.twig

{{ attach_library('commerce_paypal/express-checkout') }}

asdfas

js/paypal_ec.js:

console.log('here');

When I place the pane form I see asdfas but the JS is not added.  I've checked the source, no sign of paypal_ec.js.


texts:
I am using ECK
I create one form through  entity->bundle->feedbackform->managedfield
my form is created, but how to get form path,
current path is of my feedback form is:-
admin/structure/entity-type/feedbackform/feedbackform/add
but this path is not for anonymous user. i want to show my form to anonymous user with some simple path


texts: Having a field output custom markup when empty

texts:
So due to very rare use-case client issues, we've had to use a somewhat hacky solution to solve one of our goals. I am looking for a solution (hacky is fine) to solve one of the problems created by this solution. This is in Drupal 8 for reference.

I'll give the breakdown of where we are, and what sort of solution we're trying to achieve:

We needed to essentially duplicate the functionality of the menu system based on dynamic values on a given page, based on relevant field values. Occasionally, this would have to be done several times over.

To do this, we used a module that allowed us to place HTML elements inside the node display to wrapper several fields that would all be displayed inside this "menu", so that they'd have the proper menu markup.

We also created a custom display suite template to display each row properly (i.e. it contains the menu markup for each row) and we're using that as the field widget for each given field.

So it looks like this in the Manage Display page:

div
    ul
         FIELD (with the custom DS template widget)

Here's the problem:

We also need to have a couple of static links, based on the URL with some arbitrary additional pathing afterwards, which we're currently doing in the custom template (unfortunately with logic in the template).

Looks like this:

{% if element['#field_name'] == 'field_name_1' or element['#field_name'] == 'field_name_2' %}

<a href="{{ url('<current>') }}/url1" >Link1

<a href="{{ url('<current>') }}/url2" >Link2

    {%endif %}

The only problem is that since this requires a given field to have a value in it, and the links always need to be rendered, we want to know if there's a way to insert a value so that a specific field is never truly empty.

We were thinking of putting in &NoBreak; for markup. How would we go about checking if a field is empty, and if so, inserting custom markup into it so that the template always renders the field?

We tried HOOK_node_view_alter(), but that gives us a render array that isn't particularly easy to traverse or modify (though maybe this is the solution, I'm not sure). We've tried putting in a

$build['#post_render'][] = 'MY_MODULE_node_post_render';

hook, but that seems to give us the HTML in a way that isn't easily changeable.

So the question is - how do we put custom markup in an empty field to be displayed in a given entity view mode, but display the normal results of the field if there are results?


texts: Altering Shipping/Billing address inline entity form

texts:
Now that Drupal 8 Commerce moved to Inline Entity Form approach. I am having trouble of altering Address for fields for the checkout... In the past I could do this:

function hook_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {

  $element["address"] .........

}

Essentially I was adding couple extra classes to fields, adding placeholder attributors and adding couple of hidden fields... But now that we moved to InlineEntityForm I have trouble finding this....

I am trying at the moment of using hook_inline_entity_form_table_fields_alter() or hook_inline_entity_form_entity_form_alter() but cannot seems to be able to do the same thing....

If anybody could point me to the right direction that would amazing.

Cheers,


texts: How to use rules to take a user from a group content page to the group page the content belongs to?

texts:
I'm using Organic groups (7.x-1.5) and wonder how to write a rule that would take the user from a group content page to the group page the content belongs to?

The event could be triggered by a button on the group content.

For example: I am viewing the page of the University of Berkeley and if I click on the button there, I am taken to the California universities page (University of Berkeley page is group content, California universities page is group.)

Notice I did not say "back" to the group since the user can land on the group content page without first landing on the group page.

Any suggestions?


texts: How to edit/extend/remove pager in the admin back-end?

texts:
For example I just applied Mollom for antispam and everything, because the site got like 500 spam comments and 500 spam users. Now I can delete them only by selecting 50 users per page in the admin/people list and that is taking up really lots of time. I will have to remove comments and forum threads like that too page by page, 50 at the time? Would be nice to somehow extend those admin back-end pagers for various lists, like amdin/people or admin/content so I could select them all at once, or select at least 100 per each or something like that.

Maybe there's a module or something?


texts:
I'm still getting to grips with render arrays and there similarity to FAPI arrays is a point of confusion. I'm customizing a node form using hook_form_alter and I wanted to insert some custom markup in place of a field.

I have inserted a table render array as a child of a the field FAPI container array and much to my surprise the table was rendered. What's going on here?

How do I know when a render array will be processed properly?


texts: How to use Display Suite to trim whitespace from a field

texts:
I have created a new content type, Plants, for my web site. One of the fields, scientific name, requires special formatting. Usually it is all italics, but sometimes a mixture of italics and non-italics such as Abelia x grandiflora 'Kaleidoscope'.

To make this work I defined the field as long text. I have tried several combinations of formats and field templates using Display Suite. The only one that seems to preserve the proper italics is Format Default and Field Template Drupal default. This preservers the proper italics, but results in an empty blank line that looks pretty crummy. See image.

Generated HTML according to Firebug:

Scientific name:&nbsp;

Abelia x grandiflora 'Kaleidoscope'

How can I eliminate the blank line or trim the white space at the end?


texts: How do I set the text format used in a message (from the Message module)?

texts:
I'm using the Message module on a site that has both the Filtered HTML and Full HTML text formats. By default, Message appears to use Filtered HTML, but I would like to use Full HTML instead.

However, I couldn't find an option for changing text formats in the UI. I have exported my message types to a feature using the Features module, so instead I tried changing the format from "filtered_html" to "full_html" in the feature and reverting, but this didn't work, either.

Is is possible to change the text format used to display messages, and if so, how?

(Also asked in the module's issue queue.  When I get an answer, I will update both.)


texts: Creating a membership and send an invoice via email

texts:
I need to invoice new users via email, and when the payment has been received activate the user. I have been thinking about creating an order in Commerce, invoicing this with Commerce Billy, but have so far not been able to update the customer profile with the user details via Rules (triggered by creation of a new user, creating an order but the order lacks a customer profile, and it seems impossible to add a new profile to an order) . Is there perhaps a simpler way to do this?

Trigger: After saving a new user account

Actions:

Add a product to the cart (the product represents membership)
Complete checkout for an order - for the cart/order
Update the order state -> Completed

This parts works well and creates an order owned by the new user account.

Another rule picks up:

Trigger : Completing the checkout process

Conditions:
Entity is of type = Commerce Order
Entity has field = commerce_customer_billing

Actions:
Create a new entity = Commerce Customer profile
Set a data value = set a custom field to value X
Save entity = Commerce Customer profile

In this last step I miss an action that would connect the Customer Profile and Order somehow.

Cheers,

/bo


texts: How to load and render a webform with Ajax

texts:
I'm new on Drupal 8, and I want to make a custom module to load any webform of (webform module) on other pages of the website.

The idea is to load the webform when the page load. All webform has configured with ajax submission.

I don't know how I can do that. I someone can help me. I'm on Drupal 8

I've create a custom module with a custom path in routing.yml:

path: '/webform-data/{webformid}'

In my controller I've created a public function to retrieve the webform by id.

I want for example create a link, like:

Click

When I click on the link, the webform load in a wrapper, but when I submit the webform, I have a redirection to the path of webform and I don't want the redirection. I just want the inline confirm message without reloading the page.

I have this in my controller :

// Controller
namespace Drupal\ajax_webform\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Ajax\AjaxResponse;
use \Symfony\Component\HttpFoundation\Response;

class AjaxWebformController extends ControllerBase {

    public function getWebform($webformid) {

        $build['webform'] = [
            '#type' => 'webform',
            '#webform' => $webformid
        ];

        $renderer = \Drupal::service('renderer');
        $rendered = $renderer->renderRoot($build);

        $response = new Response();
        $response->setContent($rendered);
        return $response;
    }

}


texts: how can i change new password/confirm password by using services module in drupal

texts:
I am using services module to consume users account details.

Enabled user in admin->services->resources.

URL: https://drupal.com/service/user/23

method : post

request body:
{
"current_pass":"xyz"
"email":"xyz@gmail.com"
}

I have updated these two values are successfully,
but how can I change new password and confirm password values.

How to take these values in request body and I have tried like this(new_pass) but failed to update.

Please help me.


texts:
I'm trying to build an infinite scroll with views using a custom ajax callback function, every view has only 1 node displayed. What I would like to do is use the offset to load the correct view. To be clear, I already tried views infinite scroll and infinite scroll modules and for various reasons I cannot use them.

What I got so far is this:

$view = views_get_view('frontpage');
$view->set_items_per_page(1);
$view->set_offset($offset);

$view->execute_display();

This gives me back the right markup with the right node.

My question is, what if I want to process the node loaded in the view before getting back the markup? Is this possible? I've looked through the view API multiple time without finding something suitable.


texts: Display data basing on the group permission

texts:
I have implemented hook_og_permission() in a custom module.

/**
* Implements hook_og_permission().
*/

function logic_board_og_permission(){
   return array(
    'rulesprm' => array(
      'title' => t('Rules Form Perm'),
      'description' => t("Allow og user to fill form"),
    ),
  );
}

Using this permission like in the following code doesn't work: The code inside the if() statement is not executed.

    if (user_access('rulesprm')) {
      // Some code
    }

Why?


texts: Set a value from one text field from one content type to another text field in another content type using set data value in rules

texts:
I have two content types A and B and I have two rules. I am trying to add the text put in the A text field of content type A into the B text field of content type B.

On rule two I am using the set data value but it is not working. Have I missed anything or have I setup my rule incorrectly? If anybody can point out where I went wrong it would be much appreciated.

Rule 1 creates a node from content type B when a node is created with content type A.

Export of Rule 1:

{ "rules_ref" : {
    "LABEL" : "Ref",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert--a" : { "bundle" : "a" } },
    "DO" : [
      { "entity_create" : {
         "USING" : {
            "type" : "node",
             "param_type" : "b",
             "param_title" : [ "node:type" ],
             "param_author" : [ "node:author" ]
          },
         "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
       }
     }
    ]
} }

Rule2  takes the value from  A text  field in the A content type and adds it to the B text field in the B content Type.

Export of Rule 2:

{ "rules_ref2" : {
  "LABEL" : "Ref2",
  "PLUGIN" : "reaction rule",
  "OWNER" : "rules",
  "REQUIRES" : [ "rules" ],
  "ON" : { "node_insert--b" : { "bundle" : "b" } },
  "IF" : [
    { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_a_text" } },
    { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_b_text" } }
    ],
  "DO" : [
     { "data_set" : { "data" : [ "node:field-b-text" ], "value" : "[node:field-a-text]" } }
   ]
} }


texts: How to quick start sub-theming in Adaptive Theme?

texts:
I have a question. I'm a little confused on if I should copy the entire contents of the "adaptivetheme" folder to create a sub-theme, or if only the "at_subtheme" folder should be copied.

I'm following the instructions from the project at https://drupal.org/project/adaptivetheme, which says that you need to update the theme-setting.php and template.php files, replacing "adaptivetheme_subtheme" with your new subtheme name. However, within the contents of the instructions it states to only copy the new "at_subtheme" folder, not the entire "adaptivetheme" folder, and I do not see a theme-setting.php and template.php file in the new "at_subtheme" folder. I only see theme-setting.php and template.php in the original "adaptivetheme" folder within "at_core".

Should I copy the entire original "adaptivetheme" folder?

I'm using Drupal 7.26


texts: How to access replacement tokens present in views field rewrite output in its .tpl file of that field

texts:
I've created a view and I want to manipulate the field output to show bar graph instead of field value.

I'm using bootstrap 3's progress bar as the bar graph, but I'm unable to set width of the progress bar to show progress as drupal doesn't allows style attribute inside "Rewrite the output of this field" in views.

So, I decided to create that field's tpl file now the problem is how can I access the Replacement tokens in the tpl file that are available in "Rewrite the output of this field"

$data = $row->{$field->field_alias} this prints numbers 1 2 3 4 5 ....


texts: Passing Arguments between an EntityReference field and an EntityReference View

texts:
So I'm trying to figure out how to filter a couple of entityreference view I'm using to populate an entityreference field. It has the option to pass arguments to the view, but I'm not sure HOW to do that.

In one node add/edit form I need it to take the values of two taxonomy terms. Those terms would then filter down the list and only return values that included those values. The Taxonomy terms can have three values though.

I also have another form that I need to be able to filter based on what name is in the Authored by Field. I need to be able to pass that back to the view and only return nodes that are authored by the authored by user.

I'm not sure how you set that up and I'm trying to find documentation to figure it out. So far no luck.

If anyone has any ideas, let me know.


texts: How to convert a block with views content into code?

texts:
I'm running into limitations of views. For example, I would like to add additional logic and formatting to a view shown in a block.
Is there a good way of taking the existing SQL and formatting from the view to create a custom module?

For example:
I want to show a table with taxonomy terms, including their hierarchy. Parent terms will have links to one one, children terms will have links to a different view.
For children terms I want to show the number of nodes with that term, the number of comments, etc.
This can currently not be done using views or would be rather complex to setup.

Rather than starting from scratch writing a module is there a good way to use a similar view and reuse the query and the formatting?


texts: Users are getting spontaneously logged out

texts:
Every so often, my users get logged out, and are unable to log back in without doing the "forgot your password" thing (which works fine). I've put some watchdog statements into core to try to see what's going on, and, while I'm hardly expert in the ins and outs of the Drupal login process, I can tell that, in _password_crypt(), down in password.inc, things make it all the way through to the comparison of the hashed entered and stored passwords, where it fails. This is perhaps because, in checking the database, the users' values for PASS have changed relative to what I saw there when the users were able to log in successfully.

Some other details:

Yes, I'm up to date on patches (Drupal 7.15, and up-to-date versions of contrib)
System and browser caches have been cleared multiple times.
The site is under apache-level password control, and I've confirmed from the log files that nobody from the outside world is sneaking in. So there's no funny business there.
There don't seem to be any exact time aspects to this, but I can typically run, stay logged-in for a day or so before getting logged out.
I'm running the Twitter Bootstrap theme, and I am also using the Less module for CSS generation. Both seem to work fine.
I've experimented with setting $base_url and $cookie_domain in the settings file; neither seem to have much effect on the problem, either set or unset.
Because of the watchdog statements I added (see above), I've been able to see that _password_crypt() is running at times when I wouldn't have expected it to be running (like, not in response to a user's logging in).  Checking user->pass in the database, I found that at least one of the users' entries was no longer what it was after the user set the password after getting logged in through the login link. When this happened, that user was still logged into a browser, and he was still able to function as that logged-in user. However, once he logged out, he couldn't log back in without requesting a new password. More system tracing is underway.

This is seriously killing me; I've worked with Drupal a lot, and have never seen anything like this. Can anybody offer some thoughts on this?


texts: How to call a check for a product class in Ubercart

texts:
In the Ubercart D7 uc attribute module I am trying to  run code on the fieldset attribute if the product is a specific product class in the module with an if statement.
This calls an  if  for payment received
      if ($op == 'update' && $order->order_status == 'payment_received' && $arg2 == 'completed') {
// ... your code goes here

}
How do I call it for a product class??
In uc_attributes module at
   function uc_attribute_uc_form_alter(&$form, &$form_state, $form_id) {
  //. other code of module's function...
    $element[$key]['#type'] = 'fieldset';
    //    if (product class . ..) {
  // ... your code goes here

So that only the validate code runs on the field set if the product is the same product class
I have rest of the code largely ready to go


texts: How do I load a library defined with hook_library() on node/edit pages?

texts:
I've defined a library of JavaScript files and CSS files required for my module to function using hook_library().

How do I go about loading this library on node/edit pages?


texts: Module to cache URLs commonly request by bots?

texts:
Open the logs of a dozen Drupal sites and you will see some patterns for non-Drupal packages in the http requests that received a 404 response.  Requests like /postnuke/article.php, /exchange/logon.asp, /awstats.pl, /wp-content/, /mailman/, /phpBB/page_header.php, etc, etc.

Nearly 100% of these are bots scanning for exploits.  I know there are several modules to block these requests based on IP, http header, or some other key piece of data.

I've been mulling over the idea of writing a module that approaches this differently.

Instead of trying to block the request, just cache the response.  For sites using a reverse-proxy layer cache like Varnish, set the max-age for a ridiculously long time (1 year).  The module would simply generate menu entries for common packages that a Drupal site is very unlikely to have installed.  I would include the option to exclude a specific package so if you really did want to run Drupal and phpBB in the same web root, you could... but may require you to install https://www.drupal.org/project/bad_judgement to do that :)

I realize that this type of configuration can also be done at the .htaccess level, but maintaining that for all of the packages bots are trying to exploit is beyond the skill set of many people.

Does something like this already exist?

Am I missing some obvious reason this wouldn't work.  It seems like this would improve performance of a site by simply never letting a 2nd request hit the php/mysql level for another year (or until you cleared the Varnish cache)?


texts:
I want to overlay an image over another in the Content body. How do I achieve this? I do not know much about coding or themeing.

Could someone guide me please?

Thanks


texts:
I had another question at Save data to custom field columns using entity_metadata_wrapper and a similar issue at https://drupal.org/node/2110161, which nobody has been able to figure out yet.

Since entity_metadata_wrapper isn't working for writing custom field values, how can I do this manually?  I've tried the following code, but when I view the node afterwards, the field value is blank.

$fieldname = 'field_device_id';
    $query = db_insert('field_data_' . $fieldname)
        ->fields(array(
          'entity_type' => 'node',
          'bundle' => 'equipment',
          'entity_id' => $new_ent->getIdentifier(),
          'language' => 'und',
          'delta' => 0,
          $fieldname . '_esn_hex' => isset($conversion_values['ESN_HEX']) ? $conversion_values['ESN_HEX'] : NULL,
          $fieldname . '_esn_dec' => isset($conversion_values['ESN_DEC']) ? $conversion_values['ESN_DEC'] : NULL,
          $fieldname . '_meid_hex' => isset($conversion_values['MEID_HEX']) ? $conversion_values['MEID_HEX'] : NULL,
          $fieldname . '_meid_dec' => isset($conversion_values['MEID_DEC']) ? $conversion_values['MEID_DEC'] : NULL,
          $fieldname . '_imei_hex' => isset($conversion_values['IMEI_HEX']) ? $conversion_values['IMEI_HEX'] : NULL,
          $fieldname . '_imei_dec' => isset($conversion_values['IMEI_DEC']) ? $conversion_values['IMEI_DEC'] : NULL,
          $fieldname . '_iccid_hex' => isset($conversion_values['ICCID_HEX']) ? $conversion_values['ICCID_HEX'] : NULL,
          $fieldname . '_iccid_dec' => isset($conversion_values['ICCID_DEC']) ? $conversion_values['ICCID_DEC'] : NULL,
          $fieldname . '_raw_id' => $id,
        ))
        ->execute();
  }

This code runs after a submit handler passes in a device id that a user has entered, and converts it to several different formats, which are available in $conversion_values.

There has got to be a way to programmatically write values to custom field columns defined in hook_schema.


texts: Possible to set image style based on aspect ratio instead of px dimensions?

texts:
I'd like to create an image style that uses an aspect ratio, so that images maintain their general dimensions but get cropped based on that ratio. Essentially this would mean that a 16:9 image style would crop a 1600x1200 img to 1600x900, and a 2000x900 img to 1600x900.

Is this at all possible?


texts: Drupal 7 e-mail driven forum (mailcomment)

texts:
I've been tasked to set up a forum on drupal 7 that can support outgoing e-mail notifications with incoming e-mail posting for a forum section akin to Google Groups. I.e. a fully e-mail integrated forum where content comments and threads can be generated and responded to entirely by e-mail.

My question is, how do I achieve this? In most cases, I'm finding deadends with dependencies as it does not seem mature on drupal 7; many of the modules only have recommended or released versions for drupal 6. In the first case I tried, my host (hostgator) did not support the required PHP module dependencies.

I have tried:

http://drupal.org/project/femail
Issue: Unable to install PECL MailParse a requirement of femail.  Our host (hostgator) won't support: 'not compatible' apparently.

Listhandler
Issue: Untried. No D7 version.

and the most promising route:

Mailhandler/Mailcomment with Notifications and Messaging
Guides:
hyperlinkhttp: drupal.org/node/1045918
hyperlinkhttp: peterthorndycraft.com/tutorial/mailhandler

Issue: Depenendies that cannot be met.

From the mailcomment INSTALL.txt:

Dependencies:
- Mailhandler (matching version required - i.e., if you are using Mail Comment
  7.x-2.0-alpha5, you must use Mailhandler 7.x-2.0-alpha5)
- Notifications and Messaging (7.x-4.x branch)

The 7.x-4.x branch appears to not exist: http://drupal.org/project/messaging

I have tried it with the 7.x-1.0 version but without success.

EDIT: My issue is identical (the OP is not me) to:
http:// drupal.org/node/1889550

EDIT: I have managed to be able to create nodes via e-mail using the mailhandler/notif+messaging framework, but as of yet, unable to get replies from e-mails to trigger new comments.

My question is really: is achieving this aim possible with D7? What framework have people achieved this in in other D7 sites? I'm reasonably new to Drupal, so sorry if there is something obvious I haven't tried.

Thanks

PS: Couldn't post all the hypoerlinks i was referencing. J


texts: Add metatag field to content type programmatically

texts:
I'm trying to create a metatag field (from the metatag module) to my content type programmatically. I know how to create a textfield to my content type (by using the node.module as example) but can't find any documentation on how to do this with a metatag field.

What should the field.storage file in the config/install folder look like. This is what I use for my regular text field.

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


texts: Retrieve translated taxonomy term in current language programatically

texts: How do I retrieve a specified taxonomy term translated (if translation exists for this term) from the current language context programmatically with D8?


texts:
In my portal I need to use "flags" module to create a simil twitter "follow/unfollow". I have installed and configurated this module. All works, via AJAX too.

Now I need to exec some other JS function after that the flag module has completed his call. I think that I need to add (on the backend) some "commands" before flags return "commands" to execute in the frontend.

How I can I do this ?

Thanks, M.


texts: Rendered node display for anonymous users?

texts:
I would like to use a view field (node reference to an og group, configured to display a teaser) as rendered node inside a view and display the view to anonymous users.
Do you know how to achieve this result ?

PS. Currently I can display it for admin user but for non-admin users the view field doesn't appear.


texts: How to exclude a node from being indexed based on a field value?

texts: I would like to exclude some nodes from being indexed based on one field value (not content-type) on a drupal 7 installation, I can't find a hook letting me doing it, please help ! thank you


texts: Setting up a rule to cancel a scheduled rule?

texts:
We have an ubercart store where users who successfully check out are immediately given roles that provide access to purchase. The checkout process runs into an occasional issue where an order will get stuck in pending state due to some PayPal glitch.

I want to set up a notification to admins when this Pending issue happens. The problem is that during a checkout that successfully completes, orders are momentarily given "Pending" status...so I can't just set up a notification that user is in "Pending" status, or we'll get a message every time someone purchases.

One solution would be to create a rule/condition that schedules an email every time an order receives "Pending" status (i.e. every order triggers this)...email would be scheduled to be sent, say, 20 minutes after that event. And then, have a second rule that cancels the scheduled email as soon as that order attains completed status.

Is the above implementation possible? Or any ideas for a more straightforward way to do this?

Thanks!


texts: How should I alter forms shown in a block?

texts:
I want to alter the login form to display only the @username and @password inputs.

Is it mandatory to write another module to overwrite the user module? Can it be done from  my PHP block by using these 2 variables? If yes, how can I find the name of the variables?
What is the Drupal recommended way for doing this?


texts: How to db_select DISTINCT on a particular field in Drupal 7?

texts:
I understand that you can specify ->distinct() on the db_select statement so that it only returns distinct values when looking at ALL fields. But what I want is to return distinct values by only looking at ONE field. Here's my code:

$event_table = db_select('my_table', 'e')
    ->distinct()
    ->orderBy('e.time', 'ASC');//ORDER BY
$event_table->join('node', 'n', 'e.nid = n.nid'); //JOIN node with events
$event_table->groupBy('e.time');//GROUP BY time
$event_table->fields('e')//SELECT the fields from events
    ->fields('n',array('type','status','title'))//SELECT the fields from node
    ->orderBy('e.time', 'ASC');//ORDER BY

$result_event_table = $event_table->execute();
$result_event_table = $result_event_table->fetchAllAssoc('time');

Suppose I want the distinct column to be e.nid. You'd think  ->distinct('e.nid') would work but it still returns distinct values based on all fields (i.e. distinct(columns1, column2, column3, etc).


texts: Creating a content type that merges fields with its assigned area within the body

texts:
I have a requirement to build a content type that has a number of fields and also the body section which is where the html goes.  When new content is added using this new content type the user would enter information for all the fields (like city, state, zip, etc) and at the point of saving the content that is created is a combination of what was already inside the body section plus the fields values would go in their assigned areas within the body section.
What possible ways could this be implemented?
Any recommendations for modules that do the above?


texts: custom module, with custom table(custom data) with integration Data Mining (WEKA)

texts:
I have developed a module that retrieves some data from the web (tweets) in JSON format.
These data are analyzed by the software for Data Mining WEKA and finally a model is created that must be applied to future data so that we can get the best information ...
Now .. WEKA is a Java-based software while Drupal is based on PHP.
Maybe my question is stupid ... but how do I integrate and launch the analysis of WEKA from my Drupal module?
The module produces structured data in a CSV file on which to launch the analysis and stores the data in a custom table.
I ask for help to the experts? .. This job is for a university thesis.
Thank you.


texts: I just started to peek into the docs and source (Drupal 6 at the moment) and noticed that there are no classes to be seen, only vast number of prefixed functions. Is this handy? Does such decision have a background? Why?


texts:
The Google Analytics module on a brand new Drupal 7 build just stopped tracking after 7 days. When I went to investigate, I checked the settings, all appeared fine. Then I checked the source of the page, and the analytics code was nowhere to be seen.

For now I have just added in the javascript within html.tpl.php. But I am curious why it has just stopped working for no apparent reason? A bug with the module?

This site is using a custom theme. I checked the html.tpl.php and $header and $page_bottom variables were all there.

Any ideas why this may be?


texts: scss + zurb foundation error in compiling

texts:
I inherited a job done by a third party and I need to do some modification  including making of CSS operations.

The site uses a child theme of Zurb Foundation (I always used Bootstrap ). Now if I compile the .scss files (for example custom.scss), I get:

  Error: File to import not found or unreadable: foundation / components / global.

The directory with the "original" version of ZURB foundation theme (the parent) exists.

What am I doing wrong?

I'm using Koala to create the final CSS, but I think this is not important.


texts: Programmatically using values from a loaded entity inside a message

texts:
I am using Firebase module to send push notifications to a specific mobile user when a webform is submitted.

Below is my custom webform handler:

<?php

namespace Drupal\my_custom_module\Plugin\WebformHandler;

use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Serialization\Yaml;
use Drupal\Core\Form\FormStateInterface;

use Drupal\node\Entity\Node;

use Drupal\webform\WebformInterface;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\webformSubmissionInterface;
use Drupal\webform\Entity\WebformSubmission;

/**
 * Send Push Notification when a webform submission is submitted.
 *
 * @WebformHandler(
 *   id = "Send Push Notification when a webform submission is submitted",
 *   label = @Translation("Send Push Notification when a webform submission is submitted"),
 *   category = @Translation("Push Notification"),
 *   description = @Translation("Send Push Notification when a webform submission is submitted"),
 *   cardinality = \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_UNLIMITED,
 *   results = \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
 *   submission = \Drupal\webform\Plugin\WebformHandlerInterface::SUBMISSION_REQUIRED,
 * )
 */
class PushNotificationWebformHandler extends WebformHandlerBase {

  /**
   * {@inheritdoc}
   */

  // Function to be fired while submitting the Webform.
  public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
    // Get an array of the values from the submission.
    $values = $webform_submission->getData();

    // Get (NID) from text element available on the webform.
    $nidvalue = $values["attached_node"];

    // Load the node.
    $node = \Drupal\node\Entity\Node::load($nidvalue);

    // Get (selected_node_owner) value from the User Entity reference element available on the webform.
    $nodeowner = $values["selected_node_owner"];

    // Get (token) value from the loaded node through the 'field_node_owner' Entity field.
    $usertoken = $node->field_node_owner->entity->field_user_push_token->value;

    // Send the Push Notification.
    // Token is generated by app. You'll have to send the token to Drupal.
    $messageService = \Drupal::service('firebase.message');
    $messageService->setRecipients($usertoken);
    $messageService->setNotification([
        'title' => 'Hello',
        'body' => 'Hello $nodeowner this is your body message',
        'badge' => 1,
        'icon' => 'optional-icon',
        'sound' => 'optional-sound',
        'click_action' => 'optional-action',
    ]);
    $messageService->setData([
        'score' => '3x1',
        'date' => '2019-04-05',
        'optional' => 'Data is used to send silent pushes. Otherwise, optional.',
    ]);
    $messageService->setOptions(['priority' => 'normal']);
    $messageService->send();
    }
}

Everything is working as expected but the 'Variables' are not rendering any values and printed as they are.

Example:

I am expecting the body of the notification message to be something like below (Say the selected_node_owner name is "Elie Masaad"):

Hello Elie Masaad this is your body message

but instead I am getting the below:

Hello $nodeowner this is your body message

Module maintainer gave the below hint:

You should use a Token or simple str_replace for replacing something in string.

Can anyone guide me on how to pragmatically use tokens for my above requirement ?


texts: How to change textformat of many nodes at once?

texts:
How to change textformat of many nodes at once,

module? drush? or script

UPDATE (sorry I was on the run at first edit)

I had imported hundred or more nodes I had to migrate from an old site. Did it via node_export. The new site has a textformat with same name, but defined another way so I decided all nodes should be plain text .

I websearched a bit but could not found anything. So i thought there might by a module with VBO support for that?


texts:
I have one page structure. This is my menu:

news 1

news 2

news 3

about 1

about 2

about 3

about 4

about 5

And this is content structure:

When I click a menu item goes to content in same page, but my site is slow. I think if I separate all tpl.php files maybe I'll improve my site performance. But I don't know how can I do it.

For example, click news-1 item go to news-1.tpl.php file.


texts:
Issue: I have an input filter that, when triggered, executes drupal_add_js.  However, when I view source of the page, I see this command issued twice or more times.

Question:
Is there something I can do to prevent duplicate javascript commands on a page?

Code sample:
Below is the sample of the input filter that I'm writing. In some pages, for an unknown reason

<?php
function _js_slider_process($text, $filter, $format, $langcode, $cache, $cache_id)
    {

        preg_match_all("/\[slideshow:(#[\S]+)\]/", $text, $matches);

        // If no match return and be done.
        if (!isset($matches[1])) {
            return $text;
        }

        // gather information
        $text_to_remove = $matches[0];
        $elementid = $matches[1];

        // remove filter trigger text
        $text = str_replace($text_to_remove, '', $text);

        // Do we have any matches located in the firs match
        if (isset($elementid[0])) {
            // Inject javascript file
            drupal_add_js(drupal_get_path('module', '_js_slider') . '/' . _JS_SLIDER_JS_FILE_SRC, 'file');

            // Inject options into a javascript variable
            $js_slider_options = array(
                'first' => variable_get('_js_slider_control_first', _JS_SLIDER_HTML_CTRL_FIRST),
                'prev' => variable_get('_js_slider_control_prev', _JS_SLIDER_HTML_CTRL_PREV),
                'next' => variable_get('_js_slider_control_next', _JS_SLIDER_HTML_CTRL_NEXT),
                'last' => variable_get('_js_slider_control_last', _JS_SLIDER_HTML_CTRL_LAST),
                'ctnl_placement' => variable_get('_js_slider_control_placement', _JS_SLIDER_HTML_CONTROL_PLACEMENT)

            );
            drupal_add_js(array('_js_slider' => $js_slider_options), 'setting');

            // Call it
            drupal_add_js('jQuery(document).ready(function () { a = new SlideShow("' . $elementid[0] . '"); a.init(); });', 'inline', 'footer');
        }

        return $text;
    }


texts: How to get a field collection field to correctly render with hook_node_presave?

texts:
I have a field collection field that I put one field into, and I am writing a custom module to fill that field. I populated the field myself once via the UI to make sure it would display correctly, and it did.
Then @Aaron showed me this site in another question that explained a way to do it. I used that code, but when I looked at the array structure it wasn't the same as the array structure created when I populated the fields via the ui.

Here is the code I have:

function alternative_titles_title_node_presave($node) {
  if($node->type == "disease_topic") {
    if(!empty($node->field_alternative_titles)) {
      $field_collection_value = entity_create('field_collection_item', array('field_name' => 'field_alternative_titles'));

// Attach to the node
      $field_collection_value->setHostEntity('node', $node);

      $field_collection_value->field_alternative_titles_title[LANGUAGE_NONE][0]['title'] = $node->title;
      $field_collection_value->field_alternative_titles_title[LANGUAGE_NONE][0]['url'] = $node->path['alias'];

// Save field-collection item.

      dpm($node);
    }

  }
}

Here are two images I took. The top one is the ui created array structure and the bottom one is the array structure created by my above code.

UI POPULATED ARRAY STRUCTURE

MY CUSTOM CODE POPULATED ARRAY STRUCTURE


texts: Making authenticated service call with dart (flutter)

texts:
I am attempting to make an authenticated call to Drupal 7 using services 3.7 in dart (Flutter framework)
I can retrieve a token and login but when I make a call to; [ENDPOINT]/user/[USER_ID] I get access denied. I am passing in the token in the header retrieved from [ENDPOINT]/user/token
This is my Dart code:
 Map<String, String> jsonHeaderData = {
        'Content-Type' : 'application/json',
        'X-CSRF-Token' : [TOKEN]
      };
      var response = await http.get('[URL]/[ENDPOINT]/user/1', headers: jsonHeaderData);


texts: How to replace large, original images used for image caching?

texts:
All of the content types on my site allow users to upload up to 10 images. Each file is around 2 to 6 mb in original size.

I don't want to add another layer of complexity to their posting experience by enforcing that they use photoshop or some other software to 'format for web.' before uploading (which would be the case if I set the max file size to, 512k, for example).

Instead, how can I do like other services where you can upload whatever size and then the backend takes care of formatting them to a much smaller size for storage as well as the be the original that image caching uses for its work?

I see two ways of handling it:
write a module that understands when the file is saved and use PHP to reformat via its image functions, and then save that new file on the file system as well as be the source of any related image information needed in the database.

or, if the image data in the database is not dependent on the uploaded file size, etc, then why not just write an independed script to loop through all the images and reformat their sizes? Doesn't even have to be a module really.

Thoughts on the best way to do that?


texts: theme_table() isn't respecting sortable fieldname

texts:
I generate some data in one of my modules and generate a table using theme_table(). I want the fields in that table to be sortable, but the table is being rendered with the wrong value in the links.

I'm getting ?sort=asc&order=Birth Date instead of ?sort=asc&order=field_birthdate.

Here is the code I'm using to generate my table:

$headerColumns = array(
    array('data'=>'Name', 'field'=>'title'),
    array('data'=>'Edit'),
    array('data'=>'Birth Date', 'field'=>'field_birthdate'),
    array('data'=>'Sex', 'field'=>'field_sex'),
    array('data'=>'Stars', 'field'=>'field_stars')
);

return theme_table(array(
    'header' => $headerColumns,
    'rows' => $rows,
    'attributes' => array(),
    'caption' => '',
    'colgroups' => array(),
    'sticky' => true,
    'empty' => 'You ain\'t got none.',
));

I believe I'm generating that array according to the instructions on the theme_table() api docs, but it's not working.

How do I get the sort link url to properly use the fieldname I'm giving it in the render array?

EDIT: As requested, here is the code I use to generate my query:

$query = db_select('node', 'n')
            ->fields('n', array('nid'))
            ->condition('uid', $user->uid)
            ->orderBy('type')
            ;

$direction = 'asc';
if (array_key_exists('sort', $_REQUEST) && $_REQUEST['sort'] == 'desc') {
    $direction = 'desc';
}

if (array_key_exists('order', $_REQUEST) ) {
    $fieldname = strtolower($_REQUEST['order']);

    $field_info = field_info_field('field_'.$fieldname);
    if ($field_info !== null) {
        $table_name = _field_sql_storage_tablename($field_info);
        $query->innerJoin($table_name, 'f', 'f.entity_id = n.nid');

        $query->orderBy(sprintf('f.field_%s_value', $fieldname), $direction);
    }

}

$query->orderBy('title', 'asc');

if ($entityType !== null) {
    $query->condition('type', $entityType);
}

$records = $query->execute();


texts: Result accessibility based on field value for specific group

texts:
Is there a way to hide nodes or results if it has field "restricted" type bool with value 1 if the logged in user not in admin group without writing custom code.
i could do that with views hooks like "hook_views_post_execute" with writing custom code but it will decrease the performance because i will load the node field in "foreach", so is there module can handle that from the back end !?


texts: How to update a node after loadByProperties?

texts:
I search for a node with field value client id and I need to update values. How do I do that in drupal 8?
I search with the following code

$profileNode = \Drupal::entityTypeManager()
          ->getStorage('node')
          ->loadByProperties(['field_user_id' => $id]);

I get an array in response to this which corresponds to this. How do I update the node value with this?


texts: How to programmatically update a file field

texts:
I have a file field (audio recordings) on a node. So all these files are located in sites/default/files/recordings. I have set in the settings that those files are now stored in subfolders by taxonomy. It works nicely, but now I have to put the older files into subfolders to.

I'm writing a script for that. So I just want to put the file in a subfolder of the taxonomy that the node belongs to. It's trivial to move a file (php function rename does it), but how to update a record in a database? I've tried this in many ways, but cannot find the solution for this simple task.

One approach that appear logical would be something like this:

foreach($nodes as $n) {
    $node_wrapper = entity_metadata_wrapper('node', $n);
    $uriold = $n->field_recording['en'][0]['uri'];
    $urinew = generate_new_uri($uriold);
    move_recording($uriold, $urinew);
    $recording = $n->field_recording;
    $recording['en'][0]['uri'] = $urinew;
    $node_wrapper->field_recording->set($recording);   //error
    $node_wrapper->save();
}

The exception is thrown: 'EntityMetadataWrapperException' with message 'Invalid data value given. Be sure it matches the required data type and format.'

Another approach would be to use the Drupal's file_move function:

https://api.drupal.org/api/drupal/includes!file.inc/function/file_move/

But after a few hours of trying to call the function properly I gave up. I couldn't find out how to get stdClass from $n->field_recording.


texts:
I have just transferred my local server to a live site. I am able to log in as an administrator, but I am not able to access my administrator tools. The page directs me to a blank page. Initially I was able to change the site's theme, through the admin tools, but now I can't even do that. I am not sure what am I doing wrong, or if there is something that I have to change in the settings.php file etc?

Btw, the site update was using ftp only.


texts:
I am trying to add a new column to a table and I added the column using hook_update_N().
function cca_update_8902(&$sandbox) {
  db_add_field('cca_findings', 'cca_topic_id', array(
    'type' => 'float',
      'not null' => FALSE,
      'description' => 'interim fields addition',
    ));
  \Drupal::entityDefinitionUpdateManager()->applyUpdates();
}

My field is also defined in the cca_findings class as property.
class cca_findings extends ContentEntityBase {

  use EntityChangedTrait;

  /**
  * {@inheritdoc}
  */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);

    $fields['cca_topic_name'] = BaseFieldDefinition::create('string_long')
      ->setSettings(['max_length' => 2047]);
    $fields['meanvalue'] = BaseFieldDefinition::create('float')
      ->setLabel(t('meanvalue'));

    $fields['cca_topic_id'] = BaseFieldDefinition::create('float')
      ->setLabel(t('cca_topic_id'));

    return $fields;
  }

}

So, the column has been created correctly, but the values are not going on the backend. I feel I am missing something.
What is missing in the code I wrote?


texts:
I have a module that I've activated, but it does not show up in the disabled blocks list.

The module is named "My Module."
Inside the my_module folder I have the following files:

my_module.module
my_module.info

my_module.info

name = My Module
description = My module description.
core = 6.x
package = My Modules

my_module.module

<?php
function hook_block($op = 'list', $delta = 0, $edit = array()){
  switch ($op) {
    case 'list':
      $block = array();
      //List out all blocks you want to create here
      $block[0]["info"] = t('Display info');
      break;
    case 'view':
      switch ($delta) {
        case 0:
          global $user;
          $block['subject'] = "ADMIN Header of the block";

          if (in_array('Site admin', array_values($user->roles) || $user->uid == 1)) {
            $block['content'] = "input form";
            $block['subject'] = "Header of the block";
          }
          break;
      }
  }
}


texts: wrapping menu items with span in Drupal 6

texts:
I need <span> tags around strings on my menu items. Trying to use this answer but it does not work for me. I probably just need some guidance in terms of naming things (just started on Drupal).

My theme folder name is sub_website, it is inheriting from theme called website (set by base theme = website in sub_website/sub_website.info). The menu in question is named 'Primary menu', it is selected as "source for the primary links" in the settings, and it is accessible via /admin/build/menu-customize/primary-links URI.

I tried adding the following into the sub-theme's template.php:

function sub_website_links__system_primary_links_menu($variables) {
  foreach ($variables['links'] as $link) {
    $output .= l('<span>'. check_plain($link['title']) .'</span>', $link['href'], $link);
  }
  return $output;
}

What am I doing wrong? Am I not clearing the cache properly? Did I not name the function correctly? Is there no such hook in Drupal 6? Documentation is very fragmented and is further complicated by two major versions existing side by side.


texts:
Let's say $node->field_description[LANGUAGE_NONE][0]['value'] contains 'We&#039;re in this together'.
This code doesn't output what I expect.
$node = menu_get_object();
if (isset($node->field_description[LANGUAGE_NONE][0]['value'])) {
  $text = strip_tags($node->field_description[LANGUAGE_NONE][0]['value']);
  $text = decode_entities($text);
}

instead of 'We're in this together', I get 'We&#039;re in this together'.
The full hook implementation is the following.
function MY_MODULE_page_alter($page) {
  // Provide list description.
  $node = menu_get_object();
  if (isset($node->field_description[LANGUAGE_NONE][0]['value'])) {
    $text = strip_tags($node->field_description[LANGUAGE_NONE][0]['value']);
    $text = decode_entities($text);
  }

  // Add metadata to describe site's content.
  $description = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
      'name' => 'description',
      'content' => $text,
    ),
  );
  drupal_add_html_head($description, 'desciption');
}


texts:
I have a view created which has a column 'Price'. I also I have another column 'Special Price' in the same view, but 'exclude from display' is selected.

In views, click the price field > rewrite results > Rewrite the output of this field > I added the below:

  $[field_price]

  Special $[field_special_price]

I would like to display the special price only if the special price field has a value. If the special price field has no value, I only want to display the price field value. I am not sure how I can modify it ?

Thanks,
 D

I am new to drupal. Sorry if I am not clear.
In the views, I would like to put price and special price in the same column. I will add some css to special price. If I un-selected exclude from display for special price, then special price will be in another column which I do not want to do.

Please visit the page and see the price column.

http://bettylist.com/ac/myview

Thanks.


texts: Creating a menu tab with wildcard, how do I make a tab only show up for certain content types?

texts:
I am using Drupal 8.8.6, and am about to go crazy trying to figure out something that in D7 seemed very simple.

I am trying to add a view that shows up only on certain node types.

Example:  node/1/outcomes

I want a tab called "Outcomes" to show up ONLY if the node is of type "event" (for example), but not any other type.

I've added my path as node/%node/outcomes, and I set my contextual filter's validation to use "content" and make sure that it is of type "event".  And this does make the "Outcomes" tab show up when viewing an Event node. However, the tab also shows up for EVERY node, which I don't want.

In D7 we could do wildcard autoloaders, which might have helped (ex: %event_node instead of just %node) but I can't see how to do that in D8.


texts: How to implement something to differentiate nodes?

texts:
I wonder how I could implement something in my Drupal site where nodes can be different and managed separately.

For example, in my site I want to add to nodes as shops, and every vendor must manage his/her shop, post news, add images, etc.

Any suggestions


texts: How to define multiple blocks in a module?

texts:
Thanks to this tutorial, I cam up with this block-generating module:

function myblockmodule_block_info(){
    $block['myadblocks'] = array(
        'info' => t('My first ad blcoks'),
        'cache' => DRUPAL_NO_CACHE,
    );
    return $block;
}

/**
 * Define what our block is going to look like.
 * Implements hook_block_view().
 */
function myblockmodule_block_view($block_key){
    $block = array();

    if($block_key == 'myadblocks'){ //We only want to define the content of OUR block
        //This is the title of the block.
        $block['subject'] = t('First ad block comes here');

        //Define the block content.
        $block['content'] = 'some fancy script comes here';
    }

    return $block;
}

I am wondering how to extend the module to create 2 blocks instead of one?


texts: Is there a best form for security surrounding updating an entity of an unspecified type?

texts:
In Drupal 7, I have a field on both nodes and users that I'd like to update from a single function.  What's the most efficient and what is best practice for updating by entity id?

I want the client to hit my Services REST API endpoint with an entity id and value.  So far I've got:

function json_field_resource_update($entity_id = NULL, $data = array()) {
  global $user;

  $entity_type = 'user';
  $entity = entity_load_single($entity_type, $entity_id);
  if (!$entity) {
    $entity_type = 'node';
    $entity = entity_load_single($entity_type, $entity_id);
  }
  if (!$entity) {
    return services_error(t('No user or node entity found by entity_id !entity_id', array('!entity_id' => $entity_id)), 406);
  }
  if (!entity_access('update', $entity_type, $entity)) {
    return services_error(t('Permission denied for !user to update entity !entity_id', array('!user' => $user->name, '!entity_id' => $entity_id)), 403);
  }
...

The purpose of the above is to first check whether this entity Id refers to a user or a node then perform the appropriate access check.  This works ok, but am I missing some magical all-in-one Entity API function or something?


texts:
I am writing a module that creates a vocabulary through code. Here's what I use:

$new_vocab_name = 'my_categories';
$vocab_obj = (object) array(
   'name' => t('My Categories'),
   'machine_name' => $new_vocab_name,
);
taxonomy_vocabulary_save($vocab_obj);

How do I add custom fields for terms that will be in this vocabulary? E.g., I want to add an image field for each term.


texts: Region not rendering on views page but works perfectly on regular pages!

texts:
I have a navigation_bar region set up in my .info file which renders perfectly on regular drupal pages but I have two pages which are made from Views, but nothing renders. I am using the superfish module to display my menu block which is in the navigation_bar region. My search bar is in the header region and it displays fine on all pages. When I tried to move the menu into the header region it still doesn't work ! Anyone have an idea what probably might be?

Thanks,
Rita


texts: How does forum determine new replies for each user?

texts:
When I visit drupal.org/forum/*, in Replies column I can see how many new posts have been added. Drupal also marks them with a New tag.

I'm wondering how does drupal determine which replies are new for me? Are they new since my last visit to the page, or my last logout from drupal.org? In case the later is correct, how does drupal know when I loggeout out last time?

I'm very interested to know what algorithm is behind this nice feature?


texts: How to force Drupal search.module find "111-222" page by searching "111 222"?

texts:
How to force Drupal search.module find "111-222" page by searching request "111 222" ?
For instance I have page example.com/111-222
about something, named 111-222
How to force Drupal to think that minus "-" and space is the same?

P.S. Famous search.module code modifications for partial search
( $query2 = substr(str_repeat("i.word LIKE '%%%s%%' OR ", count($arguments2)), 0, -4);
etc) is already applied.

thank you.


texts: How to rebuild everything that can be rebuild during module development?

texts:
During module development, Drupal does not use all relevant information provided by a module on every HTTP request. Examples:

Changes to an implementation of hook_menu() are only used after calling menu_rebuild().
Changes to implementations of hook_node_access_records() and hook_node_grants() are only used after calling node_access_rebuild().
Classes referenced in the files[] array of the .info file are only rebuild after enabling the module. During module development, this means it has to be disabled first, along with all other modules that depend on it.

This list might not be exhaustive.

Is there a way to update all these information in the database in one go. Preferably via a Drush command?


texts:
I want to override the drupal core behavior Drupal.behaviors.filePreviewLinks which is located at core\modules\file\file.js from my custom module

I tried placing the following code in js file of my custom module

Drupal.behaviors.filePreviewLinks = {
    attach: function (context, settings) {
        console.log($(context).find('div.js-form-managed-file .file a'));
        //some custom code
    },
    detach: function (context, settings){
       //some custom code
    }
};

But it is not working. What I need to do? How to override Drupal core behavior in custom module?

EDIT

Let me explain my actual question. I am loading a form in page that is created using ECK entity type module. One of a field in form has 'file' as field type. So once I upload a file, it is showing filename with link in a table(I hope it is default drupal feature). I want to remove the file link and show only file name.


texts:
I am having trouble figuring out how to attach an uploaded image to a node in my form submit handler. I've been searching for a while now and nothing I've tried has worked. For instance:

$image = $form_state['storage']['image'];
unset($form_state['storage']['image']);
$image->status = FILE_STATUS_PERMANENT;
$file = file_save($image);
$node->field_image['und'][0] = $file;

does not work.

Any help on this would be much appreciated. Thanks.


texts: Views, if image field exists show it, else show this

texts:
I was wondering if this this possible using Views with Views conditional.

I need to check whether an image field has content, and if not just show some html + a token from a computed field.

Which condition should I use in Views Conditions? And is it possible. Thanks guys


texts: Added a secondary link through code. Why is my href URL getting decoded?

texts:
Added the following through code:

// $uri = custompath?type=All&field_id=2&storage=3

$secondary_links['menu_custom_item'] = array(
                      'attributes' => array( 'title' => $label ),
                      'alter'   => 1,
                      'href'    => $uri,
                      'title'   => $label,
                      'language'  => 'en'
                );

Why is it that when drupal renders the link the URL it links to is something like:
http://mydomain.ca/custompath%3Ftype%3DAll%2526field_id%3D2%2526storage%3D201110

Literally it links like that and obviously returns Page Not Found. As soon as I manually change the %'s in the path we're good again. Is there a way to prevent this? Do I need to deconstruct the URI and pass the variables in one by one?


texts:
I'm using Drupal 8 in headless mode with Angular 8 as my client, but Drupal caches the API calls. For example, I have an end point which suppose to give items in random order, but this doesn't happen. I only get cache items in a particular order.
How can I overcome this? I have tried to disable the cache modules, but I still get the same behavior.


texts: Why is my Language Switcher Dropdown block NOT displayed in my site?

texts:
I have a multi-language site in Drupal 7. And I use the Language Switcher Dropdown module in it. I enabled all the settings required by this module, as described in the module's readme.txt. I have also assigned the block to new region. But still the Language Switcher Dropdown block is not displayed anywhere in my site.

What are the other settings I may have to review/configure? Or maybe there is a possible plugin which conflicts with this one that causes the block not to be displayed?


texts: Is it possible to change the Alt value inside the image.html.twig template?

texts:
Is it possible to change the alt value inside the image.html.twig template?
I found out that it can be accessed via attributes.alt. And then there is a protected value. Is there a way to set it?
Something like:
{% set attributes.alt.value = 'new alt' %}


texts: Why doesn't loading a form in the view header work?

texts:
I've been checking for the past 2 days on how to do a drupal_get_form() for Drupal 8 and everyone seems to give me the following answers which don't seem to work. Let's just say I want to take the following Basic Page creation form and embed it into a Views header:

The ID of the form is: node-page-form or node_page_form if we were using drupal_get_form() from Drupal 7. But this time its the following:

$form = \Drupal::formBuilder()->getForm(Drupal\user\Form\NodePageForm::class);

I'm assuming "NodePageForm" is the parameter I'm suppose to use. If not how can one find this out from viewing the source of that page?

I then put the following PHP code in the Views header of my page like this:

I click save and update... my header is blank. What did I do wrong?

I'm trying to be as descriptive as I can explaining this problem. End result I just want to be able to take ANY form from any D8 page and be able to render it anywhere that takes PHP. That's my end goal. So no 3rd party modules as a solution.


texts: How can I show contextual links on my node's full content view mode?

texts: I need to be able to display my contextual links in the node full content view mode. How can I achieve this? Maybe something in my node.tpl?


texts: How to map different entity types as layers with OpenLayers?

texts:
My implementation requires the mapping of multiple entity types, which is difficult to achieve in vanilla Gmap with Views.

In the documentation, OpenLayers states that layers can produced from views of OpenLayers data type. Is it really as simple as specifying a few layer views and adding them to a map?

If so, and multiple views can be served as data sources to OpenLayers, what does one have to do to convert a Location/Gmap set up to OpenLayers?


texts: How do I manually configure the Link module?

texts: I would like to be able to add the file:// protocol to the list of filter_protocols so that we can add links to shared company files on a mapped drive from within our intranet website, but I'm not sure how to do this. Right now, it is apparently not included, according to Link Module Overview. Is there a way to manually configure this list in order to add file://?


texts: Ajax Framework Using Dynamically Generated Links

texts:
I know, for links to be ajaxified they need to have a class: "use-ajax" and a proper url which has its own callback. For example:

Ajax Link

If the link was statically created on the server, it works perfectly fine. But whenever I add a new link with the same properties, ajax seems not to work anymore. For instance, if I remove existing link and add a new one with new url parameters:

var ajaxRightUrl = 'ajax-reader/nojs/1/' + lastNextDate;
arrowLinkLeft.find('a').remove();
arrowLinkLeft.append('');

It stops being an ajax link. Any ideas why?


texts: Where does the drush installtation command set the PROMPT_COMMAND variable?

texts:
I installed drush and as part of the installation it makes some changes to the command prompt.

...
# Optional. Enrich the bash startup file with completion and aliases.
drush init
...

Whenever I execute an command at the prompt I get the message:

bash: __drush_ps1: command not found

The env command displays PROMPT_COMMAND as

PROMPT_COMMAND=__git_ps1 "\u@\h \w" "$(__drush_ps1 "[%s]") \\\$ "

I think somewhere at the global level the PROMPT_COMMAND variable is set to that value but I can't locate it in any of the global environment variables and profile scripts.

Because drush was installed as root commands executed as root don't produce that error message. root has a .drush directory with some drush scripts.


texts: How to have two view panes in one Panel, so that selecting a node title in View A displays the content for that node in View B? Do I HAVE to use AJAX?

texts:
I have been playing around with view panes, panels and context, and am struggling to find the best approach for the below:

I have a Panel which, say, is my Home Page and contains various elements.
Inside that panel, in a certain area, I wish to have Two View Panes
View Pane A - Contains, say, a list of node titles
View Pane B - Upon selecting a node title in View Pane A, I want View Pane B to display the content for that node

(My implementation uses Video Titles in Pane A which should display the relevant Videos in Pane B)

Current Approach:

Panel is set with URL: homePage/%currentVideo
In Page Manager, %currentVideo argument is configured to be assigned to the context Node:ID
View Pane B has a contextual filter of Node:ID
View Pane B has the Content ID from the Node assigned as the context for Argument Input
When adding View Pane B to the Panel, I set the contextual filter to get it's input from %currentVideo
View Pane A lists all the titles, and Rewrites the titles to a link that points to homePage/[nid] -- where [nid] is the input for the currentVideo

This works but I would ideally like to do this without using Arguments in the URL, since I want there to be several such Pane A/Pane B combinations on a home page, where selecting something in Pane A outputs content in Pane B. Therefore, the URL would just be /homePage, and wouldn't be used to pass arguments in/out in order to facilitate such a process.

Questions:

Do I need to use Ajax? If so, - could someone suggest how the above process is best implemented?
Or is there another approach using views, view panes, context and panels, that allows selection in one View Pane to trigger output in another View Pane within the same Page/Panel? (I'm not averse to re-loading the page, I just don't want to have to stuff multiple arguments in the URL as I feel it will get unmanageable over time.)

I have found an tried this Excellent tutorial on writing a module to implement an Ajax Callback, but am sure-ish that it could be all done within Views/Panels...

"Creating a Simple AJAX Interface with Views" : http://mrkadin.com/blog/node/70

Many Thanks in advance


texts: Currently I have a field that allows unlimited values, and it's displayed as a video player, using user-input URL from that field. Now I would like to do some custom coding or whatever it takes to somehow pick the first URL (the one at the very top), so I can have the video player play only one URL. Any ideas?


texts: Can't get distinct rows from taxonomy view

texts:
Drupal 8 has a problem with creating distinct views, and the distinct views module hasn't been ported yet. I've been researching this today, and haven't found a good solution. I wrote a custom hook in a module that I 'd hoped would fix it, but it hasn't. I have s pretty simple content type that has a taxonomy reference, and this is an attachment that gathers the unique terms for an index.
The SQL generated for my view looks like this:
SELECT DISTINCT taxonomy_term_field_data_node__field_faq_category.name AS taxonomy_term_field_data_node__field_faq_category_name, node_field_data.nid AS nid, taxonomy_term_field_data_node__field_faq_category.tid AS taxonomy_term_field_data_node__field_faq_category_tid
FROM
{node_field_data} node_field_data
LEFT JOIN {node__field_faq_category} node__field_faq_category ON node_field_data.nid = node__field_faq_category.entity_id AND node__field_faq_category.deleted = '0'
LEFT JOIN {taxonomy_term_field_data} taxonomy_term_field_data_node__field_faq_category ON node__field_faq_category.field_faq_category_target_id = taxonomy_term_field_data_node__field_faq_category.tid
WHERE (node_field_data.type IN ('pfaq')) AND (node_field_data.status = '1')
ORDER BY taxonomy_term_field_data_node__field_faq_category_name ASC

I get a result of all rows. So I made this handler. It creates a copy of $view->result with only unique terms, then copies it back.
function wdocs_site_views_post_execute(ViewExecutable $view) {
  if (($view->id() =='faq') && ($view->current_display == 'attachment_1')) {
    $row_ids = [];
    $distinct_results = [];
    foreach ($view->result as $row) {
      $cat = $row->_entity->get('field_faq_category')->getValue();
      $tid = $cat[0]['target_id'];
      if (!in_array($tid, $row_ids)) {
        $row_ids[] = $row->taxonomy_term_field_data_node__field_faq_category_tid;
        $distinct_results[] = $row;
      }
    }
    $view->result = $distinct_results;
  }
}

Seems like it should do the trick, but now I'm only seeing the first two rows. A row is generated in the HTML for each  value, but after the first two rows, the span.field-content is null. Looking at the returned values in my handler, they all look like they should render. As a test, I tried adding this right before the $distinct_results array is assigned to $view->result:
$distinct_results[1] = $distinct_results[2];

Still nothing displayed. However, if I assign the value of the first row to the second row, the first two rows are displayed identically:
$distinct_results[1] = $distinct_results[0];

Seems switching the data for the rows in the result should work, this has me baffled. Any suggestions on how to deal with distinct entries would be appreciated.


texts: How do I add a My Account Item to a New Menu?

texts:
Hi I need to add a My Account link to a new menu. I know about me aliases module and others, but I would like to do it using my own code. Any ideas ?

Update: I am using Drupal 6. Is it possible to use the My Account provided by the user module in a differente menu than Navigation ?


texts:
UPDATE: Although the answers below were correct, I ended up resolving the issue by editing the stylesheet to refer to those specific locations.

If I create a custom field and set it to hidden, is there any way I can call the values from those specific fields in the body?

For example if a field called color in an article is set to red, is there any way I can make the background of a div red.


texts: When does system generate global variable $user?

texts: I want to add some data to global variable $user when user login, so when does system generate $user, and which hook I should implement?


texts: May anyone give me an example of rebuilding the form using $form_state['rebuild'] after user's input?


texts: What is the template file name for a bean block?

texts: My block is called "hero", on the front-end the class is block-bean-hero, what is the proper template file name for this block?


texts: CTools modal return incorrectly return html instead of ajax commands

texts:
I am trying to create custom login form using Ctools modal window. There seems to be a problem upon submitting the correct username and password.

The page callback function is supposed to return a JSON of the ajax commands. Right now it is instead returning an AJAX error, with the response as the HTML text of the user profile page (eg. user/123). The return code is 200. Which seems to suggest that the function got redirected to the user page, which shouldn't happen for AJAX call. I might be wrong on this though.

I have used the same pattern for other forms, such as register form and reset password, which work fine. Anybody has any idea why this is happening? Thank you all.

Here are my codes:

hook_menu:

$items['modal/user_login/%ctools_js'] = array(
    'file'=> 'popup_login.inc',
    'page callback' => 'my_module_user_login',
    'page arguments' => array(2),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
);
$items['test_ctool_popup'] = array(
    'title' => "Test Login Popup Page",
    'page callback' => 'my_module_test_login_page',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
);

page callback function: my_module_test_login_page

function my_module_test_login_page () {
    ctools_include('ajax');
    ctools_include('modal');
    ctools_modal_add_js();
    ctools_add_js('ajax-responder');
    if(!user_is_logged_in()){
        $link = ctools_modal_text_button(
            'Log in modal',
            'modal/user_login/nojs',
            'Log in');
    } else {
        $link = 'user already logged in';
    }

    return << TRUE,
    //'title' => t('Log In')
);
$output = ctools_modal_form_wrapper('my_module_user_login_form',$form_state);
if (!empty($form_state['ajax_commands'])) {
    ctools_add_js('ajax-responder');
    $output = $form_state['ajax_commands'];
}
print ajax_render($output);
}

form function my_module_user_login_form

function my_module_user_login_form ($form, &$form_state) {
    $login_form = user_login($form, $form_state);
    $login_form['name']['#title'] = t('Email');
    $login_form['name']['#size'] = 25;
    $login_form['pass']['#size'] = 25;
    //$login_form['#validate'][] = '_ewp_property_user_login_form_validate';
    return $login_form;
}

submit function my_module_user_login_form_submit

function my_module_user_login_form_submit ($form, &$form_state) {
    user_login_submit ($form, $form_state);
    unset($form_state['redirect']);
    $commands = array();
    $commands[] = ctools_modal_command_dismiss(t('Log In Successful.'));
    $commands[] = ctools_ajax_command_reload();
    //$commands[] = ctools_ajax_command_redirect('modal/dismiss_modal/nojs');
    $form_state['ajax_commands'] = $commands;
}


texts: drupal filtered html filed alerting message

texts:
I have a xss security issue in Drupal 6.

If I type an input field in HTML full mode like prompting something and after that just clicking on Filtered HTML mode, it's prompting me a message. This is not normal isn't ?

This is a youtube link to show you the problem : https://www.youtube.com/watch?v=_UCO_Hmh1lg

What should I do ?

Thank you in advance.


texts: Including multiple authors in Authoring information for a Drupal 7 node

texts:
I have a CMS to which many people can possibly provide data. So, I would want to include all the users who have contributed the data for a node by adding new data or moderating existing data, because everyone who contributed for a node deserve themselves to be undersigned. Right now, only the first person who creates the content would be the rightful author.

How can I achieve this?

I have googled but could not get much help. The closest I could find was this, which still goes unanswered. I have checked Entity Reference module but I could not get it to auto-fill the author whenever a user edits an existing node.

I have automatic revisions enabled, which means I do have the information of each author for a node who have contributed. But how do I pull each author out of the revision information and display the collection of all authors & contributors in a nice manner at the end of each article?

Please help me find a solution, I am not that well versed with PHP programming.

Thanks & Regards,
Raj Pawan G


texts: Programmatically creating a custom block

texts:
I followed the steps from https://www.webwash.net/programmatically-create-block-drupal-8/.
I have a view already created and I want to render this view in this block.
I can't find a good documentation for build() function.

The reason is that I want to hide the view for a role implicitly included by authenticated role.

How can I display the existing view inside the custom block I've created?


texts: WYSIWYG + CKeditor breaks my  lines and mess my paragraphs

texts: After installing the WYSIWYG module + CKEditor / TinyMCE (same result) all my paragraphs are blown away resulting in an uneditable mess. Can you give me a clue how to make it read my paragraph markup? Thanks


texts: Use Statistics module to view published/unpublished nodes

texts:
I would like to know how to see the total number of nodes that have been published and the nodes that are yet to be published using Drupal 7 Statistics module.

I have installed the Scheduler module to publish nodes based on time.


texts: Use wget to mirror a site to a static site

texts:
I'm trying to use the following command to mirror a Drupal 6 site which needs to be archived as a static site. Unfortunately, I've only been able to find a static generator for Drupal 7, not 6. I'm having issues because it seems that

By logging in as different roles, the wget command will pull down completely different directory structures. This is not unanticipated, but in some cases as an administrator there is quite a lot of content missing which is pulled down with accounts that have lesser permissions.
There are links on the main page in separate blocks whose directory and pages do not get pulled down in the file directory structure by logging in with any role, including administrator.

So far I've successfully been able to mirror the site (with the above limitations), but I'm not sure if the command is actually mirroring the entire site as I need it to do. Here is the code I am using for wget:

wget --mirror -w 2 -p --convert-links --load-cookies cookies.txt -e robots=off https://url.org/user

where the cookies file is created like this:

wget --save-cookies cookies.txt --post-data 'name=MY_USERNAME&pass=MY_PASSWORD&form_build_id=FORM_ID&form_id=user_login&op=Log+in' https://url.org/user

I am very new to Drupal, so am not sure how roles and permissions, or the structure of the content might affect a wget mirror operation. Any suggestions would be appreciated!


texts: How to get all term descriptions from a specific taxonomy vocabulary?

texts:
I have a block that displays an imagemap, and each map area represents a taxonomy term. All terms are in the same vocabulary.

For each map area, I know the term name and want to pull the term description using a Drupal function. I know I can do something like this:

<?php $myTerm = taxonomy_get_term_by_name('1'); ?>
<area shape="poly" title="<?php echo $myTerm[0]->description; ?>" coords="1,2,3" href="link2" />

But it's quite clunky and means making a function call for every map area.

Is there an API function that gets every term in a vocabulary (like taxonomy_node_get_terms_by_vocabulary() but without referencing a node?)...

Or should I make a module for this..?


texts: Trying to import news using Feeds xPath html parser

texts:
been trying to make this work for the pass week now, and can't seem to be able to. I'm trying to import news from a site where there are listed news in a part of the site. All my xpath query works when tested in the chrome console and return what they are supposed to. The context query also work as it should be. But, when I try to import and create node, it just say that there is no new node to imported. Oh...and I'm using tidy to correct the source.

Heres is an example:
URL: http://www.spartan.com/en/community/blog/spartan-news
XPath Parser setting:
Context: //*[@id='inner']/div[3]/div[2]/div/main/aside/content-provider-secondary/div[2]/div/div/a

Title: h3[text()]
guid: @data-post_id
url: @href
body: h3[text()]

that's just a test of course.
The url field is used as the unique field in the node processor mapping.

It doens't give any error...but does not import anything either and I'm confuse. Is there something specific that need to be done when importing html? I have other feeds setup with xpath xml and they work as intended. Any help would be greatly appreciated.

Thanks!


texts:
I have a custom hook_views which queries db for a webform submission. the query looks like this

$query = db_select('webform_submitted_data','n');
    $query->leftJoin('webform_component', 'wc', 'wc.cid = n.cid');
    $query->fields('n', array('sid','data','cid'));
    $query->fields('wc', array('form_key','cid'))
    ->condition('n.nid',25)

Which translates to mysql:

select n.sid,n.cid,n.data,wc.form_key,wc.cid from webform_submitted_data n left join webform_component wc on wc.cid = n.cid where n.nid = 25

Now i have made a new field called status whose value can be 1 or 0, i want to show only those form submission whose status values are 1,
 I tried the following query in phpmyadmin but it gives out only 1 row output where the form_key value = status and data =1, where as the earlier query gave all the form_key, and data values for form id 25.

select n.sid,n.cid,n.data,wc.form_key,wc.cid from webform_submitted_data n left join webform_component wc on wc.cid = n.cid where n.nid = 25 and wc.form_key="status" and n.data =1

Is their any way by which i can add a views filter like condition here to show only data where status = 1


texts: How to add twig template for OwlCarousel format?

texts: I am working with drupal8. I have created a views with owlCarousel format.I want to add twig template for this carousel views.How to name this twig template?


texts: How to alter breadcrumbs from my controller in my module?

texts:
The breadcrumb code seems to gather everything from the URL, as it should. But in my module, the other entries used in the URL path do not represent somewhere where the user can go. They instead pass information from my form to a controller object.

Is there a way to remove these entries in the breadcrumb from my modules' controller object?


texts:
I am trying to print an entity reference field (from paragraphs module) into a controller.
I learned from this ticket that you can use
{{ teacher.field_classrooms.entity.field_in_paragraph.value }} to get the value of one field from  the entity, but what I really need is to print the whole entity not just one field from the entity.

I was hoping to do something like {{ teacher.field_classrooms.entity }} rather than {{ teacher.field_classrooms.entity.field_in_paragraph.value }}
{{ teacher.field_classrooms.entity.field_different_in_paragraph.value }}.


texts:
If I am using the IMCE file uploader combined with CKeditor, is there any point in installing the media module?

Or does media replace the imce when wysiwyg module is used?


texts: How to print the paragraph field translation value in twig template

texts:
I am trying to access the nested paragraph field inside my twig template.
{% for items in item['#paragraph'].get_aw_title_details%}
  {{ item.entity.field_award.value }}
{% endfor %}

When I am using this syntax it is always returning the English content. Translation content is not visible for me. For chinese also it is giving the english content


texts: No such file or directory in theme_render_template() for site that doesn't exist

texts:
I was recently assigned a Drupal 7 site to work on despite the zero Drupal knowledge that I have. The people before me who had experience in Drupal or with this site have all left the company. The sites were either renamed or copied over from site.test.com -> site-dev.com and site.uat.com -> site-uat.com. We're using a custom module which I have denoted as 'moduleA'. I get the two following errors when accessing the page that moduleA is used on:
Warning: include(C:\inetpub\wwwroot\icm_portal/sites/site.uat/modules/moduleA/moduleA.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1526 of C:\inetpub\wwwroot\icm_portal\includes\theme.inc).
Warning: include(): Failed opening 'C:\inetpub\wwwroot\icm_portal/sites/site.uat/modules/moduleA/moduleA.tpl.php' for inclusion (include_path='.;C:\php\pear') in theme_render_template() (line 1526 of C:\inetpub\wwwroot\icm_portal\includes\theme.inc).
It appears that the site is using the old site path to try and get the module. I can't find that file path when searching through the system table of the site database. Is there a place where these paths are defined where I can just go in and edit it or is there anything I can do to fix this?


texts: How does a Rule access a variable defined in the event info?

texts:
I'm looking at the Drupal Commerce module in Drupal 7, and it has a Rule to send an email notification that the order was completed after checkout.  Perusing the code in commerce_checkout.rules.inc, the hook_rules_event_info() has a variable of type commerce_order().

How does Rules retrieve the tokens and the $order object?  Or how does the Commerce Order module define a variable type to use with Rules?