texts: How do I schedule a PHP function every 2 month?

texts:
I need, every 2 months, to execute some rule component programmatically, but I don't know how to do this.

If I use hook_cron(), I don't know how to check 2 months are passed from the last time it was executed.

I can check 'the 10th day of the month' + 'month number is even'.

If cron tasks run twice a day, I cannot send 2 identical emails to users.

How can I achieve this?


texts: In custom form, how can I add a select field using "entity reference view"

texts:
I have an entity reference view (views block with entity reference display of a list of nodes that have "Certification" checked (boolean)). I am able to use this view from the content type manage fields config, i.e. http://localhost:8888/admin/structure/types/manage/certification-credit/fields/field_certification_exam_id/field-settings and it gives me a select list of all entities with that condition.

Is there a Drupal function to invoke this view to create a select field programmatically in my custom form? I've searched high and low and can't find anything about this.


texts: Should all files/folders in an installation be owned by the web server user?

texts:
As in the title, should all files/folders in a Drupal 8 installation be owned by the web server user, e.g. the default www-data user for Apache?

As far as I know, the answer is yes at least in principle, so that all files/folders should have www-data as both owner and group, and more so because of logistics/minimalism/ease of management.

Is that correct or are there other considerations?


texts: Is it possible to hide a menu item using menu blocks in context based on user roles?

texts:
I am using the Menu block module to create menu blocks and have them attached to the menu in Drupal 7.  I am also using the Context module to display the menu and items on different pages.

I have a certain menu item that I want only to be visible with certain user roles.  I have created a context for the page (based on "path") that linked to the menu item and have selected the administrator role as a condition and selected require both (path and user role).

Using a non-admin test user I can still see the menu item (It should be hidden).  When I click on it the page content doesn't show but the menu item is still visible to the user.

How do I use Context to hide the menu item as well.

Thanks in advance


texts: Get a configuration option from node type structure

texts:
I'm working on a module and was wondering how to get a node type setting (that was set when creating the node type at: admin/structure/types/manage/YOUR-TYPE) inside a node creating/editing page.

I added a node structure setting with the hook: mymodule_form_node_type_form_alter() and now I want to check if this option is active when creating/editing a node, hook: mymodule_form_node_form_alter()


texts: How To Get Item_id value in ProcessItem function

texts:
I developed a custom module which will process my items in queue. I have some custom table and custom action buttons to Process queue items. When i click on "Process Queue" button it will call the below function which will work as expected. Here i am calling claimItem function so that i am getting item_id value in processItem function.

Another Scenario is , I installed queue_ui module which is displaying all the queue items perfectly but when i click on Batch process it is giving error as i am running sql query based on item_id.

My point is i need to run queue by using custom module as well as queue_ui module , why because my function will call only when button is clicked. Is there any way to call same function on batchprocess as well as custom action button? Or is there any way to get the item_id value in processItem function.

    public function processQueue() {

   /** @var QueueInterface $queue */
    $queue = $this->queueFactory->get('my_queue');
    /** @var QueueWorkerInterface $queue_worker */
    $queue_worker = $this->queueManager->createInstance('my_queue');

    while($item = $queue->claimItem()) {
      try {
        $queue_worker->processItem($item);

        $queue->deleteItem($item);

      }
      catch (SuspendQueueException $e) {
        $queue->releaseItem($item);
        break;
      }
      catch (\Exception $e) {
        watchdog_exception('my_queue', $e);
      }
    }

  }

In My Drupal\my_queue\Plugin\QueueWorker\MyWorker.php file processItem function will be like this.

  public function processItem($item) {
     try{
      $query = \Drupal::database()->select('my_queue', 'emp');
      $query->fields('emp', ['status'])->condition('emp.queue_id', $item->item_id, '=');
      $result = $query->execute()->fetchField();
      if($result=='failed' || $result=='')
         {
         //here do some operations
         }
         }
         }

I tried below method in processItem function like below

$myclaim=new DatabaseQueue;
      $myclaim->claimItem();

But i got error as follows..

TypeError: Argument 2 passed to Drupal\Core\Queue\DatabaseQueue::__construct() must be an instance of Drupal\Core\Database\Connection, none given, called in /var/www/html/d8/modules/custom/my_queue/src/Plugin/QueueWorker/QueueBase.php on line 49 in Drupal\Core\Queue\DatabaseQueue->__construct() (line 45 of /var/www/html/d8/core/lib/Drupal/Core/Queue/DatabaseQueue.php).

I tried another way as well like below

$equery = \Drupal::database()->select('queue', 'emp');
      $equery->fields('emp', ['data','item_id'])->condition('emp.expire', 0, '=')->condition('emp.name', 'my_queue', '=');
      $eresult = $equery->execute()->fetchObject();

when i print_r($eresult); it is printing empty but same query executed in phpmyadmin and got the result as well. I don't know whats wrong with my query here.

My my_queue.module file is like this. I am calling my controller function on cron run to process the queue.

<?php
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\my_queue\Controller\MyQueueController;

/**
 * Implements hook_help().
 */
function my_queue_cron() {

  // Remove 6 months old entries from custom table.
   MyQueueController::processQueue();

}

Here i am getting error like

Error: Using $this when not in object context in Drupal\my_queue\Controller\MyQueueController::processQueue()


texts: Custom search results usign Search API + views

texts:
I am currently using Search API for indexing my content . I use Views for displaying search results and Views exposed filter for search form. In the search results page I use facets to filter based on content type, created date etc. I need to upgrade the search feature and provide the following features. Please let me know the Modules or APIs that can help me achieve this.

1) Split the search results based on content type.
Ex: If there are any nodes of content type A, content type B in the search results, I need to display the top 2 nodes of the content type A , top 3 nodes of content type B and the rest of the results.
Formatting of the result display is based on the content type.

2)In the facets I would like to display custom group names instead of the actual content types. Ex: If there are multiple content types like 'Books', 'Articles', 'Magazines' etc I would like to display the link in Facets as a single entry 'Publications' and in the view filter based on the actual content types.

Is it possible to achieve the above 2 features using search API? I am open to changing the approach for displaying search results(alternative for Views and exposed filter if required).

Please suggest


texts: Problem in Recurring payment using money scirpts

texts:
we offered 20% discount last year and I've just received a recurring payment and it should be for full amount but its the same payment as last year. It just means if people renew their membership we lose on 20% of each membership fee.

Am using MS Core 6.x-1.25 and Drupal Version 6.20

Any one can help?

Thanks


texts: Add condition to entity field query to filter field collection item by host entity

texts:
I have a field collection, field_speaker with a field field_speaker_user_reference (User entity reference).

I would like to know if a specific user is referenced on a specific node.  I have the following which will return 0 results:

$efq = new EntityFieldQuery();
$efq->entityCondition('entity_type', 'field_collection_item');
$efq->propertyCondition('field_name', 'field_speaker');
$efq->entityCondition('entity_id', $node->nid);
$efq->fieldCondition('field_speaker_user_reference', 'target_id', $user->uid);
$results = $efq->execute();

The table drupal_field_data_field_speaker has entity_id, which is the host entity (it's a node id).  The table drupal_field_data_field_speaker_user_reference has the user referenced.  If I remove $efq->entityCondition('entity_id', $node->nid); I get all items for user.

A sql query that gets the results I want would be:

select * from
  drupal_field_data_field_speaker s
  JOIN drupal_field_data_field_speaker_user_reference u
  ON u.entity_id = s.field_speaker_value
  AND u.field_speaker_user_reference_target_id = 26308
  AND s.entity_id = 47746

What is the right condition to add to entity field query so that I can filter by the host entity?


texts: Cannot find out what is rendering a view block?

texts:
I am working on an existing Drupal 7 website. I have a view that has a block display. The block is being displayed on some pages in the "second_sidebar" region. The mystery is that I cannot figure out how this block is being rendered/displayed in that region of those pages! In other words, the block is being added to the $page['sidebar_second'] variable, but cannot find how it is being included in that variable.

Please take into consideration the following facts:

The block is not being assigned to any region in
"admin/structure/block
In the page.tpl.php, there is no inclusion of that block in the page['sidebar_second'] variable
None of the theme templates are directly rendering that block


texts:
I have uploaded the drupal website on one of my domain and it is working well, then now I need to migrate it to another domain. Every thing was migrated but when I try to upload images from admin panel it is not uploading correct images. Means, if I try to upload let say cat.jpg then sometimes it display another random image from my directory. Strange issue, unable to figure out why?

I am trying to upload the following image:

And when it is uploaded it is displaying a random image:


texts: oAuth2 Server POST /oauth2/token gets redirected

texts:
When my server tries to access /oauth2/token it gets a redirect.

It seems that the request never even makes it to the point where it can process the authorize_code since the server trying to access /oauth2/token is not authenticated.

This is not expected behaviour is it?  Is it possible another module is intercepting the authantication before it gets to the oauth2 server module?

Gerd.


texts:
I need to use node_add(), but when I called it in my module I get the "undefined function" message.

So I'm trying to include it using module_load_include('inc', 'node', 'node.pages'), but I'm getting the error message:

  Fatal error: Unsupported operand types in /var/www/vhosts/**.es/httpdocs/includes/common.inc on line 2946

Do you have any idea?


texts: Overriding template without killing the page?

texts:
I would like to override the template for node creation. In the past when I've overridden a template, I've usually just copied the theme's generic template for that type (page, node, etc), given it the proper name, and edited it as I saw fit.

Now, for the first time I need to override a template that I can't simply make a copy of. I'm editing the node editing template and I have created a file with the correct name and location and everything, and it overrides the edit form, all right. Now there's nothing on the page except what's in my new template (unsurprisingly).

So, how do I create a template without getting rid of what was already there? Or, where can I find the template that Drupal is using to create my node edit form?

I'm using Drupal 7 and the theme is a custom one written by the previous maintainer of the site. It's not a child theme of a base theme, it's all by its lonesome.


texts: How do prevent other users from seeing certain views in a user profile?

texts:
I have setup a View which showscertain information to a user, when he/she is logged in provided that logged in user is referenced in the content type containing that information.

The View shows this information user the name of the uid from the url.

The website is such that the logged in user can view the profile of other users, this makes the logged in user have access to the information of the user whose profile is viewing which shouldn't be the case. Please tell me  how do I prevent this?


texts:
This is a more general question about db_query() performance.

I have this function to create an API resource with Services module, and I need to get about 10 fields belonging to several nodes.
Basically I have a list of nids and create an array containing information from their fields. The nodes have a lot more fields than I need so doing node_load to get the info is really slow, so at the moment I am geting the info using db_query() calls for each field that I need.

My question is: would it perform better if I only have one db_query with about 10 inner joins? or should I leave it as 10 separate db_queries?

I am going to do some performance tests, but I thougt someone might have some insight or explanation on why one would perform better tha. the other.


texts: In user profiles, I have added a term reference field. In my module, I want to get users that have a term id. Is there a function like taxonomy_select_nodes but for users to select users having a taxonomy term?


texts: How can I create a custom landing page for a specific taxonomy term?

texts:
How would I be able to have a customisable page where in it will be a landing page for special taxonomy terms and will display the related articles of a specific taxonomy term.

For instance, mywebsite.com/myspecialtaxonomyterm will display a PAGE, wherein a list of articles related to the tag myspecialtaxonomyterm is displayed, beside it is a custom widget as the sidebar and on top of it is a custom block which may contain videos or banner image. Can this be done by the Views module alone or should I create a module for this to be done?

NOTE: This page will be set to be the landing page of a specific tag, based on my example above. I am really confused on how to approach this.


texts: Hooking into an update of the db system table

texts:
Essentially I want to be able to monitor all updates to the db system table, by catching all updates to the db system table (for a particular theme's record). We have encountered some odd bugs whereby all themes are periodically (and apparently randomly) disabled, and I need to be able to log further information whenever this theme is disabled. What is the best way to approach this?

Alternatively is there a way to hook into the function for whenever a theme is enabled/disabled?


texts: How do I create a rule that publishes comments on node after 3 days?

texts:
In Drupal 7, and I am trying to make a rule that publishes comments on a node 3 days after they have been created. I had a look at this post to see if I can do this in reverse.

Workflow:

  A comment is created (unpublished)
  The author has 3 days to publish or "delete" the comment (the comment actually just gets archived).
  If no action has been taken after 3 days or it is not "archived" then publish the comment

My rule (I struggled to get this working so the Scheduled Evaluation Date is 30 seconds)

My rule component

Am I on the right track or am I missing something?


texts: How to use Php code in Views page contextual filter with dynamic URL i.e using %?

texts:
I have a content type App with a term reference field called App category.

I'm creating a view page with path app/%. I don't want to use App ID or anything numeric in URL in place of %, so I'll be using app/cooking-app where cooking-app is URL Alias of App Category.

How can I display all the nodes whose value in App Category field is cooking-app? I can easily do this using PHP code but PHP code in contextual filters is not working.


texts: Amazon S3 module how does the local cache work and where is it at?

texts:
I'm using the Drupal Amazon S3 module and just wondered where/how the local cache works.  Does it reduce file gets to S3?  From what I can see there is an amazons3 table in the db and I can see information being retrieved from this in the module code, but wondered if the file retrieval also was being cached locally.  The retrieval looks to be fast on second and subsequent retrievals and I wondered if this was being cached server side or whether this was purely browser caching coming into play.  If I clear my browser cache, the image retrieval still seems faster than I've seen before with S3 storage but I couldn't locate where the file is being cached.

Many thanks
Lawrence


texts: Page not found for a node that does exist?

texts:
I have created a module which includes a custom form. When the form is submitted the module uses drupal_write_record to insert the form contents into the database. The first drupal_write_record is to the node table. Using phpmyadmin I've looked into the node table and I can see there is a record where nid is 11. If I request example.com/?q=node/11 I get a 'page not found' error.

Here is record 11 from the node table:

nid,vid,type,language,title,uid,status,created,changed,comment,promote,sticky,tnid,translate
11,NULL,game,und,Title,1,1,1365111019,1365111019,1,0,0,0,0

Why doesn't example.com/?q=node/11 return the contents of this record as a page? Do I need to do something else?


texts: How to know if a site is Multilingual programmatically?

texts:
In Drupal 7 I used drupal_multilingual() to know if a site is multilingual, but this function was renamed in Drupal 8 to language_multilingual(), the problem is that it seems that language_multilingual() is not longer available.

I found that LanguageManager::isMultilingual should return:

  bool TRUE if more than one language is added, FALSE otherwise.

But when you go to see the code always FALSE is returned.

public function isMultilingual() {
  return FALSE;
}

This is an error or I missing something?


texts: Increase upload file size by content type

texts:
I have worked with our host to increase our upload file size to 2GB.  However, on one page it still states that the files must be less than 3MB.  How do I change that?  I am a Drupal novice so please bear that in mind.

The following is on a content type on our website (classified as a 'story'):

  Files must be less than 3 MB. Allowed file types: jpg jpeg gif png txt
  doc xls pdf ppt pps odt ods odp.

So I am trying to increase the size to be 2GB as per what our host is allowing. How do I increase the file size to upload?


texts: What variable will let me access user profile info?

texts:
I'm using prepopulate to prepopulate a feild of a node/add/content. I'm trying to generate a URL using some PHP code that willl generate a URL like:

http://mysite.com/node/add/content_type?edit[title]={$some_var}

Each of my user profiles will have this link at the top of the page and I would like $some_var to hold the username of the user whos profile we are currently viewing. I was wonder how to populate $some_var with the username of the user profile being viewed.

Something like:

$some_var = $username;
print("Content Type");


texts: How can I configure the User Protect module to avoid editing/deleting users with "edit users" permissions?

texts: I am working in Drupal 6. I have created a role "admin users" with permissions for edit and delete users but I need that this role "admin users" cannot edit/delete the user admin. I have installed the User Protect module but I cannot to configure it correctly for the role "admin users" can not modify it.


texts: How to use taxonomy fields with Views and avoid duplicates?

texts:
I have content type 'sports venue' which is related to taxonomy vocabulary 'activity'. So a simple View of venues and activities might look like this:

Park : football, hockey, running
Pool: swimming, diving
Stadium : athletics, running

I add an image field to the taxonomy terms to show an icon for each activity. Then I want the same View as above, but showing the activity icon instead of the term name.

In the View I add a relationship to the taxonomy vocabulary and add the taxonomy icon field.

Now the View has duplicates; 3 entries for park, 2 entries for pool etc. I only want a simple list as above.

Sometimes I can get close by using grouping and aggregation settings, but it gets quite messy. Am I missing something obvious here?

Note: This comment from Merlinofchaos is relevant, but refers to D6. Now that we can add fields to taxonomy terms in D7 core, I wonder if there are more options?


texts: After updating to 7.27, updates don't work and Status says cannot verify Drupal core

texts:
I upgraded my site to 7.27 using drush, and my website says that it is running 7.27 under the "modules" admin page.

However, when I get a status report, it says "No update data available.
No update information available. Run cron or check manually."

So I run the cron there, and it will turn green and read "Drupal 7.27" but if I try to run update my modules it just stops the page after saying "checking for updates" and the status report reads the above error again instead of reading "Drupal 7.27".

I've rebuilt the registry, and I am at a loss as what to do now.

Any advice is appreciated. Thanks.


texts: How to auto-assign a user a particular role when that user gets autocreated in a content form?

texts:
I need to auto-assign newly autocreated users from the content editing
form a particular role.

I created this new content-type : Music Track and created a new field - Artist for it. The Artist field is entity referenced to Target type - USER. I was expecting a Roles list under Entity Selection area so that I can restrict only Artist role users to be created when creating a new content and adding new artists but its not available.

Note:
Users are being autocreated using Entityreference Autocreate module.


texts: Set entity reference field in form to readonly

texts:
I am building a custom module to set default values for entity reference fields. To avoid overwriting these defaults, i would like to set the field readonly. While I got the defaults to work, setting it readonly does not work, the field is still editable. Here is my code :

function prepopulate_references_form_alter(&$form, $form_state, $form_id) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'producttype')
  $result = $query->execute();
  $refobject_ids = array_keys($result['node']);
  // the next line works great:
  $form['field_testreference'][LANGUAGE_NONE]['#default_value'] = $refobject_ids;
  // this line doesn't have any effect:
  $form['field_testreference'][LANGUAGE_NONE]['#attributes']['readonly'] = TRUE;
  // ... and this one neither:
  $form['field_testreference'][LANGUAGE_NONE]['#attributes']['disabled'] = TRUE;

What is the problem here?

Edited:
As Darvanen suggested, dpm() shows that $form['field_testreference']['#access'] = FALSE; works great.


texts: Feeds import from Restful Web Service module output

texts:
I have a D7 website, which expose a node through the module Restful Web Service https://www.drupal.org/project/restws

It does exposed my website node in Json format.  The only issue I have, is the photo field, which has multiple images  but JSON output from RESTWS is only expose the photo file id, not the file name.

My question, is there're plugin for the Feeds module that I can use to convert the file ID to a file name, so the feed can import that.  Or is there other way that I can use to directly import the file fid to Drupal.

Here's a little info about my website:  The user can list their content on bronze plan content type, and then they decide to upgrade to silver content type, what I'm doing in the background, is export the bronze content type through Restful Web Service and re-import through feeds to silver content type.


texts: How do I save data into a custom table on form submit?

texts:
Number of columns in my custom table is huge. How do i insert data in custom table on form submit in Drupal 8?
I want to use something similar to drupal_write_record('table_name', $form_state['values']); in Drupal8.


texts: How can we manually enter a payment using their credit card information for a customer in Commerce?

texts:
We have customers that are not web savvy and would like us to enter their order for them on the website.
Currently, the admin masquerades as the user, creates the order as them, checks out as them, and then enters their credit card info. Then un-masquerades.
Is there an easier way to do this? We've tried Creating an Order in the backend but the Payments tab says the following for all Credit Card payment methods.
"There are no reusable payment methods available for the selected gateway."

We were hoping it would be as easy as manually creating the order and then enter the payment for Commerce does not seem to allow enter CC info on the backend.
We're using Authorize.net


texts: Views Rest Export and sending page numbers in it's response

texts:
I have a paginated views using "rest export" and I'm using it to show that data on mobile app, everything works fine, but I want to know how many pages exist on that endpoint to show page numbers in my app.

I know I can alter the view programmatically, but I'm asking if there is a simple solution to achieve this.

This is the view settings page.


texts:
I have an INT field with a Unix timestamp.  When I add this field to a view, I do not get any date formatting options.  I just get options for the thousands market (non, comma, etc).  How do I get Drupal to recognize that this is a date field?

I am using the Date modules.


texts:
In my projects, Whenever Authenticated user create new content(page) they should redirect to paypal for done payment when they click save. Once Payment Success Node should be save otherwise its should not save.

Please help me for Fix this concept.

Thanks in Advance


texts:
Is it possible to determine who created the order? I've installed the entity reference module, then added a entity reference field in the order, but I'm not sure if this will work.

I've used the hook_form_alter() to get the current user id and set the current username as a default value.

How to check and save the current user who created the order upon saving the order? Will only set the default value on first save, then it won't change anymore in the next save.

Below is my code:

$user = $GLOBALS['user'];
if ($user->uid) {
  $form['field_order_created_by'][LANGUAGE_NONE][0]['target_id']['#default_value'] = $user->name;
}


texts: In Drupal 7, is there a way to edit nodes from a view? For example, could I add a checkbox or drop down menu for each node in the view to set a particular attribute of that node?


texts: Registration message after saving password for first time

texts:
I am using standard way of user registration. User enters default fields + some extra text fields, gets email, clicks link in email.
Back to website, he clicks one time login in button and enters password.
After saving password message pops up, which makes no sense.

"You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password. The changes have been saved."

Why is message "Please change your password" here ?


texts:
I am trying to achieve the following output- id like a view with two images- each displaying a corresponding menu on hover- I've looked at using rewrite result for an image field in views for this- but I don't think I am using it properly. I would be tremendously grateful if anybody could take the time to give me some tips or tutorials on how to do this?

Note: I am a drupal-newbie.


texts: How to make strings from templates translatable on all pages they appear?

texts:
I have some calls to t() in *.tpl.php files. For the sake of example, let's say I'm talking about products and product.tpl.php file.

Strings in templates are not recognized until the first time they are actually used. There was a thread on Drupal.org about that and I found it to be accurate. Sadly, if I go to, let's say, http://example.com/pl/product/200, then that string will be saved in {locales_source} table with location field set to /pl/product/200.

I need my users to be able to translate using Localization client module's on-site translation tool, so they can actually see what they are translating, having it in proper context. With source location set to /pl/product/200, the product with ID 200 is the only one on which the string is shown to be translated. And far worse, if I may be able to force users to translate on that particular product, I need them also to be able to translate to russian, and there is no product with location set to /ru/product/PID.

Is there a way to re-format location string in database, to make all strings visible on all products, all languages in l10n_client tool?

I tried setting it to:

; sites/default/themes/mytheme/product.tpl.php,
sites/default/themes/mytheme/product.tpl.php,
sites/default/modules/mymodule/mymodule.module (module that generates themed data)

But it only made them invisible for the translation tool.

I'm pretty sure it's not a bug in Localization client, it shows the string where it's told this string occurred. And it seems it's "just the way it works" for Drupal 7 translation system, too - was discussed and reported already, and nothing changed. So this isn't a bug report, I just ask how to work with what we have to work with.

I'm talking about texts that have nothing to do with the data module operates on. I don't want to translate products, just template strings that have nothing to do with product itself, like Previous - Next on product image gallery template.

For example, module returns 15 thumbnails, and it is a theme's job to show 5 a time. And previous / next links needs alt and title attributes. Translated. But my module does not know that. And never should need to.


texts: After moving a new server, one of 2 Drupal sites, has no css loaded

texts:
I moved 2 sites from a shared server to a VPS. One works just fine with a custom theme, but the second doesn't have the Bartik CSS loaded.

Both sites moved via the user root and as it seems almost all of their dirs are 755 root root.
Temporary files dir is /tmp
manual cache flush from from DB doesn't change anything.

Something wierd I noticed and don't know to solve is the fact I can't disable CSS or JS aggregation. Maybe this reflects the core problem?


texts:
I would like to make a view to select the contents flagged by a list of users.

I tried this:
https://www.drupal.org/node/1191228

but it works only for one user at time. I would need that for multiple users.

In the "uid" contextual filter I tried to set "Allow multiple values" in the "more" area, but when I use more than one user ("uid1, uid2" or "uid1 + uid2"), the view is not ran.

any idea?

thank you


texts: Are there any alternatives to drupal_add_js()?

texts: Are there any alternatives to drupal_add_js() that permit to write inline JavaScript code?


texts: Enable different elements for different webform-content type

texts:
The Webform module has a setting page (admin/settings/webform) that enables you to select which content type you want to act as a "webform".
You can also select which elements show up in the form, but this is a global setting.
Is there any way that we can select different elements for different webform-content types?


texts: How to render a Drupal 7 menu structure with divs instead of lists

texts:
I want to change the output of the Drupal 7 menu structure which is like:

<?php print render($primary_nav); ?>

outputs:

    Lorem

Lorem

Ipsum

Dolor

Sit

Amet

Consectetur

how could I have instead of the ul and li the menu rendered with a div structure.


texts: I want to call ajax callback function from another module's controller in Drupal 8. is it possible?

texts:
I am giving the code of my main form and the controller of another module where the ajax callback is written. Actually this ajax callback function will be used in different forms. So I want to create a common module to call this function. Kindly help.
This is the form field of main form:

    $form['construction_type'] = array(
  '#type' => 'radios',
  '#title' => $this->t('1. Whether Boiler or Economiser:'),
  '#default_value' => 'b',
  '#options' => array('b' => $this->t('Boiler'), 'e' => $this->t('Economizer')),
  '#ajax' => [
                  'callback' => '\Drupal\common_functions\Controller\CommonFunctionsController :: ajax_load_boiler_size',

               ],
);

And this is the ajax callback function in controller of another module

    class CommonFunctionsController extends ControllerBase{  public function ajax_load_boiler_size(array &$form, FormStateInterface $form_state){
$response = new AjaxResponse();
$response->addCommand(new ReplaceCommand('#boiler_size_div', $form['boiler_size']));
return $response;

}

The error message is Symfony\Component\HttpKernel\Exception\HttpException: The specified #ajax callback is empty or not callable.


texts: How to distribute a Drupal website on a flash card?

texts: I would like to take a Drupal website and distribute the information on it on a flash card or DVD -- even if it is a read only version. The people who will be using the website will not always have internet access. Plus, it's the type of information that somebody would like to sponsor. So at intervals the website will be published onto a flash card or DVD with a company logo on it and the website will be branded to the company. Any ideas?


texts: Field added to user profile does not appear in database?

texts:
Drupal 7 provides the ability to add custom fields to the user profile through admin/config/people/accounts/fields.

I have added a firstname field. It appears on the registration page but in the database the field is not added. Where it is stored?


texts: How can I differentiate between third-party and custom modules in the list of modules?

texts:
If I have administrative access to a Drupal site, I can see the list of the modules enabled for the site.

How can I differentiate between third-party and custom modules?


texts:
I am running into an issue where the uploaded image gets unset after few hours while uploading a new user picture.

Also the previous picture does not gets deleted and throws an error "File cannot be deleted because it's not a valid uri".

Here is my save function that updates the user picture programmatically.

 $userimage = $form_state['values']['userimage']; //fid of the file in custom form
 $user_image_file = file_load($userimage);
 $wrapper = entity_metadata_wrapper('user', $user);

 // get image information
 $image_path = file_create_url($user_image_file->uri);
 $image_info = image_get_info($image_path);

 // create file object
 $file = new StdClass();
 $file->uid = $uid;
 $file->uri = $image_path;
 $file->filemime = $image_info['mime_type'];
 $file->status = 1; // Yes! Set status to 0 in order to save temporary file.
 $file->filesize = $image_info['file_size'];
 $file->filename = drupal_basename($image_path);
 $file->status   = FILE_STATUS_PERMANENT;
 $file = file_save($file);
 // save file to user entity
 $edit['picture'] = $file;
 user_save($user, $edit);

The image just vanishes and gives a broken url after few hours. Any directions?

Thanks


texts: How do I allow only username for password reset form?

texts: By default the password reset module allows 'Username OR E-mail'. I am using a module which allows multiple user accounts with a same email address (but usernames are unique and auto-generated), so the unique user account identifier for logging in is username, I need this to be the same in case of password reset form.


texts: How do I implement hook_views_post_execute

texts:
I am attempting to modify the output of view programmatically using hook_views_post_execute.

I created the usual module structure (in this case using drupal generate:module.

I am able to use other hooks (such as hook_entity_view)successfully.

However, hook_views_post_execute causes blows up the website with the message

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

The code block is right out of api.drupal.org.

/**
 * @param ViewExecutable $view
 */
function idm_views_post_execute(ViewExecutable $view) {

  // If there are more than 100 results, show a message that encourages the user
  // to change the filter settings.
  // (This action could be performed later in the execution process, but not
  // earlier.)
  $temp = $view;

  if ($view->total_rows > 100) {
    \Drupal::messenger()
      ->addStatus(t('You have more than 100 hits. Use the filter settings to narrow down your list.'));
  }
}


texts: How to add a node field to a database table in a custom module

texts: When I am writing my own custom module, and designing a database table, if I want to use the  field nid to refer to a node, because I want my module to adding something to each node, how should I implement this in the module's mymodule.install file?


texts: Content Type: Is it possible to have Term reference on Parent Term instead of Vocabulary?

texts: I have many Parent Terms with child terms on a Vocabulary. I wanna use one of the parent terms on a content type as option. Is it possible to have a Term Reference field on a Parent Term instead of a Vocabulary?


texts: Why is migration lookup failing during synchronisation of Group entities?

texts:
On the basis of an RSS feed, I am required to create Group entities and Users out of the feed's items.

Each item contains sufficient data:

<item>
  <id>123</id>
  <title>An example</title>
  <description>Some &lt;strong&gt;HTML&lt;/strong&gt; description.</description>
  <author>John Doe</author>
  <email>john.doe@example.com</email>
  <pub_date>09/19/2017 - 08:30</pub_date>
</item>

I am using Core's migration module along with migrate_plus and migrate_tools and wrote two migration yml files, one for creating Group entities out of the items and one to generate users out of the author & email fields.

Taken separately, both work fine, that is I am getting Group entities and User entities as expected. The only issue which I can't get my head wrapped around is to set the respective User to be the Group's owner.

Here's the processing part of the Group yml file:

process:
  uid:
    plugin: migration_lookup
    migration: migrate_plus.migration.users
    no_stub: true
    source: email
  label: title
  field_description: description
  created:
    plugin: format_date
    from_format: 'm/d/Y - H:i'
    to_format: 'U'
    source: pub_date
  status:
    plugin: default_value
    default_value: 1
  type:
    plugin: default_value
    default_value: my_group_type

migration_dependencies:
  required:
    - migrate_plus.migration.users

All fields except for uid are set correctly. If I change the user id process part to something static like

  uid:
    plugin: default_value
    default_value: 1

it works as well and the Group's owner is set to the Super User account. So, I reckon there's something wrong with the migration_lookup processing part. I have read numerous tutorials on how to use that and it looks fine to me. I also read that migration_lookup fails silently if there is an error which makes it hard to debug.

Looking at the migration map table in the database it looks fine too:

mysql> select * from migrate_map_users limit 1;
+-----------------+----------------------+---------+-------------------+-----------------+---------------+------+
| source_ids_hash | sourceid1            | destid1 | source_row_status | rollback_action | last_imported | hash |
+-----------------+----------------------+---------+-------------------+-----------------+---------------+------+
| 009d...234ef457 | john.doe@example.com |     118 |                 0 |               0 |             0 |      |
+-----------------+----------------------+---------+-------------------+-----------------+---------------+------+
1 row in set (0.00 sec)

Due to the migration dependency through

migration_dependencies:
  required:
    - migrate_plus.migration.users

the User migration should also run first, but it still doesn't work. Even after both migrations have run through, I tried an update migration run, but the Group's owner is never set (stays at being 0/Anonymous).

Is there soemthing wrong with my yml file? Are there other means to connect user and groups?


texts:
I have a form_form_id_alter function that sets some default values and a checkbox checked.

If I submit the form, with the checkbox unset and it fails validation, the re-rendered form re-sets the checkbox to a checked state (as per the form_alter), not the submitted state.

Is this expected behaviour? I would expect the submitted values to remain persistant.

Do I need to re-assign the submitted values in the form_validate function or am I doing something wrong?

I'm using this function to alter form:

// Form ID alter
function events_form_registration_event_node_form_alter(&$form, &$form_state, $form_id){
  global $user;

  $form['#validate'][] = 'events_form_registration_event_node_form_validate';

  // If node add.
  if(arg(1) == 'add'){

    // Check if the user is an event editor and perform the form_alter
    if(events_does_user_have_role($user)){

      // Show end date, checkbox value checked
      $form['field_show_end_date'][LANGUAGE_NONE]['#attributes']['checked'] = 'checked';

      // Event status, list value Open
      $form['field_event_status'][LANGUAGE_NONE]['#default_value'] = 'Open';

    }
  }
}

// Validate form.
function events_form_registration_event_node_form_validate(&$form, &$form_state){

  // Get the current end date value from submitted form.
  $current_end_date_value = ($form_state['values']['field_show_end_date'][LANGUAGE_NONE][0]['value']);

  // Set the show_end_date element to have the submitted value.
  $form['field_show_end_date'][LANGUAGE_NONE]['#attributes']['checked'] = $current_end_date_value ;

}


texts:
I'm helping someone to maintain a Drupal site and I still have not figured out how drupal actually works, it's driving me bonkers.
I need to make a change to the way some content is displayed, but cannot figure out where that change needs to be made - I could go around just changing up the site until I stumble on it, but would rather not put a wrecking ball through their site like that.

Would appreciate if anyone can point me to a simple explanation of how to find out how a node is rendered and how I can track down the views involved.

The setup of the site is they have content types candidate and survey

When you view a candidate you see a nice table with info on the candidate and their survey responses.

I want to add some new fields (some to survey, some to candidate)
I've added the fields, but don't know which view is involved in rendering as the views are not named clearly.

How can I figure out which view is involved in rendering a candidate when I go to
www.site.com/candidate/bob
?


texts: how to default value to select list CCK with form_alter

texts:
I am usingCCK 2 (2.9), and I know that CCK field give the option to assign the default value using the pipe, for example

Please select|Please select

But I am just curious about if exist a programatically way to assign a default value to a select list. I have several tries, using this kind of syntax:

$form['field_color']['value']['#default_value'] = 'Black'; //or
$form['field_color']['#default_value'] = 'Black'; //or
$form['field_color']['#default_value'][0]['value'] = 'Black';

but nothing. To me not is clear what is the correct syntax.

thanks in advance.


texts: Installing the latest Kickstart update, 7.x-2.54, results in the Status report telling me I have an unsupported version of Drupal core. Screencap attached. Notice the installed and recommended versions are the same. I'm also getting emails saying my version of Drupal is unsupported. Does anyone know why this is happening and how to stop it?


texts: Change image background colour when cropping

texts:
Is it possible to change the black background colour to another colour (e.g. white) when cropping an image that is smaller than the crop size?

I'm using the "image styles" settings in Drupal 7 to first scale the image to the correct width and then cropping to get the desired height. This results in some of the images having black borders that really don't look nice (and the client doesn't like).

Any other suggestions to fixing this would be appreciated.


texts:
I was wondering what are "Panes" - I found them while I was messing with source code of Ubercart module. It looks like they're building page with something like panes - which I'm totally new to. Code looks like:

  // Load through the cart panes...
  foreach (uc_cart_cart_pane_list($items) as $id => $pane) {
    // If the pane is enabled...
    if ($pane['enabled']) {
      // Add its output to the cart view.
      $build[$id] = $pane['body'];
      ...

So, are "panes" Ubercart concept, or some in-general thing? I searched with "Drupal Panes" but no luck.


texts: Find out which theme is loaded in a given page

texts:
I am trying to do some theming for Drupal 8 and I was trying to understand what theme is being used on a given page. I remember using theme developer module in Drupal 7, and using dpm() of the page array after theme developer started having issues.

How can I achieve the same with Drupal 8?


texts:
My custom module enables my custom token that allows me to create user paths from one of 3 fields: user:name, or if exists first name + last name, or if exists pageurl field.

this token really gives me the strings like:

Katherine Resette - if page url field is not filled

Mike Nukle - if page url field is not filled

mybeautypage - if page url field is filled

This custom token is: [user:user_pageurl]

and I use this token in Pathauto Patterns on User Paths: [user:user_pageurl]

it does not create strings like:

example.com/katherine-resette and

example.com/mike-nukle

it use just this line as it is:

example.com/Katerine Resette

Please help me to fine my code with pathauto alias create ?

the code from my module user_pageurl.module is this:

     /**
 * Implements hook_token_info().
 */
function user_pageurl_token_info() {

  // Add tokens.
  $user['user_pageurl'] = array(
    'name' => t('Page URL'),
    'description' => t('Defines string for user page address based with priorities
                        (if filled, 3 - high priority, 1 - low priority) : 1. login, 2.fields First name and Last name, 3. field Page URL'),
  );

  return array(
    'tokens' => array(
      'user' => $user,
    ),
  );
}

/**
 * Implements hook_tokens().
 */
function user_pageurl_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();

 if ($type == 'user') {
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'user_pageurl':
          $user_pageurl = user_pageurl_token_replace($data, $options);
          $replacements[$original] = $sanitize ? check_plain($user_pageurl) : $user_pageurl;

          // pathauto clean
          module_load_include('inc', 'pathauto', 'pathauto');
          $replacements[$original] = pathauto_clean_alias($replacements[$original]);
          break;
      }
    }
  }

  // Return the replacements.
  return $replacements;
}

 /**
 * Implements hook_token_info().
 * user_pageurl token might contain 1 of 3 user fields
 * 1: user:name - login
 * 2: first name + last name - if exists any
 * 3: pageurl field - if exists - highest priority
 */
function user_pageurl_token_replace($data, $options) {
  //dpm($options);
  $language = $options['language']->language;

  //high priority pageurl token - user:field_pageurl
  //dpm($data['user']->field_pageurl);
  if (isset($data['user']->field_pageurl[$language][0]['safe_value'])) {
    $pageurl = $data['user']->field_pageurl[$language][0]['safe_value'];

    return $pageurl;
  }

  //medium priority pageurl token - user:field_first_name user:field_last_name
  if (isset($data['user']->field_first_name[$language][0]['safe_value'])) {
    $first_name = $data['user']->field_first_name[$language][0]['safe_value'];
    $pageurl = $first_name;
  }
  if (isset($data['user']->field_last_name[$language][0]['safe_value'])) {
    $last_name = $data['user']->field_last_name[$language][0]['safe_value'];
    $pageurl = $last_name;
  }

  if (isset($first_name) &&  isset($last_name)) $pageurl = $first_name . ' '. $last_name;

  //low priority pageurl token - user:name
  $pageurl=$data['user']->name;

  return $pageurl;
}

I do not understand why pathauto takes the string as it is and do not transform it replacing uppercases, spaces and so on...


texts: How can I find out which cache is still active?

texts:
I have been walking through this page https://www.drupal.org/node/2598914 but I still have to hit clear cache during development process.

vendor/bin/drupal site:mode dev
PHP Warning:  Module 'pdo_mysql' already loaded in Unknown on line 0
 Configuration name: system.performance
 ------------------------- ---------------- ----------------
  Configuration key         Original Value   Override Value
 ------------------------- ---------------- ----------------
  cache.page.use_internal                    false
  css.preprocess            false            false
  css.gzip                  true             false
  js.preprocess             false            false
  js.gzip                   true             false
  response.gzip                              false
 ------------------------- ---------------- ----------------

 Configuration name: views.settings
 -------------------------------- ---------------- ----------------
  Configuration key                Original Value   Override Value
 -------------------------------- ---------------- ----------------
  ui.show.sql_query.enabled        false            true
  ui.show.performance_statistics   false            true
 -------------------------------- ---------------- ----------------

 Configuration name: system.logging
 ------------------- ---------------- ----------------
  Configuration key   Original Value   Override Value
 ------------------- ---------------- ----------------
  error_level         hide             all
 ------------------- ---------------- ----------------

 Services files "/var/www/web/sites/default/services.yml" was overwritten

 New services settings
 ------------------------------------------ ------------- -------
  Service                                    Parameter     Value
 ------------------------------------------ ------------- -------
  http.response.debug_cacheability_headers                 true
  twig.config                                auto_reload   true
  twig.config                                cache         true
  twig.config                                debug         true
 ------------------------------------------ ------------- -------

 // cache:rebuild

 Rebuilding cache(s), wait a moment please.

 [OK] Done clearing cache(s).

Aggregation of js and css are off too.

How can I find out which of the cache systems still runs?


texts: How to change fieldset which is made via #theme_wrapper Drupal 7

texts:
I want to change fieldset settings on some form, I want to make it collapsed by default. The problem is this fieldset isn't made via usually form API. Its made via #theme_wrappers param. The question is how to alter #theme_wrappers output so it affect only certain form. Thanks!.

[#theme_wrappers] => Array(
  [0] => fieldset
)


texts: E-mail on registration showing very strange characters!!! я│п╟п╧я┌п╣

texts:
I developed the website in English, then enabled the locale module ,i added Russian language..i also set it as a default language to my website.
But when user register they got strange characters in their emails!!!!!! is there any settings do adjust to fix this?

//below is my user settings.
Who can register account=Visitors
E-mails(Welcome no approval required!)==i change the Text to russian

[user:name],

Вы успешно зарегистрированы на сайте Бесплатных купонов http://www.example.ru!
Теперь вы можете получить скидки Бесплатно!

Логин: [user:mail]
Пароль: Ваш пароль

Просим вас не отвечать на это сообщение автоматичеческое рассылки.
--  [site:name] Команда

//and here the example of the email sent to user
п▓я▀ я┐я│п©п╣я┬п╫п╬ п╥п╟я─п╣пЁп╦я│я┌я─п╦я─п╬п╡п╟п╫я▀ п╫п╟ я│п╟п╧я┌п╣
п▒п╣я│п©п╩п╟я┌п╫я▀я┘ п╨я┐п©п╬п╫п╬п╡ http://www.example.ru!
п╒п╣п©п╣я─я▄ п╡я▀ п╪п╬п╤п╣я┌п╣ п©п╬п╩я┐я┤п╦я┌я▄ я│п╨п╦п╢п╨п╦
п▒п╣я│п©п╩п╟я┌п╫п╬!

п⌡п╬пЁп╦п╫: someone@mail.ru
п÷п╟я─п╬п╩я▄: п▓п╟я┬ п©п╟я─п╬п╩я▄

п÷я─п╬я│п╦п╪ п╡п╟я│ п╫п╣ п╬я┌п╡п╣я┤п╟я┌я▄ п╫п╟ я█я┌п╬ я│п╬п╬п╠я┴п╣п╫п╦п╣
п╟п╡я┌п╬п╪п╟я┌п╦я┤п╣я┤п╣я│п╨п╬п╣ я─п╟я│я│я▀п╩п╨п╦.
-- Example.ru п п╬п╪п╟п╫п╢п╟

Your help to resolving this will be appreciated.


texts: Access View current result count in Twig?

texts:
I need to theme the result count of a view. I am using the one provided by views in the Header of the view.

Currently, it says:

"Showing 1-10 of 200 results."

What I need to do is wrap the numbers in a span with classes to style them, so it is like:

"Showing 1-10 of 200 results."

and the bolded numbers are slightly larger and a different color, due to the styling.

I can't find these variables in twig or in the view preprocess, however. Is there a way to get them?


texts: Where does drupal store LDAP server information?

texts: I am looking for the location where drupal stores the LDAP server once it is set in the website.


texts: I am using drupal 7. I wanted to change the colors of the block and everything for certain pages. The ThemeKey module works fine but i have to do all the block configurations again in this. This is tedious. Since i want to change only the css any other module will solve ma problem?


texts:
I made a custom module which runs during cron via de cron_hook.
On installation of the module a database table is installed:

  $schema['license_expire'] = array(
    'description' => 'The base table for license_expire.',
    'fields' => array(
      'uid' => array(
        'description' => 'The primary identifier for a user.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
      'warned_user' => array(
        'description' => 'User warning',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
    ),
    'primary key' => array('uid'),
  );
  return $schema;

When the cron runs content is added to the database.
Say uid = 1 and warned_user = 1.

But when I try to fetch this warned_user data in de cron_hook it doesn't return any.

function hook_cron() {
//EXPIRE VARIABLES
$expiresMonth = strtotime('+1 month');
$expiresWeek = strtotime('+1 week');
$expired = strtotime('today');

//ALL USERS EXPIRING WITHIN ONE MONTH
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'commerce_license')
->propertyCondition('status', COMMERCE_LICENSE_ACTIVE)
->propertyCondition('expires', 0, '<>')
->propertyCondition('expires', $expiresMonth, '<');
$results = $query->execute();

//SEND EMAIL TO USERS
if (!empty($results['commerce_license'])) {
    $license_ids = array_keys($results['commerce_license']);

    //all licenses
    foreach($license_ids as $license_id) {

       //get Uid
       $myUid = db_select('commerce_license','cl')
         ->fields('cl', array('uid'))
         ->condition('license_id', $license_id)
         ->execute()->fetchField();

       //for testing it only works for de admin account
       if($myUid == 1){
           //get user
           $to = user_load($myUid);

           //get expiring timestamp
           $myExpire = db_select('commerce_license','cl')
             ->fields('cl', array('expires'))
             ->condition('license_id', $license_id)
             ->execute()->fetchField();

           $myDate = date("d-m-Y", $myExpire);

           //get times user is noticed
            $myMessages = db_select('license_expire','le')
            ->fields('le', array('warned_user'))
            ->condition('uid', $myUid)
            ->execute()->fetchField();

           //for some reason the $myMessages value is nothing so watchdog is "myMails = = 1"
           watchdog('license expire', 'myMails = '.$myMessages.' = '.$myUid);

           if($myMessages){do something, but it never does because it can't pull $myMessages value from the db, and it sure is there}

The above code does work when I use it in a page.tpl.php file.

I found something about, cron being a Anonymous user and this could be the problem but the solution offered didn't work for me. What dit I forget/overlook/do wrong?


texts: Custom entity validation not working (anymore)

texts:
I have a custom field validation for a field made with paragraphs which isn't working anymore (perhaps after core update but not sure). When I debug the code with a breakpoint I can see the validation being run, the violation added, but the node is still saved and no error is shown.

I have created a new validation to get the basics up and running again, trying to wrap my head around it, but with no luck. Could anyone tell me what the problem is?

Core version: 8.4.4

mymodule.module

/**
 * Implements hook_entity_bundle_field_info_alter().
 */
function mymodule_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
  if ($entity_type->id() == 'node') {
    if (!empty($fields['title'])) {
      $fields['title']->addConstraint('sdvTitleConstraint', []);
    }
  }
}

src/Plugin/Validation/Constraint/sdvTitleConstraint.php

namespace Drupal\mymodule\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * Checks the title.
 *
 * @Constraint(
 *   id = "sdvTitleConstraint",
 *   label = @Translation("Paragraphs", context = "Validation"),
 * )
 */
class sdvTitleConstraint extends Constraint {
  public $message = 'Title error';
}

src/Plugin/Validation/Constraint/sdvTitleConstraintValidator.php

namespace Drupal\mymodule\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

/**
 * Validates the title constraint.
 */
class sdvTitleConstraintValidator extends ConstraintValidator {

  /**
   * {@inheritdoc}
   */
  public function validate($items, Constraint $constraint) {
    $this->context->addViolation($constraint->message);
  }
}


texts: How do I add the content type token in the page title?

texts:
I have installed the Page Title module. What I want to achieve is to add the content type token as page title. I tried to change the pattern in the configuration of the Page Title module, but the tokens appear as they are: "[current-page:page-title], [field_glossary_transliterations] - [field_glossary_meaning] | [site:name]."

How do I do it?


texts: Publish Content in Drupal by One Editor Only

texts:
Im a new Admin for an Educational E learning Portal Developed by drupal, the current status of publishing a Content is to be verified or reviewed by two Moderators or Editors. My Question is : How to make (1) Editor publish a content after Reviewing instead of 2?

The Current flow, A "teacher" publish an Educational Content as ( needs review: , then an Editor Reviews that content and then he chooses ONE OF THE FOLLOWING: 1) initial approve 2) send back to Edit " to the teacher" 3) Publish - BUT in order to publish another Editor must review and Publish it to be available as a published content.

the used workflow is the default workbench Flow, But nothing there mentions that 2 Editors must Review,

where can i Find such a code to edit? in which module Block ?

Thank you!


texts: What can cause duplicated XML sitemap links?

texts:
I have a site where I have XML Sitemap installed.  I was using node-based sitemaps, and everything was working fine.  I also enabled the menu sub-module, and now I see duplicate links for all of my content:

What can cause this?


texts: I need to get the path for public:// at runtime. Is there a function I can use to get it?


texts: Subscriptions does not send out "update" notifications

texts:
I am logged in as user/1 and have subscribed to a particular node. I then edited the content of the node and have ticked the "Send subscriptions notifications" option.

I did not receive an "update" notification. Why might this be the case?

By the way, I've enabled the following modules:
* Subscriptions UI
* Subscriptions Mail (+ Mail Editor + Token)
* Content Subscriptions

I am logged in as user/1 and subscribed to a number of nodes. Updating them does not send email notifications.

The settings I've got turned on are as follows:

admin/config/system/subscriptions

Unlisted content types - none

Blocked content types - none

Node form position - Fieldset above node links

Node form visibility - Always display the fieldset

Expand the node form fieldset

admin/config/system/subscriptions/userdefaults

Nodify poster of own posts Send interval - As soon as possible

On updates - ticked

Send interval - Hidden

On updates - hidden

admin/config/system/subscriptions/intervals

1|As soon as possible 900|Every 15 minutes 3600|Hourly 10800|Every three hours 86400|Daily

Do I need to enable "* Taxonomy Subscriptions (e.g. forums!)" for the subscriptions to work?

Also, not sure if this is required, but I went to admin/config/system/mail-edit and added a template fornode-type-basic_page for the Subscriptions Mail module. However, this made no difference in email updates being sent :(


texts: Safe string checkup against user-supplied suffix/prefix strings

texts:
Possible Duplicate:
  Is check_plain() enough?

When authoring own plugin/formatter and giving user an option to provide their own HTML prefix and suffix strings , what would be the Drupal way of ensuring safety of those strings?
Would it suffice to filter_xss with custom list of allowed tags, or a sequence of some functions would be required?


texts: Only the word "array" gets printed when I try to render custom block in template

texts:
I am building a custom block in a module, like this:

<?php

function filterblock_block_info() {
  // Sökfilter till temperaturöversikten.
  $blocks = array();

  $blocks['filterblock-temperatur'] = array(
    'info' => t('Temperatursökfilter'),
  );

  return $blocks;
}

function filterblock_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'filterblock-temperatur':
      $block['subject'] = t('');
      $block['content'] = filterblock_block_content();
      break;
  }
  return $block;
}

function filterblock_block_content(){
    return drupal_get_form('temperaturfilter');
}

function temperaturfilter($form, &$form_state)
{
    $form = array();

    $form['alla'] = array(
        '#type'         => 'textfield',
        '#title'        => t("Alla"),
        '#weight'       => 10,
        '#required'     => false,
    );
    $form['IR'] = array(
        '#type'         => 'textfield',
        '#title'        => t("IR"),
        '#weight'       => 11,
        '#required'     => false,
    );

    $form['hightemp'] = array(
        '#type'         => 'textfield',
        '#title'        => t("> +500 °C"),
        '#weight'       => 12,
        '#required'     => false,
    );
    $form['lowtemp'] = array(
        '#type'         => 'textfield',
        '#title'        => t("< -50 °C"),
        '#weight'       => 13,
        '#required'     => false,
    );

    return $form;
}

In my template file I have this:

   <?php $block = module_invoke('filterblock', 'block_view', 'filterblock-temperatur'); ?>
   <?php  if ($block['content']) {
     $output = "
\n";
     $output .= "
".$block['content']."
\n";
     $output .= "
\n";
     print $output;

But the only thing that is rendered on the page is the word "array". I have checked with var_dump in the block module that $block['content'] actually contains the fields from the function temperaturfilter. I have tried to use print render($output) in stead of just print, but with no luck.

What am I doing wrong?


texts: How to re-order Views bulk operations for the user?

texts: How can I re-order the actions selected here? I don't want "Delete content" being the first item in the list on the actions select box for the end user.


texts: How do I create separate node/add forms for different uses and for the same content type?

texts:
I am using the agreservation module for a room reservation system/events calendar. As a result, the reservation content type has a large number of fields to accommodate info on speakers, contact info for participants, etc.

I have two uses for creating reservations: events, where more information is needed; and room reservations for maintenance issues, which require less info. However, having all of this info on one content type is essential: both uses require the room reservation and resource conflict functionality.

Restricting fields by role isn't an option as I have users who will need access to all fields; but when doing their work, both uses will be easier and quicker by having separate forms. It's more of a usability thing: people don't have to see fields they don't need for a particular use. Mainly, if someone needs to reserve a room for maintenance, the person making the reservation doesn't need to scroll through all of the fields for the event.

So, if a reservation node has fields a-j, how can I create separate node add forms so that fields a,b,c,d,e and f needed for creating registering an event are on one instance of the form and e,f,g,h,i and j are on another instance for the room reservation? There is overlap because the event involves the reservation of a room.

I thought about doing this via theming, but can a template be tied to a menu item?


texts: How do I put the user registration form on my front page?

texts:
I'm using Panels and have a panel page for my front page.  I found a discussion for Drupal 6 but the code doesn't work for Drupal 7:
http://drupal.org/node/257721

I would like to show the user registration form on the front page to make it extremely easy for new users to sign up.


texts: Reset Password Form does not let user enter their new password

texts:
An regular registered user reset a password
An email with one-time link will sent to the user
Clicking the link will lead the user to the change password form
Now, the drupal site warn the user the link has been used. The user need to get another one-time link.
Cannot enter the reset form


texts: How to I get rid of "Error with menu entry.... " in recent log messages?

texts:
I have Taxonomy used to get a menu structure by using the module Taxonomy_menu. Since a couple of weeks I get "Error with menu entry "Activity" in menu "menu-products" in my "recent log messages" when somebody visits (even myself) our homepage.

Taxonomy_menu is the type of the report.

I've already tried to "Select to rebuild the menu on submit." via /admin/structure/taxonomy/products/edit and rebuilding taxonomy Menu.

More details added:

The lines "Error with menu entry "xxx" in menu menu-products" in the "recent log messages" appears multiple times, for every time the homepage is accessed.
I have made a Taxonomy list with 8 productgroups. One of the productgroups ("xxx") appears 6 times each time, another 3 times and a third one 2 times. The other 5 productgroups do not appear in the recent log message so seems to be working ok.

I've also noticed that the sequence of the 11 lines of error messages are exactly the same every time. Also strange that the productgroup that is referenced twice, is not directly repeated but appears later again in the logging.

I have an (almost exact) test version of the same website which doesn't show these message which lead me to the conclusion that this error message is caused by some kind of setting mistake for these 3 productgroups. However I have no idea where to change this so that these messages will be gone nor an idea why the number of times the message appears differs for 3 of them?

So far the website users are not be bothered by this message, but I like to get rid of it, as it fills my log messages very rapidly.

Can somebody please give me some directions?


texts: Custom field in XML with Views RSS module

texts:
I need to create an XML using Views RSS module, and it's created correctly. But I want to add a custom field to the XML. For example, an item from the XML is:

<item>
<title>Liburu bat</title>
 <link>http://whatever.com/comercios/productos/1022/botak</link>
 <description>Produktu bat</description>
 <category>Forros para botas %% Espuelas %% Calzado</category>
 <guid isPermaLink="false">1022</guid>
 <source url="http://whatever.com/es/comercios/productos/whatever.xml">Escaparate Whatever</source>
</item>

And I want to add a custom field to that item, for example:
Something else

Any idea how can I do it?


texts: Prepopulate CCK ImageField with existing images

texts:
I have two types of node:

Building, with a CCK imagefield
Apartment, which has a node reference field to a Building node, where one building has many apartments

My goal is to to grab the images from the Building node being referenced. Is there a way to reuse the images uploaded on the Building node and use that on Apartments node?


texts:
This describes way to include another version of JQuery file:

scripts[] = [...]
scripts[] = scripts/jquery-132.js
scripts[] = scripts/jquery.foo.js
scripts[] = scripts/jquery-noconflict.js

Then how to include Google JQuery CDN?


texts: How to get the content type in the zone/region tpl files?

texts: How would I get the node type from within a zone/region or section (using omega theme) template file.  I know how to override templates at the page/node level for specific content types - but I can't seem to find a variable or anything that points to what type of single, node page content type is currently being displayed.


texts: Do I need to run Captcha and Mollom simultaneously?

texts:
Just wondering if I have Mollom installed and running successfully on a D7 site, if I still need to keep Captcha enabled?

I'm getting double captcha forms with both enabled.


texts: do the sum of two commerce_price field with programming api

texts:
I want to do the sum of two commerce_price fields and set the result in another one.

i've tried to just add the related ['amount'] values and set the result into another price field but it looses the components (VAT, taxes...).

Is there a commerce api call to do that ?
Such as :

add_price($price1,$price2)

returning the full added price with all it's component ?

Thx


texts: How to add class to all forms automatically?

texts: I want to add .form class to all Drupal forms.  How can I add class to all forms by overriding theme function?


texts: Creating a Rule condition that evaluates a field an entity that is referenced by a created node

texts:
I'm trying to create a rule for new node content that is based on entity references.

To give some background I have story pages and chapter pages. The story pages are story meta data, the chapters are real content. The chapters reference the story pages and are sorted by chapter numbers set by the users.

I want to create a rule for when a new chapter is published. But it needs to be able to evaluate a field on the Story the chapter is a part of. How do I get rules to go to that story entity in question and check the value of the fields in question?


texts: How is password hashing/encryption performed?

texts:
I am fielding a question for a project that is asking if we use Blowfish crypt in Drupal, or, if we could.

The class that performs password hashing in 8 is PhpassHashedPassword, based on https://www.openwall.com/phpass/. On that site, it states:

  At this time, if your new project can afford to require PHP 5.5+,
  which it should, please use PHP's native password_hash() /
  password_verify() API instead of phpass. This new API also happens to
  support the CRYPT_BLOWFISH and CRYPT_EXT_DES hashes used by phpass,
  but unfortunately it does not support the phpass portable hashes
  (which are portable across all versions of PHP as long as you use
  phpass).

It goes on to state:

  The preferred (most secure) hashing method supported by phpass is the
  OpenBSD-style Blowfish-based bcrypt, also supported with our public
  domain crypt_blowfish package (for C applications), and known in PHP
  as CRYPT_BLOWFISH, with a fallback to MD5-based salted and variable
  iteration count password hashes implemented in phpass itself (also
  referred to as portable hashes). (phpass versions up to 0.4 also
  included an intermediary fallback to BSDI-style extended DES-based
  hashes, known in PHP as CRYPT_EXT_DES, but this has since been dropped
  except for authenticating against pre-existing hashes of this type.)

When reviewing the class in Drupal 8, it does not make use of password_hash, or password_verify. It also appears to use sha512 as the algo. I can't find anywhere if bcrypt or Blowfish or CRYPT_BLOWFISH is used.

I did find this issue regarding supporting Blowfish style passwords but not one for creating them. I assume if I wanted to import their current userbase with Blowfish style passwords, I would need this patch.

Would it be difficult to implement my own class to do this that uses Blowfish? Are there any implications in Drupal of doing this? Why did version 8 opt to stick go with SHA-512? This project will be on PHP 7.2, so I don't care about PHP 5.x BC/reasons/etc.

Potentially related: https://stackoverflow.com/questions/16014282/why-crypt-blowfish-in-php-is-considered-better-when-it-produces-shorter-hashes


texts: Should QA engineers directly update Drupal database tables via SQL?

texts:
Is it generally accepted that it's ok in the Drupal community for QA testers to directly update and delete data in Drupal core tables via SQL? Or is it considered a bad practice? I'm talking about non-production environments--Production is definitely a no-no.

We are fortunate enough to have dedicated Quality Assurance engineers. I'm a developer and am very cautious about writing SQL update and delete statements on our Drupal tables (again, non-production). We usually script things in drush or use Drupal's API.

I think our QA engineers are great, but it seems like a very risky venture to directly update and delete data in core Drupal tables with SQL, even in non-Prod. I would think using tools such as Selenium or scripted solutions that use an API would be preferred, as long as they provide the same functionality.

Your input would be greatly appreciated. Any links with guidelines on this topic would be extremely helpful too.


texts: Delay in logging Drupal user through Services

texts:
I have two Drupal7 sites. I am using a service that allows a registered user to login using session authentication.

On the site that performs the call to my remote service I measured the time when I enter the login function and after I got my session id response. It is 6 seconds apart.

When I use the browser to login it works as normal, no delays.
Both Drupal7 instances are running on localhost.

I need some pointers as to where to look in order to reduce this latency.

watchdog("LOG", "Login function hit at " . date(DATE_RFC2822));
$resource = 'access/';

$this->options = array(
  'headers' => array(
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
  ),
  'method' => 'POST',
  'data' => json_encode(array(
    'username' => $this->username,
    'password' => $this->password,
  )),
);

$response = drupal_http_request($this->base_url . $resource . 'user/login', $this->options);
$data = json_decode($response->data);

// Check response code
if ($response->code == 200 && $data != null) {
  $this->options['headers']['Cookie'] = $data->session_name . '=' . $data->sessid;
  watchdog("LOG", "Connected to remote at " . date(DATE_RFC2822));
}

I wrote a basic php login function to run it from outside a Drupal install and the time to login is 5 seconds. Measured the web login and it's instant. I also switched from Services Resource API 1.0 to 1.1 with no improvements.


texts:
Long story short, is there a correct way to override DRUPAL_MAXIMUM_TEMP_FILE_AGE?
I'm working on testing a fix to a module I wrote a while back that handles some uploaded files. I neglected to call file_usage_delete and set file_managed status to 0. To test my changes more quickly, I'd like to schedule files for deletion after doing some operations on them. To do this reasonably I had to reduce the turn around time on deletions to something on the order of minutes than hours. I went ahead and edited system.module where DRUPAL_MAXIMUM_TEMP_FILE_AGE is defined as 6 hours, but the comments immediately preceding the defines indicate:

@file
Configuration system that lets administrators modify the workings of the site.

I checked the places where this value is used, and it doesn't look to be actually configurable besides editing system.module directly. Maybe I'm missing something?
Is there a correct way to set this that doesn't involve "hacking core"?


texts: Custom block assigned to new region invalid

texts:
I had created a new region to my theme "buynow" and my theme.info contains the following line

regions[buynow] = Buynow

In my custom module i had created a custom block in which i assigned the block to the region buynow

function buynow_block_info() {
  $blocks = array();
  $blocks['buynow'] = array(
    'info' => t('Shoretel Buynow'),
    'status' => 1,
    'region' => 'buynow',
  );
  return $blocks;
}

When i try to enable the module, Iam getting The block was assigned to the invalid region and the block was disabled

How can i set my block to the new region.


texts: Creating secondary menus, that are different based on the page being viewed

texts:
I'm new to Drupal development so bear with me.  I'm attempting to copy a production site that has used old school page controller organization into a newly setup Drupal 7 install.  I've set up the header, sidebar, and footer all of which will always be the same so I've created them as blocks.

The content within those blocks is categorized into 5 categories and each one uses a slightly different layout at the top and bottom.  What is the best way of handling this situation?

Create multiple additional blocks and make sure to assign the appropriate pages to those blocks, or set up a template of sorts that can tell what blocks need to be displayed based on the category of the content.


texts:
I have a site with 2 languages: English and Spanish and Path prefix: en and es respectively. Then Spanish language is set to default (see image 1)

And the Language negotiation is set to: Path prefix with language fallback  (see image 2)

Everything works as expected but there is one problem: when the site is loaded it takes the English as default language. Then if I change language (with the Language Switcher) everything works fine.

To be clear, it the url is:

www.mysite.com (landing page is loaded in english) I need this to be in spanish

www.mysite.com/en/home (landing page is loaded in english)

www.mysite.com/es/home (landing page is loaded in spanish)

I can't fix this..Any help please?


texts:
This seemed easy at first but I'm losing my hair on this.

I simply want to add a custom view handler that uses no table.

I tried to do as views php proposed, $data['views']['mycustomfield'] in hook_views_data, but still, "mycustomfield colum not found".

Any help ? Thanks !


texts: Attaching libraries to specific controllers

texts:
I want to include the google charts js library to a specific (or set of) controller(s).  In my library file, gcharts.libraries.yml, I have the following:

google_charts:
  remote: https://developers.google.com/chart
  version: current
  license:
    name: apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0
    gpl-compatible: true
  js:
    https://www.gstatic.com/charts/loader.js: { type: external, minified: true }
  dependencies:
    - core/jquery

Which, unless I copied something incorrectly, should be correct.

Question 1: is the dependencies tag allowed here?  The documentation isn't expressly clear on that.

My controller (GoogleChartsController) correctly instantiates and looks like:

<?php
array(
  '#theme' => 'custom_theme',
  '#attached' =>
    array(
      'library' =>
        array('company/google_charts')
    ),
  // For testing purposes
  '#cache' => array(
    'max_age' => 0,
  )
);
?>

However, when I look through the source I don't see the library that I told my controller has a dependency for.  My library never loads.

Question 2: Do I have have to use the hook_page_attachement or the hook_preprocess_page hooks?  If so, how do I limit it to use just my set of controllers I want (I don't need or want this loading on every page)?  Can I get the path, check to see that it is what I want and then add it conditionally, like so?  Or is there some other way?

My custom-theme.html.twig looks like:

Are we here?

The documentation isn't crystal clear as to when and where to include inline js.  From the google charts api, I'm to include something like:

Now, my intuition is that I can actually abstract each of the charts I want into their own "library" and add the dependency, because of the way I designed things, this will be fairly trivial.  But I'm not certain if this is the best way to do it.  But I've read that you can dump inline js into twig files; but I'm not 100% certain this applies here...

Question 3: Is adding the js into twig best practices or is libraries the way to go?  Assuming libraries, can I include several libraries into one library file and just include the one(s) that I want/need?  So I would have one library for customized_charts.libraries.yml and in there there would be declarations for pie_chart, bar_chart, etc.  And then I would load module/bar_chart when I wanted to display bar charts, etc?


texts:
I am using the Feeds Import module as described in Drupal as an interface for users to Add/Edit/Search a database.

When we import, we get the following error:

  Missing bundle property on entity of type taxonomy_term

Why does that error message appear?


texts:
I am using the Drupal 7 version of the Group module. I found this Drupal 8 code which adds a user to a group, and I can't find anything similar for Drupal 7.

use Drupal\Core\Entity\ContentEntityBase;
$account = \Drupal\user\Entity\User::load('uid');
$group = \Drupal\group\Entity\Group::load($group_id);
$group->addMember($account);
$group->save();

What is the equivalent Drupal 7 code?

I tried using the following code, but it throws an error.

<?php
$account = user_load($uid);
$group = entity_load_single('group', 1);
$group->addMember($account);
$group->save();
?>

The error is the following one.

  Object of class stdClass could not be converted to int in Group->addMember()


texts:
Is there a way to pull a CiviCRM report that compiles all donations from matching addresses?

Whether or not the people at the matching addresses are formally part of a household -- kind of like the mailing option that merges matching addresses for a mailing export to prevent double mailings.


texts:
Each time cron runs automatically, Feeds import skips half the new feeds and 2 out of 4 feed importers gets always stuck. E.g.:

Solves by Unlocking, but I can't keep clicking Unlock after each cron everyday. Also, max feed count is 500 overall.

4 feeds using XPath XML parser to import feeds from 4 xml pages from one Drupal site. Those two that get stuck, has per 200 feeds each, the other 2 are fine, they are like 10 feeds max. Also after Unlocking the stuck import, it shows it 'imported' ~200 feeds for example, but actually it didn't, because they don't exist in Content list. Also, all these 200 are already imported manually from before, so why would it try to reimport feeds that exist and get stuck? Also I am using Title as Unique to protect from duplicates.

Importing feeds manually each per feed importer works perfect, but hourly cron runs are not.

Skip Hash Check unchecked.

Dblog:

  Notice: Undefined index: start_time in FeedsSource->import() (line 369 of sites/all/modules/feeds/includes/FeedsSource.inc)


texts: Drupal commerce order list view - payment status

texts:
Is it somehow possible to add payment status and payment method to ordes list view?
I tried to use relationship inside orders list view but the commerce payment transaction is not available.
Thank you for help.


texts: How do I add a dynamic Facebook like button to every node of a certain content type

texts:
One very comfortable solution to that problem is provided by http://drupal.org/project/fblikebutton. Unfortunately the positioning of the button isn't flexible enough for my needs.

I want every single node of one certain content type to have a FB like button at its bottom, making the base+node-url like-able. Facebook provides some snippets for that. Since I know that loading many iframes makes the site load very slow, I'ld like to add the JavaScript snippet into the appropriate template file.

My questions now are, in what template file exactly would I inject the little snippets and how do I have to customise the url in the plugin to make it fetch the url of every single node dynamically?


texts: “Structure->Block” showing when permission is not given to user

texts:
I have user role 'Admin', who can see 'taxonomy terms' under 'Structure', I have given same permission but it is showing 'Block' and 'Views' too.

Is there any workaround in Drupal 8?

Any help would be great. Thanks


texts: Sort Filter updates both block and page within single view

texts: I had this working, but can't seem to figure out what I did. I have a view that contains a block and a page. I have embedded the block into the page and exposed sort criteria on both. I want to be able to sort either the block by clicking on the title and have it update the block table and the page or click the sort criteria drop down on the page to update the block table and the page. How do I do this?


texts:
Is there a method to catch all the redirections on my site that contains an certain path on drupal level? I want to change the domain of those to an external URL.

For example when there is animal in the path it should link to an external URL: www.example.com/animal?small=frog => www.example2.com/animal?small=frog.


texts: 502 Bad Gateway nginx for a drupal sub-directory site install

texts:
I have a default drupal 8 site install and a sub directory site install. The second Drupal site was an after thought and had to be hosted on the default site url in a sub folder. both sites share the same database with the second site having a prefix for its tables.

The issue i am experiencing with the second site, the landing page works perfectly but any other page gives an issue, oddly enough when i view on incognito the other pages work but when i refresh i get the 502 Bad Gateway error.

folder structure is as follows

htdocs
 - core
 - libraries
 - modules
 - node_modules
 - profiles
 - sites
 - themes (custom default theme here)
 - vendor
 - site2 (where i installed the second site with its own custom theme)
 - default drupal files (index.php, .htaccess ....)

I didn't change anything in both .htaccess files, i also tried in site2 .htaccess uncommented and updated the RewriteBase /site2 but still get the 502.

If someone could point me to the right direction regarding this issue, i have googled and tried numerous changes to the .htaccess files.


texts: Is it possible to alter nodes on export with Node Export

texts:
I want to write my own module which changes a few things upon exporting of nodes with Node Export.
I saw that there are some API's. But I haven't seen any working examples. Is there some documentation on the API of Node Export? And if not can someone provide me with some examples of changing data for export and changing it again upon import?

Thanks,
Jaap


texts: How do you update a data blob column by searching and replacing a string using drush?

texts: How would one do the following in drush? I want to change some data in one of the users table for one of my users. The thing I want to change is in the data blob column with all the punctuation's and what not. I can copy the data blob out, edit, it and then paste it back in, but was wondering how can this be done via drush with a search and replace?


texts: How to use % arguments in Easy Breadcrumbs "Paths to replace with custom breadcrumbs"

texts:
I am trying to give a more logical breadcrumb flow to the Drupal Commerce 2 checkout path, as Commerce doesn't support breadcrumbs in the checkout process.

When not displaying the current page in Easy Breadcrumb, Drupal Commerce 2 by default it gives you a trail like this Home > Checkout after progressing from the /Cart page to the /Checkout page. This redundantly brings you back to the checkout page that you are already on.

The logical flow here when excluding your current page from the crumb, should be Home > Cart when you have proceeded to the /Checkout page from the /Cart page.

This Breadcrumb can be easily set in easy breadcrumbs Paths to replace with custom breadcrumbs as seen in the picture:

But the problem is that the order number is placed in the URL, so you would need to replace the actual order number (5 in this example) with % argument something like /checkout/%/order_information :: Cart|/cart

Is it possible to somehow accept % arguments in the URL's in "Paths to replace custom breadcrumbs"?


texts: Is there any way I can get back the default Glossary View which I deleted by mistake?


texts: What would be the parameters for a services to receive a JSON file?

texts:
This might be sound like a very foolish question ...

I want to expose a service to receive a JSON file from client side in GET or POST format through which I can send an email. What should be my initial algorithm?

I know I need to implement hook_services_resources() to create a resource for the services.

But I don't get what would be its parameters and what would be there in resource api [].


texts: Feeds XPath parser - how to map to complex content types (eg to field collection field)

texts:
I've managed to import nodes of content using the XPath imporer, but where there are deeper levels of data structures, there seems to be no way to map data to a node.

I would have liked to have created these content types using the Field Collection module,
but there's no support for that.


texts: How do i assign profile2 (user) to a organic group?

texts:
Hello i am currently using a called Module Profile 2 to enable users to register and create profiles.

Also i want users to be able to create and join groups for which i am using organic groups.

But i have encountered a minor problem ....the request group membership is working for me but it only assigns the group in default user page not to the "Main profile" created using profile2.

Any solutions ?

Also i did find out this solution which schnippy answered but being new learner to drupal and this web devlopment stuff am completely lost....is it the solution and if yes then how do i implement it ?

Thank you


texts: different "no content" message based on taxonomy vocabulary/term

texts:
how would I change the message:
"There is currently no content classified with this term"
when viewing a term that doesn't have conent asscociated with it?

I see the message is in taxonomy.pages.inc and that I could just edit that line, but that would change it for ALL terms, whereas I'd like to have a custom message based on the taxonomy vocabulary.

Lets' say I have vocabularies:
"countries" message > Sorry no event listed in [country-name]
"sports" message > Sorry no games of [sport-name]

Please keep in mind I am not a coder.

Thank you


texts: Disable query cache for SQL call inside a PHP Basic Page node (Drupal 8)

texts:
I have a Basic Page node whose body is using the PHP filter. On this page I am running the following PHP code to execute a SQL call against the website's database:

function get_latest_item_kid() {
    return db_query("SELECT kid FROM {table_name} ORDER BY title DESC")->fetchField();
}

What this should do is return the latest item's kid when the page loads. If more items get added, when the page refreshes this query will be run again and should return the newest item's kid.

This works the first time you load the page. However, no matter how many items are added, when you refresh the page the result of that query never changes. The only way to get this to update is by clearing the cache.

I have tried several techniques to disable various kinds of caching (assuming that's what my problem is), from clearing the page cache programmatically (didn't help) to adding SQL_NO_CACHE to the query (which caused the page not to load).

I'm using Drupal 8.

Any ideas?


texts:
I'm using Storm for a bunch of its varying functionality, and figure it thus makes sense to use its Invoice module as the final part of a multi-part project (see previous SO post).

Everything in Storm Invoice seems like it needs to be entered on the fly, all the time. What I need to have happen is for a computed field from another node or a view to provide a price to the Invoice module, autopopulating some fields. Is this at all possible with Storm Invoice?

Addendum: If Storm isn't the best way to create dynamically-generated invoices from node CCK fields, please suggest an alternative.


texts: Custom user_register_form for Auto Assign Role registration pages

texts:
I'm using a function[a] to get custom templates to work for all pages, including role registration pages set by Auto Assign Role. By setting the role registration path to user/register/<rolename> I'm able to use page--user--register--rolename.tpl.php to make custom pages.

What I'm trying to do now is use a custom user_register_form for each role registration page. Using this function[b] I'm able to use user-register-form.tpl.php to customize the registration form. This affects the form for both role pages though. I tried using the Field Permissions module, but because an anonymous user will be using both forms it's of no use here.

I'm thinking I need to change what user-register-form template the page itself is looking for, but I can't figure out how to do that.

a.

function THEMENAME_preprocess_page(&$vars) {

  if (isset($vars['node'])) {

    $suggests = &$vars['theme_hook_suggestions'];

    $args = arg();
    // Remove first argument of "node".
    unset($args[0]);

    $type = "page__type_{$vars['node']->type}";

    $suggests = array_merge(
      $suggests,
      array($type),
      theme_get_suggestions($args, $type)
    );
  }
}

b.

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

  $items['user_login'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'THEMENAME') . '/templates',
    'template' => 'user-login',
    'preprocess functions' => array(
       'THEMENAME_preprocess_user_login'
    ),
  );
  $items['user_register_form'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'THEMENAME') . '/templates',
    'template' => 'user-register-form',
    'preprocess functions' => array(
      'THEMENAME_preprocess_user_register_form'
    ),
  );
  $items['user_pass'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'THEMENAME') . '/templates',
    'template' => 'user-pass',
    'preprocess functions' => array(
      'THEMENAME_preprocess_user_pass'
    ),
  );
  return $items;
}


texts: Why is the Edit View link not appearing in Panels?

texts: I've got a Views block display placed inside a Panels pane.  It works well, and I wanted to add two similar blocks, so I cloned the View and changed the necessary settings. The original block has the cogwheel "Edit View" contextual link, but the clones do not. Any ideas? I can still go to Structure -> Views -> name to edit, but it's much easier to use the contextual link. If anyone knows why it isn't appearing and how to get it back, I'd appreciate it!


texts: how to alter only one set of specific forms?

texts:
Consider I have 3 content type. The problem is that if I use form alter in a module , when I use:

drupal_set_message(t($form_id), 'status', FALSE);

in the mentioned hook, it shows me different set of form-IDs as message on showing each node add/edit form.

For example if I go to node type A add/edit form, drupal_set_message shows:

A_node_form

if I go to node type B add/edit form, drupal_set_message shows:

A_node_form
B_node_form

if I go to node type C add/edit form, drupal_set_message shows:

A_node_form
B_node_form
C_node_form

Showing them means that I can not really make an specific effect for each content type add/edit form by form_alter.

Note: I use OG module and B and C are the content types and A is the group type.

How should I solve it?


texts: Limiting input on node title and plain text area fields

texts: Is there a way to add a character limit on node title and plain textarea fields in Drupal 8? I don't want to use the Title module.


texts: Views field override and use it in Global: Custom Text

texts:
In Drupal8, I have created a view of content and add a relationship of the user account field which is referenced entity of the content.
So, Basically I have one content type and in the account fields I have added one content referenced field, there user can select multiple values.
Now in the view I am showing the content and using the Global custom field I am overriding the output of the view.
In the field of referenced entity under view I am getting multiple values like 1,2,3,4,5 and I want something like if node id is present inside this multiple values then I want to display some text.
Can anybody let me know how can I achieve this?
I have tried something like below under Global: custom text field but it did not worked.
{% if nid in field_ref_content %}

Lorem Ipsum

{% endif %}

I have tried to override the twig as well for that field and able to achieve the things what I want to show like some custom text, but that only rendered when we are using that field in view.
when I used that field's replacement pattern inside that Global: custom text, that is returning only the default value which is 1,2,3,4,5 not the one which I have override using the view field override hook
Hook_preprocess_views_view_field

Can someone please guide me, I spend so much time for this but no luck.
Thanks in advance.