texts: Adding gmap markers programmatically with a module

texts:
I've been researching how to add markers to a drupal 7 gmap for more hours than I feel comfortable admitting. The reason I have to do it through a module and not views is because of client specifications that I won't go into here. The code below is what I have so far, everything I've found seems to point in this direction and it looks right to me. But when I go to the page, no markers show on the map. Can anyone help me out here?

function rrs_custom_menu() {
$items = array();
$items['search-by-towns'] = array(
    'title' => 'Search by Towns',
    'page callback' => 'search_by_towns',
    'access arguments'  => array('access content'),
    'type'  => MENU_CALLBACK,
);

return $items;
}
function search_by_towns() {
$query = "SELECT node.title AS node_title, location.lid AS location_lid, location.latitude AS gmap_lat, location.longitude AS gmap_lon, location.name as loc_name, location.street, location.city, location.province, location.postal_code, gmap_taxonomy_node.marker AS gmap_node_marker, taxonomy_term_data.tid AS tid, taxonomy_term_data.vid AS vid, gmap_taxonomy_term.marker AS marker
    FROM
    {node} node
    LEFT JOIN {location_instance} location_instance ON node.vid = location_instance.vid
    LEFT JOIN {location} location ON location_instance.lid = location.lid
    LEFT JOIN {gmap_taxonomy_node} gmap_taxonomy_node ON node.vid = gmap_taxonomy_node.vid
    INNER JOIN {taxonomy_index} taxonomy_index ON node.nid = taxonomy_index.nid
    INNER JOIN {taxonomy_term_data} taxonomy_term_data ON taxonomy_index.tid = taxonomy_term_data.tid
    LEFT JOIN {gmap_taxonomy_term} gmap_taxonomy_term ON taxonomy_term_data.tid = gmap_taxonomy_term.tid
    WHERE (( (node.status = '1') AND (node.type IN  ('listing', 'town')) AND (taxonomy_term_data.vid = '3') ))
    ORDER BY tid desc";

    $result = db_query($query);
    $marker = array();

    foreach ($result as $res) {
        $text = '

 '.$res->loc_name.'
 '.$res->street.'
 '.$res->city.', '.$res->province.' '.$res->postal_code.'

See map: gmap_lat.'+'.$res->gmap_lon.'">Google Maps

';

        $marker[] = array(
            'latitude' => $res->gmap_lat,
            'longitude' => $res->gmap_lon,
            'markername' => $res->marker,
            'offset' => 0,
            'text' => $text,
            'opts' => array(
                'title' => '',
                'highlight' => 0,
                'highlightcolor' => '#FF0000'
            )
        );
    }

    $map_array = array(
        'id' => "auto1map",         // id attribute for the map
        'width' => "685px",        // map width in pixels or %
        'height' => "480px",      // map height in pixels
        'latitude' => '36.10237644873644',    // map center latitude
        'longitude' => '-80.8758544921875',  // map center longitude
        'zoom' => 8,              // zoom level
        'maptype' => "Map",       // baselayer type
        'controltype' => "Small"  // size of map controls
    );
    $map_array['markers'] = $marker;

  $output = theme('gmap', array(
      'element' => array(
        '#type' => 'gmap',
          '#gmap_settings' => $map_array,
          '#input'  => FALSE,
          '#theme'  => 'gmap',
          '#children'   => '',
          )
        )
    );

return $output;
}


texts: Show available languages in content-view

texts:
in older-drupal-versions when content was translated to different languages, it was possible to indicate in which other languages that content is available and in which not.

Let's say I have en, de and fr as languages. Foo is translated to en and de and bar is translated to fr only.

In my contents index (/admin/content) I want to display that linked info as:

fooen, de, fr
baren, de, fr

Where clicking a non-striked text leads to the edit of the particular node and clicking the striked one will start a translation.

Is that, or something which gets close, possible in D8?


texts: How to set template of boolean field if value is 0 in node display

texts:
I have a custom template file for a boolean field with a checkbox within a content type. The checkbox values are ON for true and OFF for false. It works perfectly if the checkbox is checked. But if the checkbox is not checked the template will be ignored and the value OFF will be rendered plain into the node.
How to get it to render the output with template or simply remove the output at all if checkbox is not checked?


texts: how to implement hook_menu so that it recognizes URL like ?q=myterm, as sent by jQuery autocomplete?

texts:
The jQuery UI autocomplete source string expects the search string to be appended to the URL
as mysite/auto/?q=myterm
(see jquery autocomplete doc)

I have written a module that implements hook_menu and it returns the matching records through JSON.
The expected url is mysite/auto/myterm

How should the hook_menu be written so that it recognizes the ?q=myterm

I am using Drupal 7 and have Clean URL

Edit: can you explain with an example or use this code:
can you help with an example?

  url localhost/myauto/?q=sometext

mymodule_menu(){
$items['myauto/%'] = array(
    'title'= 'My example',
    'page callback' => 'myexample_auto',
    'page argument' => array('1'),
    'access callback' => TRUE,
 );

myexample_auto($arg){
...//user $_GET['q'] or drupal_get_query_parameters to get 'sometext' from $arg
}


texts: Get Username from UID with Preprocess for Template

texts:
I'm a bit lost at finding the username based on the uid. I get the uid from the address using:

  $current_path = \Drupal::service('path.current')->getPath();
  $urluid = (explode("/",$current_path));

  $us = \Drupal::entityTypeManager()->getStorage('user')
  ->loadByProperties(['uid' => $urluid[2]]);

  kint($us);

returns an array of data where i do see the uid, but not the username for that uid. Name:

'name' => array(1)
*DEPTH TOO GREAT*

returns NULL:

kint($us->name);

I'd like to return the UID->Name as the title on the ROLES and EDIT screens for the user. Exactly how it is returned for VIEW (example dvweb is: /user/10):

EDIT:::

Was able to get it with:

  $u = Drupal\user\Entity\User::load($urluid[2]);
    kint($u->getUsername());


texts:
I would like to add a coutner to comments, so when I view a node I've something like:

Comment #1 - Text
Comment #2 - Text
Comment #3 - Text

and so on..

Is there a way to obtain this?
Obviously #1, #2 and #3 are number relative to every singole node.

Thanks!


texts: How to render multiple teaser and one full view mode (of the active teaser) on the same page?

texts:
I'm trying to do the following:

Show the teasers off all the posts (content type: application_formulier) in a horizontal scroll, this works using the "simplyscroll module and is already finished (black part of the img.)
Show the full view mode of the selected teaser (clicked the read more link) belowe the teasers (red part of the picture). (This is what i can't get to work. What is shown on the img is just to explain my goal.)
When clikking on the "read more" link to show the full view mode you need to stay on the same page, not go to the nodes personal page.

The second bullet is what i need to make but i have no idee on how to do this.

Could somebady plz point me in the right direction on how to do this?

What i want:


texts:
I have views - catalog with products and I have exposed filter attached (for filtering by brands). All is ok when you don't use this filter however, you can add product to cart). When I use filter and Ajax loads products for certain brand, however, add to cart form breaks.

The example you can see here http://zoo812.ru/catalog/79

What can be done about it? I'm using Commerce.


texts:
When defining custom content entities one can use EntityListBuilder to build a list of those entities for administrative purpose.

By default such entities are ordered by ID, however it is possible to change ordering by overriding EntityListBuilder::getEntityIds(). Nevertheless this is only ordering of the items. But how to make that table sortable (by clicking on column header to sort ascending and descending)?


texts:
I'm looking for the best way to use media queries within a drupal theme (based on Zen 5)

The options I've found are :

Defining media queries in the info file eg :

stylesheets[all][] = styles/base.css
stylesheets[all and (min-width: 480px)][] = styles/480up.css
stylesheets[all and (min-width: 720px)][] = styles/720up.css
stylesheets[all and (min-width: 960px)][] = styles/960up.css

Include all the css file and wrap all definitions within the media queries in the files
Use base.css and use media queries at the end of this file to import others stylesheets.

Of theses three options, which is the lightest? Is there a fourth one?


texts: Append query parameter to module's javascript based on custom field on page

texts:
I am new to Drupal development.

I am currently working on maintaining a Drupal module that was developed by a past colleague.

What I want to do is have an available field where a user can enter in an integer which corresponds to a JS query parameter that will be added to one of the module's script upon page load.

I am wondering if it is possible to add a custom field type that users can add through the Drupal UI to their content (nodes), and then check for the existence of this field and append it to the script?

I have found this tutorial helpful in adding custom fields through my module. However, it doesn't provide any links to documentation that specifies what values I can/should put on dependencies, module, along with other parameters. Also after quite a bit of Google searching, and a bit of combing through Drupal docs, I ended up with nothing.

Further, I believe that I am more or less on the right track in using the hook_page_attachments_alter function to check against fields and conditionally load JS scripts. Although, I don't believe that the $page array passed through this hook supplies node fields.

Currently the module is loading the custom JS like so:

  function my_module_page_attachments_alter(&$page) {

    $page['#attached']['library'][] = 'my_module/script';

  }

Obviously it is loading it through libraries, which would make appending a custom query string parameter difficult. Maybe there is a better way?


texts: Override autocomplete provided by module to not suggest current user(self)

texts:
I hope it's pretty clear from my question title itself. I want to override autocomplete provided by module such as privatemessage to not suggest the current user(self) who is trying to send message.
I tried doing some research about it but all I got was about overriding JS file.

I have used automcomplete with my custom form long ago & when I prepared the JSON, I removed current user from the list. But what to do if I have to do the same for some contributed module ?


texts: How do I let my users create organic groups?

texts:
[n00b apologies] I have installed Organic Groups but am apparently too dumb to understand it.

How do I let me users create and administer their own groups? What do I need to do on the admin pages, and how do I add something on the main page to let them administer & join groups.

Sorry if this sounds dumb

Update: if they can't, and I have to - how do I add a "groups" item to the man menu and a sub-menu for each group?


texts:
I am using the Charts module and Google Charts API with Views. I want my view to display with the last page of the view showing on page load. How can this be accomplished? For more explanation of what I'm trying to do: I have a view displaying a line chart with historical data, but I want the view to load with the most recent data first and the pager to allow the user to go back (using previous button) to view data in the past.

Thanks in advance.


texts: how to change alphabetic order to descending order in drupal 7

texts: I have a accordion menu in left side and the menu list come as alphabet order but i want newest come first. how can i change the sorting of that list.


texts: How do I add an AJAX action on a select element in a ContentEntityForm to change the value of another select element

texts:
I have a ContentEntityForm with two select elements category and data_type. I want to load the options for the second select element when the first select element changes. I have tried to add the following in the buildForm function of the ContentEntity form but this does not seem to be adding the ajax trigger to the element. Any thoughts on what I am doing wrong?

$form['category']['#ajax'] = [
  'callback' => '_ajax_form_category_change',
  'event' => 'change',
  'wrapper' => 'ajax_id_data_type',
  'method' => 'replace',
];
$form['data_type']['#prefix'] = '
';
$form['data_type']['#suffix'] = '
';

_ajax_form_category_change is a function in my module

function _ajax_form_category_change($form, $form_state) {
  return $form['data_type'];
}

I have also added a form_alter in my module to change the options of $form['filing_type'].


texts:
I have a block which has the contextual filter to taxonomy id.
I created a panel page which includes that block and I passed an argument some term (eg. 1234). Now in view more of that block it is displaying url as http://mysite.com/myviews/1234. I was expecting only http://mysite.com/myviews. I have 'Send Arguments' option unchecked. Not sure it it is possible to get rid of argument. Please suggest how to hide argument if possible.

Thank you


texts: Check if form field contains particular value, if so, do not allow user save

texts:
I am having a lot of spam signups on a drupal site. I am even using captcha and mollum, but still getting a lot. I have a field that asks 'why are you signing up?' which, when a human user / non-signup signs up, is filled with proper information, however, it seems there are a lot of robots / fake sign ups that all fill the field with a value which is just the literal path to the node field value like why_are_you_Signing_up[und][0][value]. It is always the same. So I thought I could check for this value and cancel the sign up.
I have looked at hook_user_presave and hook_save. These look like good starting points.


texts:
I want to have the same style of block for similar content type but the matter should be different.

For instance, I have a content type of hotel which has different fields in it and I have created a view for list of hotels. Now what I want to do is display the information of of some field from hotel(say Brochure as pdf) as a block when that particular hotel info is requested, rest as content itself.

I know one way of doing it is creating a custom block and restricting it to particular url. But it is too hectic. Is there a simple way of connecting the field from content to the block to that particular content display?

Personal observation: I have tried to place the block(say sidebar first) of content type in "block layouts". Though it shows up, no luck in placing it.


texts: What is the proper way to create a custom user field programatically?

texts:
I'm currently working a custom user registration module for a project I'm busy with. I need to add a boolean field which will be attached to user entities. The value will just serve as a flag to check whether a user has answered a CAPTCHA question as a final step of registration. I've been trying to define a boolean field which should have no widget selection dropdown or edit / delete operations within the "Manage fields" section for users.

It seems that the best way to define the field would be during hook_enable or hook_field_schema (inside your .install file), but I'm confused as to what the best practise is.

Also, is there anyway to give the database table a better name when defining your field? I find the table prefix for fields "field_data_xx" pretty confusing if you're defining numerous custom fields.

Thanks in advance :)


texts: How to create a view that filters profiles based on current user's 'interested in' field value?

texts:
I am working on a small matrimonial application. I've installed the Profile 2 module and added a few fields like 'interested_in', 'gender', 'partner preference', etc to the users of my site.

I need to create a view that will list all profiles with same gender as logged in user's 'interested in' field.

How can this be achieved?


texts: Saving 1 vocabulary deletes all terms of all vocabualries in the site | Data mining

texts:
Since I migrated D7 to D8 I suffer from the following problem and need help regarding mining the data that could be useful to make a fine report to the Drupal community.

The story:

When you visit nodes created before migration, you can see their taxonomy terms.

If I save a node with taxonomy data that was created before migration - All its taxonomy data is vanished if its from selection box or radio buttons (if its from autocomplete, the node saves just fine, as weird as it sounds)... It happens in all nodes, and in all content types, (even new ones I create after migration whether from migrated or new content types).

A milestone in my efforts to understand why it happens is this:

When I save any taxonomy vocabulary like in the following image, all of its terms, including the terms of all other vocabularies are just suddenly deleted... Insane as it sounds --- Right after I hit "Save", all of the terms in all vocabularies in the site, just vanish.

But this deletion is only in the UI level; that is, If I go to the table containing taxonomy terms, that is taxonomy_term_field_data I can see all 30 terms that appear in all nodes.

I have consulted a Drupal programmer on this and he told me this is most certainly a migration bug, given it happens on an all-core site and there are no errors in drush ws --full.

Note:

I don't ask anyone to debug this for me; Since I learn basic programming and haven't yet learned to debug, all I am asking is what PDO data should I monitor and present in my report to the Drupal community.

I would thank you dearly for giving me any direction because I suffer from this problem very much.


texts: How to remove tags from display in form?

texts:
I have this form tempate

    {{ form.card.a }}

    {{ form.card.b }}

and I want to to frame it with  tag like this.

        {{ form.card.a }}

        {{ form.card.b }}

so I made

$form['card']['card_link'] = [
  '#type' => 'item',
  '#markup' => $this->getCardLink(), //returns integer
];

But it still doesn't show what it supposed to.
It inserts
needed integer
 inside href="<here>"

How should I fix this?


texts: How to sort a View according to contextual filters?

texts:
I have a view that filters nodes by a contextual filter that allows multiple values. So it gets a list of node IDs like 234, 235, 210, 56, 78.
Is it possible to sort the result of this view according to the order of the given IDs?
I tried to achieve that by deleting all sort criteria, but this leads to an arbitrary order of the results.


texts:
I know that you can change the layout of the order history/order listings pages by editing the uc_orders_user View, but how can you theme the order details page (for example, http://mysite.com/user/1/orders/5)?

I am setting my Ubercart to be used exclusively for Requests For Pricing, and I want to remove all mentions of the words "Cart", "Order", etc, and replace them with RFP-related terminology. I have been able to accomplish a lot of this via String Overrides, but the thorn in my side is the big H1 "Order (#)" tag at the top of the Order Details page. I'm hoping someone here can tell me how to theme that page so I can rename that item (and make a few other small tweaks to the page).

Thanks!


texts: How to write an Webservice API Wrapper the drupal 7 way

texts:
I have been trying to find a standardized way of writing a Webservice API Wrapper the drupal 7 way but I was not able to find any documentation on this.
How does one write an Webservice API wrapper for Drupal 7? An example will be much appreciated.


texts: Give a specific user role the ability to edit, delete users other specific role

texts:
I'm working in Drupal 7.

I want to give to a specific user role named "test role" the ability to edit, and delete users whose role is students.
Users with that role should not modify the admin account, and any other account with other roles.


texts:
I would like to use Drupal 8 (beta) with nginx. It works correctly, except update.php. It doesn't find it.

After analysing .htaccess (which is not processed by nginx) I realized that there is no real update.php file; it is served by index.php.

Does anyone have a working nginx configuration (with php5-fpm) which works with Drupal 8 beta, and that makes also update.php work?


texts: Shipping price for different countries using Commerce Kickstart

texts:
I'm using commerce_kickstart distribution.

I need to set different prices for shipping products to different countries.
Ex: France -> 10€, Spain -> 15€...

I guess I have to create a rule at: admin/commerce/config/shipping/calculation-rules but I don't know to create a condition to check over the selected Country in the Shipping Information filled by the buyer.

I think I saw a video about this at http://vimeo.com/31586256 but i can't find it though.


texts: How do you run custom functions after Migrate class finishes an import?

texts:
I have migrate classes to import useres, taxonomy, content, etc.  Some of these are being imported from a CSV source and need to be organized a little better either before or after an import.

How can I run custom functions before and after an import with the Migrate module?


texts: I am using drupal 8, search api and solr on our site. In views, I am using full text search with direct query option. Search is working for multiple words. What I want is when I search with double quote, I want the result with exact match of query string. But putting double quote doesn't seem to have any effect on it. If I changed parse mode to multiple words, double quotes work but it doesn't return any result for query without double quotes. Can I even achieve it in single view display? Any workaround suggestion so that it works for query without double quotes but also respect double quotes to do exact match depending upon query.


texts: Module broken by drupal core update (mysql_num_rows)

texts:
So I just updated my Drupal core to the latest (6.2.9) because of the many critical security recommendations.

I have a module which I built and previously, just before the update I had tested the module which uses a hook_cron() function and everything seemed to work as expected.

After the update It seems completely broken, I keep getting a warning "warning: mysql_num_rows() expects parameter 1 to be resource" which I have read a lot about others having the same problem in other threads, couldn't find a solution which worked, but the thing is, it was literally just working for me!!

I ran the $result query in a shell and it seems to return the expected data, I don't know what the problem suddenly is. All other modules appear to work normally.

function httprequest_cron() {
  $result  = db_query("SELECT nid FROM {httprequest}");
  if (mysql_num_rows($result)) {
  // results returned
  $url = 'http://localhost:3000/blog?status=fetch';
  $result = drupal_http_request($url);
  if (isset($result) && in_array($result->code, array('200', '302', '307')) && $result->data != '') {
  db_query("DELETE FROM {httprequest} WHERE nid");
  }
  }
  else {
  // no results, but good query
  }
}


texts: How to replace login in "to" mail field?

texts:
In registration notify email, or in emails sending by rules f.e., there is a prefix contained login of recipient in field "to". How can i change it for custom field value?
P.S. I use MimeMail module, if it matters.


texts: Is Drupal 8 with views in core stable enough to be used as a simple blog?

texts: I want to start using the new drupal 8 codebase, but I was wondering if I can use it in its state now as a simple blog using views.


texts: Is it possible to use views inside the Homebox module? If so, how?


texts:
I am using D7 and views for one of my sites. I created a new image preset under the Configuration-> Image styles with scale and crop effect. My problem is whenever I create a node with this image preset I could see few portions of my image being cut out. This happens specially when the image is vertically large or horizontally large. I need to use a preset which does not cut the image and resizes it properly irrespective of whether horizontally large or the other.

Thanks.


texts: How to prevent displaying the theme on a custom page callback in hook_menu()

texts:
I am developing a custom module with a callback script at foo/myurl:

function foo_menu() {
  $items = array();
  $items['foo/myurl'] = array( // change 'foo/myurl' to the url you want
    'title' => 'Callback',
    'type' => MENU_CALLBACK,
    'page callback' => 'custom_callback',
    'access arguments' => array('access content'),
  );
  return $items;
}

function custom_callback () {
  echo 'success';
  return;
}

But this URL is to be called by a 3rd party script, and I only want to return the echoed string, how can I prevent the rest of the theme from loading?

Thank you


texts: Webform what is format required to prepopulate datetime element

texts:
Sending default date format (medium) from VIEW rewrite results link, URL adding
?apptdatet={{ field_apptdatet }}
This never fills the webform datetime field. The value is shown in the url as medium formatted date. day mm dd yyyy hh:mm:ss
On the webform the apptdatet field shows the correct format mm/dd/yyyy hh:mm:ss, the value is always blank however.
in the view apptdatet shows as Mon 05-14-2018 15:30
Does anyone know what Webform is looking for?


texts:
On my site I have a series of quizzes.

Each quiz has it's own video (an embedded Vimeo video).

The videos are on a custom content type called 'Video'.

I want to display the video next to the questions throughout the quiz.

I used the Entity Reference module and on the quiz node I referenced the video node.

I used page manager to display the video node next to the quiz. This was ok but when I started the quiz, the video disappeared.

I thought I could create a block with mini panels or with views and display the referenced node but I can't seem to get that to work.

Does anyone know how to display a node on a block that is being referenced by the current node? Or is there a way I can use page manager to display the video when the quiz is in progress?

I am using Drupal 7, and the Quiz module 7.4.


texts: What (basically) does views/includes/plugins.inc line 9 views_include('base') actually do?

texts:
I ran into an issue today where I started getting the following white screen of death error:

  PHP Fatal error:  Call to undefined function views_include() in /*/sites/all/modules/views/includes/plugins.inc on line 9

I found several various bug reports and questions with similar errors. Some said it was a bug in views, some said it was a bug in VBO, and some reported it being issues with a specific module (like finder) none of which am I really concerned about.

My question is, since most of the solutions had to do with either commenting or uncommenting a particular line. Line 9 in views/views/includes/plugins.inc views_include('base'), what does this line actually do? Furthermore, what is the harm/benefit of having it commented or uncommented?

For my personal part, I was able to comment out the line (which cleared the error) then clear my cache and uncomment the line without the error returning, which seems awfully bizarre.

I the code is generally something with including (libraries/functions?) for views plugins, but further explanation would be much appreciated.


texts: setting default language in drupal multilingual module

texts:
In my website, I have 2 language English and Marathi.
1st default language is English and I have added some content too.
but now my requirement is to set default language as Marathi.

I have gone to admin/config/regional/language setting and done default language as Marathi but not its working.

Please someone help to solve this prob.
I want default language on my site as Marathi.


texts:
In hook_form_alter(), I am trying to disable/hide a field label in a custom form. I know I could use $form['my_field']['#enableLabel'] = FALSE;.

Is there a way without unsetting the title?


texts: Drupal 8 dropping session variables on password reset. Gives 403 Access Denied

texts:
I have a fresh install of Drupal 8.6.13, default everything with no custom themes or modules. It was created via:

drupal-composer/drupal-project:8.x-dev with the drupal site:new command.

When I use a one time login link I get a 403 access denied error because the session data (timestamp and hash) gets lost on the redirect from UserController::resetPass to UserController::getResetPassForm.

Here is the source code for reference: https://api.drupal.org/api/drupal/core%21modules%21user%21src%21Controller%21UserController.php/8.6.x

When I log the session variables when they are created in resetPass they are stored and show correctly.

When I then log the session variables on getResetPassForm they are no longer there. This causes the following code to execute which returns the 403:

if (!$hash || !$timestamp) {
  throw new AccessDeniedHttpException();
}

I'm not sure if this is a Drupal problem or Symfony problem or what.

Everything has worked fine on previous versions of Drupal 8.6.x. I noticed the issue when upgrading from 8.6.8 to 8.6.13. I have now tested with just a fresh install of 8.6.13 and am seeing this issue.

Server is Nginx.

Any ideas?


texts: Organic Groups not allowing group members to view content

texts:
I have the following configuration set up for Organic Groups (2.x) :

(1) A content type defined called 'Organic Group'. It's defined as both a Group and a Group Content, because I need the ability for one instance of Organic Group to be a subgroup of another instance of Organic Group.

(2) An instance of 'Organic Group' called 'School Member Zone' set up.
'School Member Zone' has group content visibility set to 'Private - accessible only to group members'.

(3) An Article on the site with 'Groups Audience' set to 'School Member Zone'. It also has 'Group Content Visibility' set to 'Private - accessible only to group members'.

(4) A user on the site 'schoolzone_member1' with a Group Membership of 'School Member Zone'.

PROBLEM -

When I log in as an anonymous user and browse to the article, I get access denied, as you would expect.

However when I log in as 'schoolzone_member1' I still get access denied.

Is any of the above configuration obviously wrong, or if not, how might I start debugging this problem?

Thanks,

MB


texts: What could cause uids to not be numbered consecutively?

texts:
I just noticed something weird in a site I'm working on. The first account is user/1 as usual. A second account I created two weeks later is user/20, and a third one a couple days later is user/32. Etc. Two accounts I just created right after each other are numbered consecutively as expected.

There are no custom modules modifying the registration process or anything. I wonder what could cause this, and if there's something I need to fix.


texts: how to hyperlink autocomplete values in drupal 7

texts:
When users search a hotel name  using Views autocomplete exposed filter text field, is it possible to hyperlink the result values? Suppose we are searching some 'XY' user in a input. The results appear as autocomplete drop-down. When we click on them, it redirects to the hotels description page description page.

Can anyone tell me the best possible solution for this as i tried all but in vain!!!
Is hyperlinking to autocomplete text results possible?


texts: how to add table tr using ajax_command in drupal 7

texts: I am using ajax_command_replace method in my ajax_callback function . its working fine its replacing my whole table.. But I just need to add tr on the table after submit a ajax form if data exist. what should I use for this.?


texts: How can I render my output in a series of DIVs rather than an "item_list"?

texts:
The following code works in the sense that it outputs my series of photos in an unordered list. My question is - What changes would I need to make in order to render my output in a series of DIVs with class IDs? I plan to hook this up to JQuery Masonry and I'd prefer to break away from the limitations of them being in a list.

The following code pulls in my data.

function photo_gallery_contents($display) {
  $max_num = variable_get('photo_gallery_max', 3);
  $query = db_select('node', 'n')
    ->fields('n', array('nid'))
    ->condition('status', 1) //Published.
    ->condition('type','portfolio') // Only want our photos aka Portfolio content type
    ->orderBy('created', 'DESC'); //Most recent first.

  if ($display == 'block') {
    // Restrict the range if called with 'block' argument
    $query->range(0, $max_num);
  }
  // Now proceeds to execute().
  // If called by peg, query proceeds directly to execute().

  // Fetch the results for the nid field into an array.
  $nids = $query->execute()->fetchCol();

  // Load the node objects and return.
  return node_load_multiple($nids);

}

The code that renders all (but would like it to create a series of DIVs) is the following one.

function _photo_gallery_page() {
  $result = photo_gallery_contents('page');

  // Array to contain items for the page to render.
  $items = array();

  //Iterate over the resultset and format as links.
  foreach ($result as $node) {
    // Build a render array based on the field's display settings.
    $image = field_view_field('node', $node, 'field_image',array('label' => 'hidden',   'settings' => array('image_style' => 'thumbnail')));

    // Render the array down to the image HTML.
    $image_html = drupal_render($image);

    $items[] = array(
      'data' => l($image_html, 'node/' . $node->nid, array('html' => TRUE)),
    );
  }

  if (empty($items)) {
    // No content in the last 2 weeks.
    $page_array['photo_gallery_arguments'] = array(
      //Title serves as page subtitle.
      '#title' => t('All photos from ever'),
      '#markup' => t('No photos available.'),
    );
    return $page_array;
  }
  else {
    $page_array['photo_gallery_arguments'] = array(
      '#title' => t('All photos from ever'),
      '#items' => $items,
      // Theme hook with suggestion.
      '#theme' => 'item_list',
      '#type' => 'div',
    );

    return $page_array;
  }
}


texts: Media browser Embed button does not restrict library to selected file entity bundles or Media type

texts: I am using Drupal Lightning 8.x.2.2.3. And I am using the the built in Lightning Embed button (the one with the Star icon) added to the Ckeditor to add media to the body. The Embed button is using the Media Browser. On the Embed button settings page here: /admin/config/content/embed/button/manage/media_browser?destination=/admin/config/content/embed. There is a filter to restrict by Media Type. It says If none are selected, all are allowed. This option does not restrict anything, is this a bug? I have the Document Type checked and it still allows Images when I go to upload media. Example when I click one the Embed button in the Ckeditor. And then I click on tab Upload. The widget 'file upload' is being used. And I can upload images.  Can a custom hook be created to restrict file types through the File Upload widget? I know you can further restrict file types here: /admin/structure/media/manage/image/fields/. But I need to restrict it up further at the browser on button level. The other widget called 'Upload images as media items' has a setting to restrict by file types. But it uses a different form ID then File Upload widget. The 2 widget work Differently.


texts: I have created a view and sending the view as newsletter to users. But received mail contains EDIT VIEW link. How to remove the edit view link from newsletter. I have added the screenshot of received email. I am using Mime Mail for sending email.


texts: Convert db_query to db_select or EntityFieldQuery

texts:
Can anyone help me converting this query using db_query to db_select or EntityFieldQuery? I already tried a lot of things but always getting error. I am new with Drupal, my query works well but I think it's better converting this to db_select or EntityFieldQuery, what you think?

UPDATE

My query:

function get_recent_videos($uid) {
  $query = db_query('SELECT * FROM {node} n, {field_data_field_video} v
         WHERE n.uid = :uid
         AND n.nid = v.entity_id
         AND v.field_video_value IS NOT NULL
         ORDER BY created DESC
         LIMIT 0, 4', array(':uid' => $uid));

  $result = $query->fetchAll();

  return $result;
}

How can I use a placeholder in the limit? I tried the same approach that I have used in :uid but didn't work.

Thanks a lot.


texts: How can I build a blog in a single language that isn't English?

texts:
I am developing my new blog based on Drupal 8 and I want only Greek version of the blog (don't want content translation). I added Greek language as default and if there is also English then there is a url seperation with /el in the greek content. I don't want /el in the url and I want this blog in single language and non English.
What are the consequences if I delete the English language?


texts: Add "webforms like" values to profile.module select list

texts:
Is there a module that can allow me to add custom values to select list items in the Profiles module in Drupal 6, like webforms does it. For example:

my_value_1 | my_text_1
my_value_2 | my_text_2

which will create a select list

<select>
<option value="my_value_1">my_text_1</option>
<option value="my_value_2">my_text_2</option>
</select>


texts: How do I display a link as an embedded player?

texts:
I want to create a field as a link.  I want this link to be displayed as a custom embedded player.

I have checked out How do I add embedded YouTube videos in a field? and the Embedded Media Field module however this solution does not work for me.

I do not like the admin interface/configuration.
The module does not support my flash player.

Any suggestion would be great.


texts: How can I change adressfield items order in node display

texts:
I'm using Address Field and Address Field Phone modules, the country is dispalyed after the phone number.

So how I can change the addressfield items order?


texts:
I have a website built on drupal. I want to log (preferably db log) all the calls being made to a drupal page. The drupal page is called as shown here

http://www.example.com/page-name?url=example2.com&redirect=example3.com&uid2=randomNumber

I need to log all URL fields (url,redirect,uid2) alongwith timestamp and drupal user id.

Whats the best way to do it?


texts: Best method to upload / link to multimedia files in D6?

texts:
I need a solution to allow users to upload multimedia files (audio, video, images, documents, links to such) to a node. Ideally, something like a combination of FileField + Embedded Media Field that supports different media and styles the viewer accordingly.

I know that module Media is supposed to solve this problem on D7, but I'm looking for a D6 solution.

I've tried:

jQuery Media but it doesn't handle many file types that I need - plus I prefer a server-side solution.
Styles + FileField Styles but they just don't work.


texts: Is table prefixing controlled by db_set_active()?

texts:
If I use db_set_active() to fetch data from another database, how will that affect table prefixing?

Is table prefixing dynamic in the sense that it adjusts to the currently active database?


texts: Invalid argument supplied for foreach() error in a custom view

texts:
I wanted to display a table vertically and I found some code to do so, but I'm getting the following error:

warning: Invalid argument supplied for foreach() in site/modules/views/theme/views-view-table.tpl.php on line 35.

Line 35 contains the following code: <?php foreach($row['title'] as $title): ?>.

If I comment out that line, the table stops to be displayed vertically. I read on drupal.org forums that modifying the user's view permissions was a way to resolve, but I granted all permissions to views and I am still getting the same error.

How can I avoid the error appears?


texts: How can I do an OR operation on the values of a solr field?

texts:
Say I have a facet on countries, I'd like to be able to click on more than one country (say US and UK) and get results tagged "US" OR "UK".

Currently If I click on "UK" on the facet block, the other terms disappear if this was a "single solr field".

And if it was a multi-valued solr field, the other terms don't disappear but an AND operation is done.

How can I change the default behavior to allow OR operation on both "single" and "multi-valued" solr fields?

I'm using the Apache Solr Search Integration module version 1.6.


texts:
I have a webform which sends two emails upon submission:

To the administrators of the site via webform emails
To the client who submitted an email via rules using 'send html email'

Everything is working great except when the client's email is hotmail. Hotmail is not receiving the html email. However, if I change the action in rules to 'send mail' it works. Which means that hotmail is not accepting HTML emails.

In the mail system configuration I have the following:

Site wide default class: MimeMailSystem__SmtpMailSystem
Mime mail module class: MimeMailSystem__SmtpMailSystem

I don't know what else to look for. Any help would be appreciated.

Thanks,


texts: How do you remove N/A from radio button groups?

texts: I have added a radio button to my content type and I have found that N/A was automatically put in as a selection.  How do I get rid of this?


texts:
My need is to combine fields which their data type is integer.

I did not find a module for that. Or is there? The "Global: Combined fields" filter supports strings only.

Which approach would you recommend to achieve this? Thanks!

[Edit]

After seeing a comment from @scronide I am adding here some info (this is more generic so I do not comment his comment).

One might indeed choose the direction of saving a value in another field. It may be indeed as a computed field, but also as another integer field which - in its turn - holds the wanted value using code or rules.

However, I wanted to consider the on-the-fly retrieving the items.

Still, may be the separate field direction is better to go with. I will give here my exact situation, also as @Roy Segall suggested.

GIVEN
 - Using Search API indexes for the view's exposed filter;
 - Multiple integer field in a few content types. In the "Person" content type I have: "Year born", "Was active from", "Was a king from", etc. In another content type "Work" I have "Year written", "Year published", etc.

NEED
- The exposed filter is in a view where both content types are located and should return results of any item of any content type which holds a value bigger than or equal to the search value in any of the integer fields.

NOTE
As I am not an expert regarding performance, I am not sure which direction is the way to go; that is, saving a separated field (shared one across types) and index it for a simple filtering, or rather indeed filter on the fly among multiple fields.

Thanks for using your calories in your brain to help me think...
Amir


texts:
I have a custom filter form in my site and the form submitted by the filters adds 2 Get variables to the url. However, the variables appear in the form of:

http://example.com/newpage?param1=a%2Cb&param2=c

instead of:

http://example.com/newpage/param1/a%2Cb/param2/c

I have Global redirect clean url enabled and I have pathauto module in my installation and clean url test to checl mysite.com/user/login works fine.

I have tried a couple of plugins eg. query_parameters_to_url but they are not working for that page and I tried adding hook_url_outbound_alter and hook_url_inbound_alter in my custom module but they overwrite all the urls.

Can anyone suggest a way to implement clean urls for somehting like this with affecting the urls for other pages in the website?


texts:
I've setup apache solr and the facet api for my drupal 6 site, however I can't seem to get my facets to show up on my search page. The only time they show up is when I enable 'show enabled facet blocks under the search box' when there are empty results.

I tried to add my facet block to a region, but it remains blank.

I would think the facets should display on the search page automatically?


texts: How to get module name from a given route object?

texts:
In a runtime context, given I have a route object, e.g. from route name user.register, how do I find the path or routing.yml or other definer of the route?

Does Drupal or Symfony provide for this?

There's probably a better way to do what I want. The scenario I have is: a plugin manager is deciding which plugin to instantiate based on route context. For example, if module foo defines route foo.bar at path /foo/bar, the plugin manager will instantiate plugin foo_plugin. If module, zee defines route zee.bang at path /zee/bang, the plugin manager will instantiate zee_plugin


texts: How to include most specific tpl files in a less specific tpl file?

texts:
I created a view with fields. I want to print the values of the fields. So I use views-view-feilds.tpl.php . Also I created a views-view.tpl.php to show the outer html elements. I performed <?php
  include('views-view-fields.tpl.php');
?> in views-view.tpl.php file. I got the output as my requirement. But I need to know if its the right method according to drupal or any other method is available?


texts:
I have to carry out a procedure for the management of information by a group of users. Later I could have the same need but for a group of different users. Since I haven't understood how the multisite works, I can't make up my mind.

The software will be the same, but for database copy, user management and security issues, I would prefer to have the database different for the group of users.

Can the multisite manage multiple databases with a single software?
Do I have to foresee it and create it from the beginning or can I create the software and subsequently, if there is a request, transforming it into a multisite?


texts: How to create a view returning untranslated entities

texts: I'm using entity translation and I want to create a view returning a list of untranslated nodes in the current active language. I have been searching all day but I cannot get this working...


texts: Adding some new custom variables to page.tpl.php

texts:
I want to add some variables to page.tpl.php via template.php so i guess i need to use my_theme_preprocess_page. But my variables does not seem to be passing through.

I am using something like this :) In template.php

function my_theme_preprocess_page(&$vars) {
$vars['myvar'] = "value";
}

and in page.tpl.php

print $myvar;

and $myvar fails; also tried defininig it with $vars['page']['myvar'] = "value";
and reading it back with print ($page['myvar']);
but with no luck, variable (or index) stays undefined.

I cleared cache.

Any clues why this does not work ?
Thanks!


texts: Running a function before a View executes

texts:
I have a carousel built using Views (7.x-3.x) that displays 10 items. In this carousel I would like to place 1 item (inclusive of the 10) that displays Twitter content.

What I would like to do is run the function that uses the Twitter API before the View is built/executed. If it succeeds then the View should display 9 items from it's own query (10 items total.) If it fails, then the View would display 10 items from it's own query.

I have successfully implemented the View and the Twitter function running on the theme layer though in order to have a 'fall back' by altering the number of items displayed I would need to do this before the View is built/executed.

Can anyone point me in the right direction for this?

I believe I am looking at the right function "hook_views_query_alter" but I'm not sure how to set "items_per_page"

Thanks


texts: Search Results page. Move the search form after the results?

texts:
Apparently the only template file to edit is for an individual search result, located at core/modules/search/templates/search-result.html.twig. So you can't move the search form after the results and style accordingly?

Just want to double check this.


texts:
I want to insert

 every nth element. How can I insert this into the twig template of a view?

Same Question for D7: Insert *whatever* every nth row in Views


texts:
I am working on creating a theme from scratch for Drupal 8 and I am 90% of the way there.  I do have a question on how to access variables in the

{{ dump() | raw }}

I have created a page.html.twig and the {{ page.BLOCKNAME }} is working great.  But when I try to place {{ title }}, or any variations, I get NULL or nothing at all.

I can see the title in the dump(), but it has ["string":protected]=> so I am not able to access. I was able to create a new block region and move the title there, but the title will not be in the same place from page to page.  I would also like to access the content type, node ID, and node url, with some other custom fields I created, but I can't seem to get to those either.

In summary, how do I use the dump() and actually get to the variables that are presented?


texts: How to add the datepicker jQuery UI element to Highcharts in a Drupal site?

texts:
I am creating a Highstock (Highcharts) page in a Drupal site and I cannot seem to add the datepicker element. I have successfully implemented it in a non-Drupal environment here:

https://jsfiddle.net/MrSnrub/g7u14p10/

...but when I try to migrate it to a Drupal module, it fails. As I understand it, both jQuery and jQuery UI are installed by default in Drupal, is there a specific version that I need to worry about?  When I load up Firebug, it does not give me an error about the datepicker, so it must be interpreting it correctly, but when I load the page and click on the textbox, no datepicker appears. I have jquery_update module installed, and I'm running Drupal 7.  Here is my relevant Highstock JavaScript code:

$('#div-highstock-container').highcharts('StockChart', {
  chart: {
    renderTo: 'div-highstock-container',
    events: {
      load: create_new_legend
    }
  },

  // ...

  series: seriesOptions
},
function(chart) {
  // apply the date pickers
  setTimeout(function() {
    $('input.highcharts-range-selector', $('#' + chart.options.chart.renderTo)).datepicker()
  }, 0)
});

HTML:

PHP (in hook_page):

drupal_add_library('system', 'ui.datepicker');
drupal_add_js('
  jQuery(document).ready(
    function() {
      jQuery( ".highcharts-input-group" ).datepicker({
        autoSize: true
      });
    }
  );
', 'inline');

Do I need to call the datepicker() method in the PHP code or in the JavaScript code at the end of the highcharts() object creation function call, or both?

UPDATE: I changed the PHP code to the following, but the datepicker is still not showing:

drupal_add_js('
  (function ($) {
    Drupal.behaviors.addHighStockDatepicker = {
      attach: function(context, settings) {
        $( ".highcharts-range-selector" ).datepicker();
      }
    }
  })(jQuery);
', 'inline');

If I change the element from ".highcharts-range-selector" to "#div-highstock-container" the datepicker does appear in the main container (therefore, I know I am loading the jQuery library datepicker file successfully), so why does it not appear when I try to apply it to all elements with class "highcharts-range-selector"?


texts: How to get a user's profile picture URL?

texts:
I need to get the user's profile picture using the following code:

\Drupal::service('renderer')->renderPlain(\Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->user_picture->first()->view('large'))

It returns an object with the image tag, but it fails with the _Call to a member function view() on a non-object_ error when a user has no profile picture set.

I also tried the answer to "How do I get the default user picture?", but it gives the error

  Drupal\Core\Database\InvalidQueryException: Query condition 'file_managed.uuid IN ()' cannot be empty.


texts: Prevent Drupal from auto-caching pages in all translations

texts:
After clearing the cache, Drupal generates cached versions of every node/page that gets visited. Which is fine.

However – if I visit the German version of a node/page, not only the german version will be cached, but also all the translations of that specific node.

(Normally, this wouldn’t be a problem, but I have a custom input filter working which detects the current language and changes things in the text accordingly. This input filter has only access of the current system language, not the language of the currently filtered node. Which leads to wrong results.)

Can I prevent the automatic caching of node translations?


texts:
I'm migrating my drupal websites from a server running with Apache web server to a Nginx server. The problem is, I can't access any of my websites on the nginx server. It redirects me to a 404 error page for all websites.

Any suggestion?


texts: access denied error on user registration module

texts:
I created a custom registration form using the code I show below. It works on my test site, but on my live site, it returns an access denied error. I am not sure what the problem is.

function medical_reg_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  $form['#theme'] = 'medical_register';
  $form['actions']['submit']['#value'] = t('Next');
}

The setup is the same so I am rather perplexed. The test site is local. Are there some configurations which make a big difference?


texts: In Drupal 6, I have a CCK colorpicker field, and I would like to use the color for links, b/em tags, and headers in the body of the node.  In D7 i could use drupal_add_css to create inline CSS that is not aggregated, but that is not available in D6.  Is there a way of doing this that doesn't involve preprocessing the body and adding inline styles to the individual elements?


texts: FAPI redirect *and* store to local database

texts:
What I'm trying to achieve

I am successfully using the Form API in Drupal 7 to dynamically alter Webforms to redirect to an off-site URL on submit.

What I need is twofold; I need (a) for the client to visit the offsite URL so the site can store a lead via query string parameters, as well as (b) for the same information to be documented in my local Drupal database.

Every lead must be documented, so I have tentatively ruled out JavaScript/AJAX as an option.

How I tried it

I thought the best way to do this was to set up a module with $form_state['redirect']:

/**
 * Implement hook_form_alter to change the form's submit action
 */
function myform_form_alter(&$form, &$form_state, $form_id) {
    $form['actions']['submit']['#submit'][]='myform_submit';
}

/**
 * Callback as specified above
 */
function myform_submit($form, &$form_state) {
    // Values for the query string
    $vals = array('mykey' => 'myval');

    // Redirect appropriately
    $form_state['redirect'] = array(
        // $path
        'http://www.anotherwebsite.com/',
        // $options
        array('query' => $vals),
        // $http_response_code
        302,
    );
}

I did that, and as expected, the user is redirected immediately after form submission. However, the Form API does not submit to my database before redirecting the user.

I read the FAPI documentation for Drupal 7. I sought using #action, although it apparently reports only accepting internal values and my users must visit an offsite URL. I wound up using redirect in the meantime, which was no longer documented but was suggested in the comments.

Where do I go from here?

EDIT: tenken's response works, but I have another problem!

My callback now uses array_unshift($form['#submit'],'my_callback') and via drupal_http_request, is submitting to both websites. However, my webform is still not saving submissions locally, and instead on submit, redirects to self (even with no hook_form_alter).


texts: Better exposed fiters with Views: how to show quantity of nodes tagged with certain term?

texts:
I use better exposed filters with views. I chose to show field "term reference" as hierarchical checkboxes on my exposed filter. It works great.

But now I need to add quantity of nodes having certain term near each checkbox inside filter.
What is the best way to do it?
Thank you!


texts:
I want to output the membership of a drupal group, but limiting the number of members shown, instead of outputting all members at once, (that i can do with the code bellow).

    $members = $group->getContentEntities('group_membership');


texts: What does the array_filter key in $form do?

texts:
I'm following this tutorial on creating a settings form for a module in Drupal 8. The instructions say to implement the buildForm method of ConfigFormBase in the following way:
  public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL) {
    $types = node_type_get_names();
    $config = $this->config('rsvplist.settings');
    $form['rsvplist_types'] = array(
      '#type' => 'checkboxes',
      '#title' => $this->t('The content types to enable RSVP collection for'),
      '#default_value' => $config->get('allowed_types'),
      '#options' => $types,
      '#description' => t('On the specified node types, an RSVP option will be available and can be enabled while that node is being edited.'),
    );

    $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);

    return parent::buildForm($form, $form_state);

Everything here makes sense to me except I can't find any documentation on the role that they 'array_filter' key in the $form variable plays. What does this value do? Where is it documented?


texts: how to configure Multilevel Binary Affiliate Tree module

texts: There is no configure option for Multilevel Binary Affiliate Tree module. I want to change it in my own way how can I do it.


texts: Import site from HTML pages (currently static files in directories, not in a CMS)

texts:
I've taken over a small website (link here, in case it helps) which is currently composed of largely static HTML files (with a few PHP includes thrown in to generate menus and footers, etc). I want to migrate it into Drupal, as I'm fairly familiar with this and it'll make the site more manageable. My question is: what's the best way to do this?

I've found plenty of modules to migrate sites from CMSes like WordPress, but none to import static files organised in directories. Some research turned up the Migrate and Feeds modules, but I'd like some guidance on whether to use something else, or whether to use these, and if so how. Should I write a perl script to pull out the content and titles and current paths or pages into a CSV of some format? Presumably others have done this, so it'd be interesting to see best practice, or examples...

Many thanks


texts: Colorbox not working for anonymous users, but works fine for logged in

texts:
I am having an issue getting my colorboxed images to load while viewing the page as an anonymous user. As an anonymous user, there is no reference to anything related to colorbox at all. However, when logged in as admin, everything works fine.

This feels like a permissions issue, but I don't see any settings in permissions. also, the configuration in the 'manage display' settings leave a bit to the imagination.

What am I doing wrong? Is this indeed a permissions issue? 7.x 1.3 and drupal 7.14


texts: Replace default words in exposed filters

texts: I created an exposed view that allows users to sort content based on content type or date. In my content type drop down menu, the default choice is - Any -, I tried to replace it in the settings file's string override section, but while this works for numerous other defaults, it doesn't seem to be taking for exposed views. Any help would be much appreciated!


texts: How to add class to individual radio item inside "radios"?

texts:
I need to style my radios as tabs. So I created a form element like this:

$form['important_categories'] = array (
  '#type' => 'radios',
  '#label' => NULL,
  '#attributes' => array (
    'class' => array (
      'radioTabs',
    ),
  ),
);

foreach ($important_categories as $id_important_category => $important_category_name) {
  $form['important_categories']['#options'][$id_important_category] = $important_category_name;
  if(!isset($form['important_categories']['#default_value'])) {
    $form['important_categories']['#default_value'] = $id_important_category;
  }
}

This properly sets options, and sets first element as default. However, it add classes in two places. Here I wanted it:

<div id="edit-important-categories" class="form-radios radioTabs">

Here I didn't:

<input id="edit-important-categories-22" class="radioTabs form-radio" type="radio" value="22" name="important_categories">

On individual radio, I need radioTab (singular, not plural), and on default one also radioTabDefault.

Is there any built-in method to get this? Or do I need to alter my theme, like I did for labels? If so, what function I should modify?


texts: How to redirect user to new page after submitting user register form?

texts:
I've being trying to write custom module that redirects user from user register page after submit. I read several issues on Drupal Offsite and here on Stackexchange, but could not still resolve the issue.

This is my custom module code:

function myregistration_form_user_register_form_alter(&$form,&$form_state){
  unset($_GET['destination']);
  drupal_static_reset('drupal_get_destination');
  $_GET['destination'] = array('query'=>array('q'=>'order_translaton'));
}

The URL of the page I want to redirect to is: http://www.sociofobic.ru/drupal/?q=order_translaton.

After registering user no redirect occurs. Instead I get the NOTICE:

  Notice: Array to string conversion in url_is_external() (line 2312 of
  /home/bnqpdcme/public_html/drupal/includes/common.inc). Notice: Array
  to string conversion in drupal_parse_url() (line 589 of
  /home/bnqpdcme/public_html/drupal/includes/common.inc). and  Page not
  found: The requested page "/drupal/?q=Array" could not be found.

Please tell me what I do wrong, because the syntax for URL redirection I use is the same as explained in drupal_redirect_form().


texts: Where is list of theme features in Drupal 8 that can be exposed on the "Settings" page?

texts:
In my theme.info.yml file, I can expose features to show up in the settings of my theme. It's documented here: drupal.org theming

features:
  - comment_user_verification
  - comment_user_picture
  - favicon
  - logo
  - node_user_picture

I tried to google a list of these, but can't find it. Is there some way I can figure out all the options available here, if there's not an explicit list anywhere?


texts:
i was having some problems with my settings.php file.  I fixed this but now my user page isn't found and I cannot login.  Anyone know how to fix this?  Thanks!

Authorize.php loads but obviously i cannot get in

nevermind i think it's an issue with hostgator


texts: Subnavigation doesn't show with the Bartik theme

texts:
I would like to have a menu point in my main navigation with sub-menu points.

I created a main point +Services with two points underneath it where I assigned the respective "Parent link".

The structure looks fine in the administrative interface, but I do not get the sub navigation points to show up or the mother point to drop down even though I selected "Show as expanded".

I placed two menu points under Services that do not show up.

Can anyone help in this matter?


texts:
As I'm moving on to the markup/stylesheet work on my site, I noticed that there are quite a bunch of CSS references to modules. Not only does it clutter the page markup, but it also refers to core Drupal modules, such as /modules/field/theme/field.css.

Since I have to override some of the style definitions (clear problematic floats, narrow a context, and some such), at the same time a question raises in my head - how do you guys approach those stylesheets: do you paste all the definitions in your theme css and remove unneeded css stylesheet links - or rather: - leave the stuff in place and override all problematic style definitions in your theme css?

How do you approach module-related stylesheets, such as Display Suite layouts?

I would like to avoid redundancy where possible, but only when the effort is justifiable.
Any insights?


texts: How can I load all order by using sql queries or by using predefined methods. I have attributes like One Month and Three Month. I want to get orders and the selected attribute with each order.


texts: How to integrate the link embedded in custome HTML(using ) to breadcrums?

texts:
Home >>

On the Home page I have created a div and inserted some text there and  one of word I have added in Text area using CKeditor is Link to page-1, so if i click that link it leads to me to page-1, so breadcrumb shows,

Home >> page-1

Now in the text area(body) of page 1 I have added another word Link to Page-2, page-2 is a page created using the views. so after clicking this second link breadcrumbs shows,

Home >> page-2

But I want Home >> page-1 >> page-2 which is the sequence in which I arrived on that page

although I have added this all links in the Body of text area using , what I can do so breadcrumbs read this and make in the sequence as I want, In short how can we customize the breadcrumbs.


texts: How to invoke autodialog module close method in autodialog.js file using ajax_command_invoke

texts:
I have form that loads in modal using autodialog module and I have two buttons inside the form the close and save button. What I am trying to achieve is to just close the modal when the close button is clicked. I can do this using jQuery but what I wanted to do is use ajax_command_invoke to invoke autodialog close to close the modal. so far this what I have done, but I can't make it work maybe I am doing it wrong.

function example_autodialog_close_form_submit($form, &$form_state) {
  switch($form_state['clicked_button']['#value']) {
    case 'Closed':
      $commands[] = ajax_command_invoke('.autodialog-content', 'dialog', array('close'));
      break;
    case 'Save':
      // Insert data in database.
      break;
  }
  return array('#type' => 'ajax', '#commands' => $commands);
}

  Using jQuery, this one work but what I wanted is use
  ajax_command_invoke to invoke auto dialog close.

$('#autodialog-close').click(function() {
  $('.autodialog-content').dialog('close');
});

Some code snippet in autodialog module autodialog.js file.

  Drupal.ajax.prototype.commands.autodialog = function (ajax, response, status) {
    var options = {
      title: response.title,
      width: 500,
      modal: true,
      closeText: Drupal.t('Close'),
      close: function () {
        $(this).dialog('destroy').remove();
      }
    };
    $.extend(options, response.options);

    // Close previous dialog
    if (options.closeprev) {
      $('.autodialog-content').dialog('close');
    }

    // Create dialog content
    var $dialogContent = $('' + response.content + '').appendTo('body');

    // Open dialog. Not $dialog.dialog() because it causes problems with inline scripts for jQuery 1.4.
    $('#' + response.dialog_id).dialog(options);

    // Remove focus from first tabbable element
    $dialogContent.closest('.ui-dialog').focus();

    // Close dialog when clicked outside
    $('.ui-widget-overlay:last').click(function (event) {
      if ($(event.target).hasClass('ui-widget-overlay')) {
        $dialogContent.dialog('close');
      }
    });

    Drupal.attachBehaviors($dialogContent);
  }


texts:
I have a form that one of fields is mail field, when form submit I check that email if not belongs to any user I create a user  and assign that node to the created user, Then I want logged in that user automatically after user create a node.

I have below solution  but not work.

function mymodule_form_node_form_alter(&$form,&$form_state,$form_id)
  {
 if($form_id=="my_content_type")
 {
if($user->uid==0){
        array_unshift($form['#submit'], '_tgdev_ss_submit');
   $form['actions']['submit']['#submit'][]= '_tgdev_listing_suserlogin';
  }

   }
}

function _tgdev_ss_submit(&$form, &$form_state)
{
        $mail=form_state['values']['field_mail']['und'][0]['mail'];
    if(!user_load_by_mail($mail)){
        $account = new stdClass;
        $account->is_new = TRUE;
        $account->name = _tgdev_username_pattern_generate();
        $account->pass = user_password(8);
        $account->mail = $form_state['values']['field_email']['und'][0]['email'];
        $account->init = $form_state['values']['field_email']['und'][0]['email'];
        $account->status = TRUE;
        $account->roles = array(DRUPAL_AUTHENTICATED_RID => TRUE);
        user_save($account);
        $op = 'register_no_approval_required';
        $status = _user_mail_notify($op, $account);
        $form_state['values']['uid'] = $account->uid;
        $form_state['values']['name'] = $account->name
        }
 }

function _tgdev_listing_suserlogin($form,$form_state)
{
//$user_obj = user_load_by_mail($form_state['values']['field_email']['und'][0]['email']);
$form_state['uid'] = $form_state['values']['uid'];
user_login_submit(array(), $form_state);
// ym($form_state,'message');
 $form_state['redirect']='node/'.$form_state['nid'];
 }
}

appreciate any help or suggestion


texts:
I run a flash card game embedded as a block in a Drupal 7 site.

Below that main block I display 3 further blocks for the winners of the previous and current week and top 7 best players:

And these 3 blocks are really dragging the performance of my web site (loading page is taking 5-10 seconds more than without them). I'd prefer them to be cached every 15-30 minutes because the weekly top 7 doesn't change often.

How could I do that - without jeopardizing my main block with the game? I.e. the main block contains flash vars specific to each user (his authentication hash) - this one block may not cached and served to any other user.

Below is my code:

pref.info -

name = Pref
description = Pref module
package = Pref
core = 7.x
files[] = pref.module

pref.module -

function pref_block_info() {
  return array(
    'pref_main' => array(
      'info' => t('Display flash game for auth. users'),
      'cache' => DRUPAL_NO_CACHE,
    ),
    'pref_winner' => array(
      'info' => t('Show the winner of the last week.'),
      'cache' => DRUPAL_NO_CACHE,
    ),
    'pref_leader' => array(
      'info' => t('Show the leader of the current week.'),
      'cache' => DRUPAL_NO_CACHE,
    ),
    'pref_top' => array(
      'info' => t('Show the top 10 of the current week.'),
      'cache' => DRUPAL_NO_CACHE,
    ),
  );
}

function pref_block_view($block_name = '') {
  global $user;
  $viewer_id = $user->uid;

  if ($block_name == 'pref_main') {
      .... # may not be cached
      return array(
        'subject' => '',
        'content' => '...here I return the .swf file + user-specific hash...');
  } else if ($block_name == 'pref_winner') {
      .... # should be cached
  } else if ($block_name == 'pref_leader') {
      .... # should be cached
  } else if ($block_name == 'pref_top') {
      .... # should be cached
    $result = db_query("
select u.id,
        u.first_name,
        u.female,
        u.city,
        m.money,
        u.login > u.logout as online
from pref_users u, pref_money m where
        m.yw=to_char(current_timestamp, 'IYYY-IW') and
        u.id=m.id
order by m.money desc
limit 7
");
    $i = 0;
    $list = array();
    foreach ($result as $record) {
      $list[] = user_link($record) . ($i++ > 0 ? '' : '&nbsp;&raquo;');
    }
    $theme_args = array('items' => $list, 'type' => 'ol');
    $content = theme('item_list', $theme_args);
    return array(
      'subject' => 'Семерка лучших',
      'content' => $content,
    );
  }
}

For module caching I probably should enable it in the /admin/config/development/performance and then use some other constant instead of the DRUPAL_NO_CACHE (but which one to take from the includes/common.inc)?


texts: I want to wrap date popup selects in <div> to customize drop-down button of the select. But I can't find where to wrap it. I don't want to use jquery for such.


texts: How to display a message even when user is logged out?

texts:
I'm using Drupal 7, i want to display a message drupal_set_message, when i click on a button for example.

When i'm logged it works well, but for this same button (or page) if i'm not logged in, it doesn't display any message.

This is my case : i've created a mobile application that used a backoffice. this backoffice is built using drupal. i've created a page "reset password" user can click on "reset password" from the mobile app, an email sent with a link to my custom page : reset_pwd

this page contains inputs to reset new password :

$items['reset_psw'] = array(
'title' => '',
    'description' => '',
    'access arguments' => array('administer reset_psw'),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('reset_mdp_formulaire'),
);
return $items;

the form to reset password :

function reset_mdp_formulaire ($form, &$form_state){

$form = array();

$form['confirm_pass'] = array(
    '#type' => 'password_confirm',
);

$form['valider'] = array(
    '#value' => t('valider'),
    '#type' => 'submit',
);
return $form;
 }

the function submit :

function reset_mdp_formulaire_submit ($form, &$form_state){
$new_pass = $form_state['values']['confirm_pass'];
dsm("error");
if(strlen($new_pass) < 8){

    drupal_set_message(t('Password must be 8 characters at least.'), 'error'); <== not shown when logged out
    return;
}
 }

Just want to check if new password is less than 8 characters, and display error message

Thank you all.


texts: How can I get a select drop-down menu based in terms of the a vocabulary to display in a block or a theme?

texts:
I need to get a select drop-down menu based in terms of the a vocabulary.  I need to display this select drop-down in a zone of the theme or in a block not in the edit/create forms.

I have a vocabulary named:  "myterms" and I have the following list of terms in this vocabulary:

term1
term2
term3
term4

I need a menu - select -drop-down that shows term1 and term3 to select and when I put click in the term1 or term3 go to the respective page.  In the menu select drop-down won't show all terms, I need to choose the terms.

Thanks in advance for your help.


texts: How to wrap a custom content page with HTML tags?

texts:
I have a mini-panel in which I add custom content panes. I would like to turn these content panes into buttons. I am able to apply some CSS to turn them into a block, by adding a css class via the "CSS properties" option in each pane's settings. But how can I make a link out of them?

There is no option to add HTML around a pane. And I really want the entire pane to be a link, not just the stuff in it. I could artificially insert HTML into the pane to create a link-block that would fill up all the space, but then I'd have to create other CSS properties to apply to this element, it would just be cumbersome.

I'm still on Drupal 6. Any help would be appreciated.


texts: How can I extend a module and it's library with custom functionality?

texts:
My client requested a modification to their slider that will enable two captions. I'm using the Views Nivo Slider module and believe I can accomplish what I want by modifying the module"s code and extending the Nivo js file. But because I am still learning Drupal, I'm not very familiar with the details of how modules work with JavaScript libraries.

I have gathered that in order to extend a Drupal Module it needs to expose hooks. But it doesn't look like this module does that, so I assume that I'll create a custom module with this modules code as the basis. I know hacking up an existing module code is not the "Drupal way", and I won't if there is another way. Is there?

Also, if I wanted to add another function to an existing library like this one, is there a method through the Drupal module framework to extend the js file without messing with the libray code?

Edit
Title changed to be more general.

I've tried the suggestion by @James Kirby and the field doesn't appear to be included in the markup when I inspect with firebug. Curious, how does the field get included to the slideshow output in your implementation if the fields are normally assigned through the "Views Nivo Slider" format settings? It doesn't look like I can assign divs or classes to the field through it's settings.

Here is what I am trying to achieve if possible. Example

Should I be researching my original approach?


texts:
I use drupal6 and UC2. I am working on a view which exports order details into an excel file such as - address and total order amount. Total amount field is crucial for me - Would it be possible to use views php and check if payment method is COD then get total amount. If payment method is different than COD then result would be nothing or 0?

Thank you


texts: Drupal commerce - product display view replicates products

texts:
I'm building a ecommerce for a fashion designer and of course every item has got variation such as color and size.
With line item it's fine, on the product display i've got the option to change color and size and with the fancy attribute module I can show a small box with the color instead of simple text.

Now I have to build a view of product display which contains title, 1 picture and price.
In order to get the price I create a relationship with the product reference but here comes the problem, it shows all the products, every variations so one item could be repeated several times in different color and different size.

I would like to show just one product of that group, then the user clicks on it and sees the product display and there he can choose the variation.

Of course I can delete the relationship, add a price field on the content type "product display" and show it in the view but I would like to know if there is another way to do it.

Thanks in advance.


texts: How to create content depending on creation of an other content type with rules

texts:
I am abandoned in case of the rules module.

Is there a way to create a forum every time a specified content type is created and give the forum the same title as the content.

I am using drupals forum module and a contetnt type named topic.

Now i like to force drupal to create a froum for each topic that will be created and to take the topic content type title as forum title  for the new created forum

I have no Idea which are the right conditions for the rules module

I am looking forward to see any ideas!

Thank you


texts: Creating a block programmatically in a theme on Drupal 8?

texts:
So I was hoping to have my theme create special blocks for different parts of the front page so that they can be moved around easily later. I added the files to mytheme/src/Plugin/Block/BlockName.php but they never show up anywhere on the site or the block manager even after clearing cache.

Here's the code for one of my blocks (MediaPanel.php):

<?php
/**
 * @file
 * Contains \Drupal\mytheme\Plugin\Block\MediaPanel.
 */

namespace Drupal\mytheme\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Provides my custom block.
 *
 * @Block(
 *   id = "media_panel",
 *   admin_label = @Translation("Media Panel"),
 *   category = @Translation("Blocks")
 * )
 */
class MediaPanel extends BlockBase {

/**
   * {@inheritdoc}
   */
  public function build() {
    return array('#markup' => 'hello world');
  }
}

?>

Do I have to use a module for creating Blocks? It would be inconvenient to have to make a module to create blocks that will be specific to my theme anyway.


texts:
I was making changes to the views display machine names or(ID) and while i create
some display it popped up this message (Display id should be unique) which was by
this name "power_sector_1_1" and it was old id and its deleted, how can i clear the old deleted displays which not used any more to use any ID
I want for the new
display [pages - blocks]


texts: Displaying relative dates in a Views Exposed Filter

texts:
I have a view displaying a collection of events with a date field the user can set the range of. For a default value, I have +0 days to +90 days, so the user can see all events during the next 90 days. The image below shows all my setting information for the date filter.

Currently, the user sees relative dates when they load the page, as the next image shows:

But I would like this to show dates to the user, instead of these relative values when they load the page. In the picture above, if the date they were viewing the page was 1/11/17, I would like the user to see 1/11/17 to 4/11/17 instead of +0 days to +90 days. What would be the simplest way to make this conversion in Drupal 8?


texts: Custom Save and Unpublished button for node

texts:
While clicking Save as draft button, it will save the node but while it have to redirect to the created node it gives error The website encountered an unexpected error. Please try again later. and $entity->setPublished(FALSE); is also not working.

function MYMODULE_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $form['actions']['submit_unpublish'] = array(
    '#type' => 'submit',
    '#weight' => '-10',
    '#value' => t('Save as draft'),
    '#submit' => array_merge($form['actions']['submit']['#submit'],
    ['MYMODULE_draft_submit_callback']),
  );
}

function MYMODULE_draft_submit_callback(array &$form, FormStateInterface &$form_state) {
    $entity = $form_state->getFormObject()->getEntity();
    $entity->set('moderation_state', 'submitted');
    $entity->setPublished(FALSE);
    $entity->save();
}


texts: how can i create multiple recipients of status messages

texts:
Is there a way where I can share statuses to multiple recipients in Drupal7 using statuses module (microblog)
It would be great if someone can point me out how to send messages to any of relation only if I am using UR module.

Regards,
Yatendra


texts: How to close login-popup after successful login

texts:
I'm working on a FF-extension, that displays user-specific information on 3rd-party websites. Users need to be logged in to my Drupal-website. I'm checking login state with a cross-domain-proof jQuery.ajax(). If a user is not logged in, the FF-extension opens a popup-window (window.open()) showing a Drupal login/register/passwordlost page (/user/login).

Now I would like this window to close and the FF-extension to carry on, as soon as the login (registration/password-request) is successful. And now I'm lost. How would I do this?

I know how to close the popup from my FF-addon (window.close()), but I don't know how to tell the addon, when to do it. I thought of polling the login-state. But that seems kind of clumsy, no? I have also tried redirecting the drupal-page after successful login (login destination module) to a self-closing page, but in newer browsers window.close() works only on windows, that were created with the same script. And then I would still have to find a way to tell the FF-addon to proceed.

How do other people solve this?


texts:
I know this is simple. I have a callback function callback below:

function callback($id = '121-01927'){
    watchdog('print', '%message : Sample',array('%message' => $id), WATCHDOG_DEBUG, $link = NULL);
}

After executing the callback function, I viewed watchdog table in my database, and it says there.

%message : Sample

It seems my placeholder %message is not substituted by the variable $id. Where am I missing?


texts: CSV import ends up in unresolvable state

texts:
I'm having a problem with Feeds and Commerce Feeds in D7.

I am using Feeds and Commerce Feeds to import products into my Drupal Commerce store.

The CSV import was failing with a 403 error. Once this happened the import button was greyed out with text showing "importing 21% complete". Initially I cleared the message by running a delete and then reuploading. Now the delete tab has the same problem! It says "deleting 51% complete"

I have added a support request for this on drupal.org; but I think that the question may be better suited here as a "how-to" type answer would seem more appropriate.

Any ideas on how I can sort this out?


texts: Webform entries goes to Gmail Spam folder

texts: Any submissions from Webform goes to my emails (Gmail) Spam folder... I ask myself if I've configured something not right in the webform form settings... Please give me your valued opinion in the matter, Ben.


texts:
I need to create another widget which acts exactly like a text field, but contains a button and link next to the element. What's the best way to accomplish this?

I thought of:

Copying the Text Module (with the Field Module) and looking for the HTML.
Downloading the Autocomplete module and editing its markup.

I haven't really seen where the HTML for widgets is. Is this even possible?


texts:
I have fields added to Drupal 7 core users (Config > People > Account settings > Manage fields) which are common to multiple user roles.

I also have fields on a Profile2 profile, which I only want to display for people registering for that role.

I cannot find a way to show the core user registration fields before the Profile2 fields. Tried Manage Fields and Display Suite, but unless you show the Profile2 fields on ALL user registration forms (which of course I don't want to do, as these fields are only relevant to one role on the Drupal site) I can't reorder them.

Been looking for a solution for over a year. Profile2 project on Drupal.org won't answer, Profile2 Reg Path project on Drupal.org won't answer either. Totally stuck, and very surprised that I seem to be the only one with this issue. I have this issue on multiple sites now.


texts: Can get call work as post call to create node or login as a user in drupal 6 from external source like mobile app

texts:
I have setup a Rest server in my Drupal 6 site. I am able to successfully post new node and login as a user using method:POST from Rest client in Firefox. I want to do the same things using a get call.

I tried doing the following to login using GET method:

http://test.dabeastv2.gotpantheon.com/disk/user/login?username=sddfsg&password=sdf

It tells me that "there is no user with ID login"

Can someone please help me?.


texts: Creating a view that uses fields from two content types

texts:
I'm reeally struggling with this one. I just can't seem to wrap my head around the way Drupal and Views handles this pretty simple thing...

I have two content types:

Card
Card Content

Card has the following fields:

Title
Body
Display Order
Linked ID

Card Content has the following fields:

Title
Body
Linked ID

In Views, I would like to display:

Card Content - Title
Card Content - Body
Card - Display Order

If I were to write this as an SQL statement, it would be simple:

SELECT a.title, a.body, b.display_order
FROM card_content AS a
  INNER JOIN card AS b
    ON a.linked_id = b.linked_id

How do I achieve this?

Things to note: I originally had the Linked ID as a select box, taken from a set of predefined taxonomy terms. I have since migrated these to entity-references, that pull the data from the taxonomy terms (if that makes sense)?

EDIT: Okay, to clarify things a little...

Linked ID is a select box that's linked to a taxonomy vocabulary. This is purely to limit what a user can input.

As requested, here are screenshots of my Card and Card Content.


texts: How to distinguish between drush and HTTP request

texts: How can I distinguish whether a function is called from drush or by a real HTTP request?


texts: How to customize the 'node content links' block?

texts:
I'm using Organic Groups to make groups, and have made two content types to be added to the groups. I'm also using the OG extras module, so now I have the 'Node content links' block, where users may add content to the group. I want some of the users to see one of the links to create one content type, and the other users to see the other link to create the other content type.

How am I able to do this? Do I need to use organic group roles? If so, I'm unable to find out where I set this type of role for a member. I know where I can create them, but not assign them.


texts: How do I copy an already existing field in manage display?

texts: I have a field (entity reference) that is used to provide a link to another node. I want to have it two times in my "manage display" settings page, it's for redundancy. I don't want to create a new field, i just want a duplicate in the view mode. Is that possible? Maybe it's just hidden in plain view?


texts: Picture linked to user's profile in user-picture.tpl.php

texts:
D7: In my user-picture.tpl.php template I have the following code:

<div class="user-image">
  <?php
    $user = user_load($account->uid);
    print theme('image_style', array('style_name' => 'square', 'path' => $user->picture->uri));
  ?>
</div>

This short snippet sets the default, site wide, for the user picture.

When using views, linking the picture is easy. But when not using views, how can I change this so that the picture is linked to the user's profile?

Any help on this would be greatly appreciated. :)


texts:
I have a customized Calendar view. When I created the view using the template, it allowed me to select one field to be used as the date.
Is it possible to have multiple date fields, for example Due date, Start date, and Review Date? The node should show on the calendar for each date.


texts:
I am creating a simple module which will be sending HTML emails to users for deals in our website.

I have searched a lot, but I can't find a solution proper solution for Drupal. Now I can send mails but plain text.

What is a step-by-step procedure to send HTML emails in Drupal 7?

function example_form_submit( $form,&$form_state) {
    $friend_email=$form_state['values']['friend_email'];
    $mailto =$friend_email;  //gift to a friend
    $mailfrom ='no-reply@example.com';
    $subject = "another message for  HTML email from example.com";
    $body="
Hello EMAIL, i here i want to be bolded
";
    if (drupal_mail('example', 'send_gift', $mailto, language_default(),$params,$mailfrom,TRUE)) {
        drupal_set_message(t('Your gift was sent successfully!!!'));
    }
    else {
        drupal_set_message(t('Error occured while sending your mail!!!'));
    }

/****hook_mail*/
function example_mail($key,&$message,$params) {
    $language = $message['language'];
    switch ($key) {
        case 'send_gift':
            $message['subject']=t($params['subject'], $var, $language->language);
            $message['body'][]=$params['body'];
            $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
        break;
    }
}


texts: How to hook_form_alter() inside paragraph item

texts:
I would like to edit a field in the node_form of a paragraph item. For normal fields i would use something like the code below to tweak a field called field_p_custom_id (d7)

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
    switch ($form_id) {
        // tweak CONTENTTYPE_node_form
        case 'CONTENTTYPE_node_form':
            // hide custom ID field for all users, even admin (this field should never be changed)
            $form['field_p_custom_id']['#access'] = FALSE;

        break;
    }
}

... but, in the case of a paragraph item, the field_p_custom_id is placed inside a paragraph bundle. I searched inside $form and $form_state, but can't find where to alter this field. (the paragraph item is default not present on the form since it is not required and can be added unlimited times)


texts:
I have a drupal multilingual site (English and Arabic) . Arabic page site search gives me an extra value "English" in search result. I am using default drupal site search.

What it actually means? How can i remove this?


texts: Commerce 2 checkout login pane conflict with registration form

texts:
I just encountered strange problem. I am using drupal 8 commerce 2 default "login or guest or register pane"

When i try to login with existing user it validate registration required field. Please see screenshot


texts: Creating a list of reference links, added by users

texts:
How would I create a  list of links that would reference internal and external links. The links would be apart of a node(a page)

Here's what I want. A user would have a way to "ADD a link" to the list. The list would be a node like a page. Once this link is added to the page, it will show a link not URL and would be Alphabetically indexed. The list would be in a table and have a pager to prevent overflow.

My thinking is that what I want is a module to accomplish this. Any ideas?

Thanks!


texts: How to override default cardinality for the field widget?

texts:
I've custom widget which consist multiple input elements in hook_field_widget_form() as part of one field (like address field).

The problem is that Drupal complains about:

  this field cannot hold more than @count values

which happens in field_default_validate(), when I've multiple input filled, so it doesn't recognise that this is one single field.

I've tried to change my cardinality in every possible place as below, but without success:

/**
 * Implements hook_field_info().
 */
function my_address_field_field_info() {
  return [
    'my_address_field' => [
      'label' => t('My Address Field'),
      'settings' => array('cardinality' => FIELD_CARDINALITY_UNLIMITED),
      'instance_settings' => array('cardinality' => FIELD_CARDINALITY_UNLIMITED),
      'default_widget' => 'my_address_field_widget',
      'default_formatter' => 'my_address_field_default',
      'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    ],
  ];
}

/**
 * Implements hook_field_widget_info().
 */
function my_address_field_field_widget_info() {
  return [
    'my_address_field_widget' => [
      'label' => t('Default'),
      'field types' => ['my_address_field'],
      'settings' => array(
        'size' => 60,
        'cardinality' => FIELD_CARDINALITY_UNLIMITED,
      ),
      'behaviors' => array(
        'multiple values' => FIELD_BEHAVIOR_NONE,
        'default value' => FIELD_BEHAVIOR_NONE,
      ),
      'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    ],
  ];
}

/**
 * Implements hook_field_widget_properties_alter().
 */
function my_address_field_field_widget_properties_alter(&$widget, $context) {
  $widget['cardinality'] = FIELD_CARDINALITY_UNLIMITED;
}

/**
 * Implements hook_field_formatter_info().
 */
function my_address_field_field_formatter_info() {
  return [
    'my_address_field_default' => [
      'label' => t('Default'),
      'field types' => ['my_address_field'],
      'multiple values' => FIELD_BEHAVIOR_DEFAULT,
    ],
  ];
}

/**
 * Implements hook_field_widget_form().
 */
function my_address_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {

  $widget = array();
  $widget['label'] = array(
    '#title' => $instance['label'],
    '#theme' => 'form_element_label',
  );
  $widget['address_line_1'] = array(
    '#type' => 'textfield',
    '#title' => t('Address line 1'),
  );
  $widget['address_line_2'] = array(
    '#type' => 'textfield',
    '#title' => t('Address line 2'),
  );
  // more text fields here ...

  return $widget;
}

Including defining hook_field_validate which I thought it'll override default field validation handler, but this was not the case.

What's the right way of assigning unlimited cardinality for my widget?


texts: Display comma-separated list of taxonomy terms?

texts:
Drupal 7.

In my node.tpl.php, I want to print out a list of taxonomy terms (the taxonomy is called "channels.").  If I use:

<?php print render($content['field_channel']); ?>

It works, obviously, but the best I can do to get them inline is to use CSS to float them left. I would like them to be separated by commas.  Any ideas?

Thx.


texts: My time field shows after an expired date. My client wants to have the time hidden after the expired date. But still have the date show. Is this possible?


texts: How to implement a node limit per taxonomy term?

texts:
I created a Taxonomy with a "Limit" field, so that I can add term within "limit" number. Here is a screenprint of it:

My question: How can I limit the number of nodes that are using each term, so that the 'count of nodes' (= number of nodes that are using some term) can't be above this "Limit" field?

UPDATE: I try @Pierre.Vriens Answer and i think still not working..


texts: Sub level menu in sidebar (but in specific pages)

texts:
How can i display sub level menus in sidebar?

For example: I have a Menu 1 (M1) with SubMenus (SubPage 1, SubPage 2, SubPage 3, SubPage 4) and I want that submenus displaying in sidebar just when clicked in Menu 1 (M1) and other submenu associated with menu 1.

And, when clicked in Menu 2 (M2), I want to display just the Submenus associated to Menu 2

Example image

:

Thank you in advance


texts:
I'm currently working on a multi lingual site that contains 2 languages. (EN & DE)

Most nodes are translated, but when I edit an DE node, my interface remains in EN, which leads to some very weird stuff happening when you save, some of the node references disappear. (Because they are in another language)

In my configuration 'Switch interface for translating' is switched on, but it still doesn't switch when editing a node in another language.

Is there something I'm missing?


texts: Webform override only certain groups of fields in webform-form template

texts:
My question is about overriding webform-form.tpl.php.
I am using Webform 4.x-beta1 and Twitter Bootstrap framework. I would like to reuse bootstrap classes in my form to make it responsive. I got already how the override works. I would want to find out is it possible to only override the markup of certain groups of fields, for example to put 3 fields that are in the middle of the form inline using row-fluid class in the wrapper div, without changing the placement of these fields.
Ex:
---some fields that don't need to be overwritten---
---3 overwritten fields----
---some other fields keeping the correct order---
---2 overwritten fields---
etc.
My form is about 100 fields, and as far as I understand, I will have to revisit each and every field in order to achieve what I need.
I am sorry if I mixed you up in my explanation, I am pretty new to Drupal.
Thank you in advance


texts:
I am working with a Drupal 7 site locally that we have setup with OAuth2. Logging in works fine on our staging server, our QA server, and another guy's MacBook Pro.

On mine, however, I see an error that is thrown by the OAuth2 Client module in its getToken() function.

  Failed to get an access token of grant_type authorization_code. Error: Error opening socket ssl://staging.api.MYSITE.com:443

My system is using PHP 5.6. I am on a Mac running 10.10.

Any thoughts?