texts: Would I be in "Blacklist" to send bulk mail by Simplenews?

texts:
We have thousands of subscribers who sign up through our Simplenews. Now, we would like to send newsletter(eblast) through Simplenews with Simplenews Content Selection too all subscripbers. Will our server getting "blacklisted" by doing this?

PS: The newsletter has unsubscribe URL on footer


texts: Boost won't work after configuration of .HTaccess

texts:
Preliminary data

It seems I've configured .HTaccess right, as required by the following guide to installing Boost, But it also seems the module doesn't work.

What I did was to copy my .HTaccess auto generated rules from admin/config/system/boost/htaccess/generator and paste it exactly instead of the sentence "-------paste the rules right here--------" mentioned above, but I don't know if that was the true intention of the author...

Anyway, the final outcome is this:

# RewriteBase /

### BOOST START ###

# Allow for alt paths to be set via htaccess rules; allows for cached variants (future mobile support)
RewriteRule .* - [E=boostpath:normal]

# Caching for anonymous users   # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR]
RewriteCond %{HTTPS} on [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [S=3]

# GZIP
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=1]
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1]

# NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

### BOOST END ###

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Why I'm assuming a problem?

On one hand, Drupal's CRON tells me Boost installed correctly, should be working if properly configured. On second hand, while surfing from another browser anonymously, I checked page source (CTRL+U), But didn't the famous message (as HTML note):

  Page cached by Boost @ YYYY-MM-DD HH:MM:SS, expires @ YYYY-MM-DD
  HH:MM:SS, lifetime X hours

Therefore, I assume a problem. Now, as Shawn instructed in the comments below, I turned on the Boost debugger, went to Reports > Recent log messages, and then saw two interesting errors:

First error:

Array
(
    [cache_this] =>
)

Second error:

This error is to long to be pasted here, but it seems to do something with Drupal's Autocomplete mechanism.


texts: How to apply spam filter into signatures?

texts: The spam module, does not seem to examine forum signatures against custom spam filters. Spammers have figured this out and just pour their junk links into their signatures. I am wondering how can I fix this loophole.


texts: How can I change the default link to the email contact form?

texts:
I'm trying to change the default link generate by the email_field module so It shows an image instead of the text (Contact person by email).

I went into the module and foun the part I need to change, but because I'm new to drupal and php I have no clue how to change it...

The code I think I need to override:

function email_field_formatter_view($object_type, $object, $field, $instance,    $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {

    case 'email_contact':
      $ids = entity_extract_ids($object_type, $object);
      foreach ($items as $delta => $item) {
        $element[$delta] = array('#markup' => l(t('Contact person by email'), 'email/' . $object_type . '/' . $ids[0] . '/' . $instance['field_name']));
        // Since email is always sent to first item's email, break after any email address found.
        break;
      }
      break;
  }
}

The contact person by email is the part I want to change to
'< div class="email_image">< /div>'

Anyone who can help with this? Or knows where I can find some help?

Thx up front.


texts: Notice: unserialize(): Error at offset XX (removing Paragraphs)

texts:
I'm trying to remove Paragraphs and modules related to it manually (because I can't remove it completly from admin page).

I'm using UTF8 without BOM in Notepad++ when editing key_value BLOB file that I get form PhpMyAdmin and I see that error in my site:

Notice: unserialize(): Error at offset 76 of 42499 bytes in Drupal\Component\Serialization\PhpSerialize::decode() (line 21 of core\lib\Drupal\Component\Serialization\PhpSerialize.php).

My DB is in utf8mb4_general_ci. The change that I made into key_value table is removed a orphaned field and subtracted a value from the initial counter (a:37 to a:36 from that BLOB data).

I saw some php code related to serialize/unserialize but I think this problem could be solved from PhpMyAdmin without modifying core files. Looking for some hint.


texts: How do I embed a vimeo video into the body field. The iframe is being removed in my input format. How do I add it?


texts: Query pager not showing for administrator

texts:
I am having an interesting problem with paging the results of a query. The pager is visible to all users except those who are assigned the built-in 'administrator' role. I have tried the code on two separate Drupal installs and the result is the same: the administrator cannot see the pager. The markup is not visible in the page source.

I have tried my solution using both EntityFieldQuery and db_select, but the problem persists. Here is the code for the EntityFieldQuery version:

function build_area_table() {
  $header = array(
    'area_name' => array(
      'data' => 'Area',
      'type' => 'property',
      'specifier' => 'title',
      'sort' => 'asc',
    ),
    'level_range' => array(
      'data' => 'Level range',
      'type' => 'field',
      'specifier' => array('field' => 'field_area_level_range', 'column' => 'value'),
      'sort' => 'desc',
    ),
  );

  $query = new EntityFieldQuery();
  $query = $query->pager(5); # I have more than 5 rows being returned
  $query = $query->entityCondition('entity_type', 'node')
    ->propertyCondition('type', 'area')
    ->propertyCondition('status', 1)
    ->tableSort($header);

  $result = $query->execute();

  $nodes = null;
  // $result['node'] contains a list of nids where the title matches
  if (!empty($result['node'])) {
    // You could use node_load_multiple() instead of entity_load() for nodes
    $nodes = node_load_multiple(array_keys($result['node']));
  }

  // do something to output your results here.
  $td = array();
  foreach ($nodes as $area) {
    $td[] = array(
      'area_name' => array(
        'data' => l($area->title, 'node/'. $area->nid),
        'class' => array('area-name'),
        ),
        'level_range' => array(
          'data' => $area->field_area_level_range['und'][0]['safe_value'],
          'class' => array('level-range'),
        ),
    );
  }

  $areaTable = array(
    'area-table' => array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $td,
      '#empty' => 'No areas to display.',
    ),
    'area-pager' => array(
      '#markup' => theme('pager')
    ),
  );

  return $areaTable;
}

The table is rendered using Drupal 'render' in the template page. Does anyone have any ideas as to what the problem may be? I have read some posts regarding changing the pager ID, but any changes I make do not seem to have any effect.

EDIT: I am not using the Views module, which seems cause a conflict with pagers as reported by many other people.

Thanks!


texts: services userpoints with xmlrpc server can't be linked by external device?

texts:
I had searched the article, and i still can't figure out how to use services userpoints with xmlrpc.(My Environment drupal 7,Service 3.x, userpoints )

i read the readme in the userpoints module.

$result = xmlrpc($server_url, 'userpoints.points', $key, $uid, $points, $tid, $event, $description);

i wrote this code in the other sites,and tried to add/subtract the points.It doesn't work.

I tried function xmlrpc() in drupal API and follow the api rules, it doesn't work either.
drupal api function: xmlrpc($url, $args, $options = array())

the code i wrote:

$key='1234';// casually set
$uid=1;
$points=1;
$tid=18;
$event='event testing';
$description='description testing';
$result = xmlrpc('http://my.domain/userpoints-api/', array(
  'userpoints.points' => array($key, $uid,$points,$tid,$event,$description),
));
dpm($result);

$result is nothing.
Does anybody have the experience on this?
Thank you guys.
Please help me.

i check the access.log
i got the message belowed

210.65.11.209 - - [23/Aug/2013:15:49:50 +0800] "POST /userpoints-api/add HTTP/1.0" 200 767 "-" "Drupal (+drupal.org/)


texts: How to create a automatic Field value number to display in the lable for an custom content type: Itinerary e.g Day 1, Day 2

texts:
I have a content type which I've called Itineraries which lists activities users will do on certain days of the package. I've created a 'day' field which the admin will populate with each day's activities, the value is set to unlimited as some packages have 7 days and others 21 days - how do I get the label of each field to automatically set to the number of values sumbitted by the admin ?

So if the admin enters 3 values it should display the label for each submission as -
Day 1 :
fishing, running ...
Day 2:
camping
Day 3:
drive home

I've looked at the Computed field but lack the php knowledge to implement.

Is there another way of implementing the above ? Thanks for the help in advance.


texts: How to force forms only through your own submit functions?

texts:
If I want a custom submit handler, the usual answer is to add the function call to $form['#submit'], and if need be, $form['actions']['submit']['#submit']. The standard warning is do something like

$form['#submit'][]='my_handler';

instead of

$form['#submit']='my_handler';

because you generally want the form submission to still go through the core form submission handlers.

I have a case where I need to completely manage the form submission process and don't ever want the form to be passed to the core submission handlers. To test that I could do this, I have:

global $user;
module_load_include('inc', 'node', 'node.pages');
$node_form = new stdClass;
$node_form->type = 'my_content_type';
$node_form->uid = $user->uid;
$node_form->name = (isset($user->name) ? $user->name : '');
$form = drupal_get_form('my_content_type_node_form', $node_form);
$form['#submit']='';
$form['actions']['submit']['#submit']='';
$render($form);

I would have thought that since there are no submission handlers, the form shouldn't submit, or even if the page reloaded due to the action attribute in the html form element, that the content wouldn't be added to the database.

But it is.

So how can I keep Drupal from processing a submission through the normal core submission handlers, but still process through custom handlers? (I already know how to write custom form submission handlers, so that's not part of this question.)


texts: Entity Reference widget selctor in view referring same reference

texts:
I searched for a solution but I didn't get it right.
Given my setup:

A content type Service, referring a content type Agency
A content type Agency
A content type Person, referring a content type Agency

Now I need to add an entity reference in Service referring some of the Persons. The list of persons needs to be limited to the persons in the same Agency (of the service).
I'm using an entity reference view to generate the list of the widget.
I tried fetching the list of the person, using contextual filter(nid) and relationship but i didn't manage to make it right.

Therefore I'm asking for help. How should I setup the view?

Thank you all


texts: How to setup Advanced Content Filter to not remove drupal-entity tags?

texts:
I use CKEditor to create content. And Media Plugin to upload and manage images.

Now I have a problem that as soon as I activate Advanced Content Filter in CKEditor settings, my images are removed. I think problem is, that they are implemented like this:

    <drupal-entity class="media-element" data-entity-embed-display="image:image"
        data-entity-id="2589" data-entity-type="file" data-fid="2589"
        data-media-element="1"></drupal-entity>

I tried to insert drupal-entity in extra allowed content, but it doesn't change anything.

As long as I do not save this node with activated ACF the images are shown on my website. This is because first I created nodes with deactivated ACF.


texts: What's the difference between $user login and access?

texts:
I'm migrating users and I came across the $user object.

What's the difference between the login and access field? Does access get updated with every page request?


texts: Content status, view different fields, different roles

texts:
I want to know if there are any modules for the following situation:

User X of role A creates a case (special node type). If user Y logs on (of role B). He sees a case has been submit. He then can add pictures to the case (user X can't do this, he doesn't have the rights). Once that is done User X will see a the new node and can check out the pictures (but can't change them, or delete). And so on untill the case has the status closed.

I've looked at some modules for this and the Workflow module seems to lack what I want to do here.

I'm pretty sure people must have done something similar to this so that's why I'm asking.

Modules I know i'll have to know:

Views (to get my lists of a content type with a certain status)

Is this possible at all in Drupal? Worst case scenario is that I'll extend a node with my own entity and keep the node id, and programatically change the state of the node and let users add pictures.

Thanks for reading!


texts: What is the best way to alter image style in view for a teaser

texts:
I have an image style set for all my nodes for teasers.  There is one view that I need it to display differently.  Is there a way I can alter in code?

I know that I can just change my setting from Content to Field and modify the image style that way but I am looking for a way that I can do it in code.


texts:
I have 2 address fields : Res. addr and Permanant addr.
On clicking another field : same as above

I want to copy all the values entered in Res. addr to Permanant addr.

Please let me know how to do it?

Thanks,
ronforever


texts: How to grant userpoints to users who perform a login 5 days consecutively?

texts:
I need to know if a user has performed a login, for example, 5 days consecutively. The reason for this is I want to award User points to them.

For example:

User A performs a login on Monday, Tuesday, Wednesday, Thursday and Friday. (granted 10 points)
User B performs a login on Monday, Tuesday, Thursday, Friday and Saturday. (no points)

I'm trying to do this with Rules but failed miserably. Any ideas?

Note: I'm trying to use Rules condition to compare my_last_login values against today's date with an offset of -1 days but it always return False.


texts: replace template with other when conditions are met

texts:
I want to add a record do theme_hook_suggestions variable but only when specific conditions are met, especially when system is going to use a specific template in theme. In effect I want to replace one template with other.

I.e. - when user sees node with id = 50 and view mode == teaser and user has set some specific parameters system should use template node-special.tpl.php. In any other condition system should use base template node-50.tpl.php

I cannot do this, as far as I understand, in any *preprocess or *process functions basing on variables because there is no information available about what template are candidate for use.

How can I achieve this?

EDIT, more detailed explanation:

I'm trying to build a A/B testing system for e-commerce site I run.
I want to set a A/B test where for selected base template a new variant will be defined and for chosen group of users this new variant will be used. I want to have a universal solution where I could configure this just by one line of code. It should work both for nodes, fields, blocks, pages templates. I just simply need to substitute one template field with another.

ie I want to have a universal config:

$ABconfig = array(
        'ABbigrelated' => array( //test name
                'basetemplate' => 'related-nodes', //base template
                'newtemplate' => 'related-nodes-bigimages', //new template
                'GAdimensions'  =>  'dimension2' //config for googleanalitics

        )
);


texts: How to define another data table to join for views (ie from csv file)?

texts:
I successfully created two Views query plugins by learning from XML Views. My plugins query a YAML, and CSV file; they are both base view types on their own.

Now I want to learn how to join tables. (The following assumes a minimal views module skeleton called csv_views, I deleted the query plugin class I mentioned before.)

I thought of a fix table (i.e. a CSV file) that is queried without any additional features. I want to join it to a node table, let's say via title field, both in node (node title) and a column in the CSV file.

What do I need to define in mv csv_views.views.inc? For now it contains the following:

function csv_views_views_data() {
  $data['csv']['table']['group'] = t('CSV');

  $data['csv']['table']['join'] = array(
    'node' => array(
      'left_table' => 'node',
      'left_field' => 'title',
      'field' => 'title',
    ),
);

  return $data;
}

Is a field handler necessary?

In which class is the table query execution method defined? Is there a views module I can examine to learn that?
AFAIK all modules which provide tables to be joined use real database tables.

I use Drupal 6 because that is the Drupal version required by XML Views works, but I want to know Drupal 7 too and I could also settle to views 2. I guess it's still the main Views version, right?


texts: Add 'Or Condition' to specific field in Entity Query

texts:
I'm building an entity query and I would like to check if one field contains one string or another. I'm building the query like so.

$searchname = 'test';
$searchtype' = 'type_1';

$query->condition('status', NODE_PUBLISHED);
$query->condition('field_type', $searchtype);
$query->sort('created','DESC');

However I'd like to check if field_type is either $searchtype or 'both'
I attempted to do so using an orConditionGroup like so

$orCondition = $query->orConditionGroup();
$query->condition('status', NODE_PUBLISHED);
$orCondition->condition('status', NODE_PUBLISHED);

$query->condition('field_type', $searchtype);
$orCondition->condition('field_type','both');
$query->condition($orCondition);
$query->sort('created','DESC');
$nids = $query->execute();

However it acts like the orCondition isn't being considered at all. Using $orCondition it still does not produce nodes that have 'field_type' = 'both'. How would you go about checking whether a field contains one string or another in an entity query?

UPDATE: I added the field name to the or condition because I figured I would need to add it to both if I want it checked in both conditions. If there's a way around that, that'd be even better.

UPDATE 2:  I made a second attempt using this code but I receive a 504 Timeout error when loading the page

$searchtype = 'test';
$query        = \Drupal::entityQuery('node');
$conditionOne = $query->orConditionGroup();
$conditionTwo = $query->orConditionGroup();

$conditionOne->condition('status', NODE_PUBLISHED);
$conditionTwo->condition('status', NODE_PUBLISHED);

$conditionOne->condition('field_type', $searchtype);
$conditionTwo->condition('field_type','both');

$query->condition($conditionOne);
$query->condition($conditionTwo);
$query->sort('created', 'DESC');
$nids = $query->execute();

What I'm ultimately trying to accomplish is this logic

(status = true) AND (field_type = 'foo' or 'both')


texts: Commerce Kickstart: How to fix duplicated order lines appearing in Commerce Backoffice?

texts:
A site running Commerce Kickstart is occasionally finding duplicated order lines appearing in 1.) Backoffice 'quick edit' view and 2.)in the pdf output found in invoices generated by Commerce Billy module.

The duplicated item is a 'ghost' and does not form part of the order, nor does it contribute to the order total. A double check of the order at admin/commerce/orders/#ordernumber/ confirms that the duplicated item should not exist.

The error is intermittent and only effects a small pre-portion of orders placed.

I am presuming that Backoffice and Commerce Billy derive their data from the same place and I am unsure what is triggering this problem.

So the question is 'what is going wrong and how do I fix it?'

Screenshot below 1.) Quick edit view 2.) Full edit display.

As can be seen the second item is a duplicate and is not included in the order total.


texts: How can I have the table headers repeat throughout the view results for every X results?

texts: I have a view that has a lot of columns with numbers in it and about 200 records in it.  As I view the results and scroll down, I forget what each column's title is.  Is there a module or other way to have views include the table headers ?


texts: Render filename of file upload field in node template

texts:
I have a field for uploading a file. And in *node--content_type.tpl.php* I want to just print the filename of the uploaded file.

So far I have this

$node = node_load($nid);
//get field item in correct language
$item = field_get_items('node', $node, 'field_file_upload');
//get field_file_upload value
$output1 = field_view_value('node', $node, 'field_file_upload', $item[0]);
print render($output1);

But it renders a link to the download and a thumbnail of the download type.

I want to just print out the filename. I tried using:

$output2 = field_view_value('node', $node, 'field_file_upload', $item[0]['filename']);
print render($output2);

But this renders a thumbnail of the download type e.g PDF icon rather than showing the filename.

The printed array for $output1 is:

Array
(
    [#theme] => file_link
    [#file] => stdClass Object
        (
            [fid] => 196
            [display] => 1
            [description] =>
            [uid] => 1
            [filename] => drupal-7-theming-cheat-sheet.pdf
            [uri] => public://drupal-7-theming-cheat-sheet_0.pdf
            [filemime] => application/pdf
            [filesize] => 224804
            [status] => 1
            [timestamp] => 1348746651
            [type] => undefined
            [rdf_mapping] => Array
                (
                )

        )

    [#access] => 1
)

The printed array for $output2 is:

Array
(
    [#theme] => file_link
    [#file] => stdClass Object
        (
            [scalar] => drupal-7-theming-cheat-sheet.pdf
        )

    [#access] => 1
)

Any ideas? Thanks for your help!


texts:
I am new to namespaces and I am practicing with Drupal 8. I have created a custom module and have installed the contrib, devel.
Inside my module, I have defined a block.
namespace Drupal\twitter_pull\Plugin\Block;
use Drupal\block\BlockBase;

/**
 * Provides a block for executing PHP code.
 *
 * @Block(
 *   id = "twitter_pull_tweets_block",
 *   admin_label = @Translation("Twitter Tweets")
 * )
 */
class TweetsBlock extends BlockBase {

  /**
   * Builds and returns the renderable array for this block plugin.
   *
   * @return array
   *   A renderable array representing the content of the block.
   *
   * @see \Drupal\block\BlockViewBuilder
   */
  public function build() {
    dpm(array('this','is','a','test'));
    return 'this is a block';
  }
}

It works fine. Why do I have access to the devel functions? Where in my code do I include the namespace for devel that I should have access to dpm()?


texts:
I have 'Theme A' and 'Theme B'. The only difference between them is colors.css.

If I want to add Theme B, I have to copy the entire theme folder, change the info file and correct the name of the theme hooks in my .tpl files.

Is there a way I can have my second theme inherit all the files from Theme A (or just make 'theme A' use a different colors.css when user wishes to do so)?

Point of this is to make theming more easy for the end user, so that they just have to upload theme_b.info and colors.css?


texts: adding drop-down subject (html select) to contact form

texts:
I would like to add a select field like a drop-down in the contact form to let user select the reason why they contact (contact, customer support, etc.)

Based on this (excellent) answer Adding check boxes to contact form, i’ve managed to create a field with check box :

source : Adding check boxes to contact form

How can i do that with a select ?

Solution :

You can choose in the "manage form display". The column "widget" allow to choose "Select list" (see screenshot)


texts:
I've been having problems with one of my Drupal sites and have narrowed the problem down to the Views module. In my Apache error log, I see this:

  [Tue Oct 18 09:57:08 2011] [warn] mod_fcgid: stderr: PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /home/lakedistrict-holidayideas/public_html/sites/all/modules/contrib/views/handlers/views_handler_filter_in_operator.inc on line 206

Looking at the views_handler_filter_in_operator.inc file, I see this on line 206:

 $form['value']['#dep

Does that appear to be a normal line of code? To my untrained eyes, it looks incomplete.

I've reinstalled the module, but the problem remains.

If it appears to be that there's a problem with the module, I'll make a post on the Views issue queue on Drupal.org.


texts: Use a view page as child page in every content drupal 7

texts:
I created a content type libro and a content type capitolo. In type capitolo there's an entity reference to libro.
I would like to create a child page /capitoli so that in

  example.com/A/capitoli

all type capitolo linked with libro A are shown, in

  example.com/B/capitoli

all type capitolo linked with libro B are shown

and so on for every libro.

I've already prepared a view page that shows all capitoli taken from contextual filter nid, taking it from URL, even if probably it's not the right way to approach this. I'm using Drupal 7.
Sorry for my bad English and for the bad description of the problem

---First Edit---

Ok i modified url alias so that now a libro1 object has as url www.example.com/libro/libro1, but it is still not working. I post here how i did my view:

Fields
Content:title(Capitolo)

Filter criteria
Contenuto: Pubblished (Yes)
Contenuto: Type (= Capitolo)

Path : /libro/%/capitoli

Contextual filters
(Content entity referenced from field_libro) File Usage: Entity type (as suggested in answers)

I even tried to add a relatioship

Relationships
Entity Reference: Libro

and use that in the contextual filter, but it is still not working.


texts: How to hide country in Address Field display?

texts:
Using Drupal 7 with Address Field module.  How to prevent the country part of the address field from displaying on a node with an address field?

For example, address is:

123 Main St
Somewhere, NY 10001
United States

I want the node to show:

123 Main St
Somewhere, NY 10001


texts:
I am writing a custom rule, I do not know how to approach getting the correct URL for the redirect.

I have a page - website.com/content/newsletter-activity-001 that needs to redirect an anonymous user to website.com/content/activity-001 until they are logged in.

I have a reference field in 'newsletter-activity-001' that holds the title to 'activity-001'. I want to write a rule that will apply this for newsletter-activity-002 and so on as the site content grows.

How do I dynamically pull that url out and place it into the redirect path? Would tokens do it?


texts: How to i programatically change the page thats loaded from hook_init?

texts:
I am in the process of building a drupal module that will block access to certain IP addresses, i've built the whole thing and it works a treat except from one area of functionality; i would like to be able to redirect blocked users to a node.

The code that i have does everything except display the node:

if (variable_get('lock_denied_response_type') == 2){
  $node_id = variable_get('lock_denied_node');
  $node = node_load($node_id);
  $node_view = node_view($node, FALSE, TRUE);
  drupal_render_page($node_view);
  exit;
}
else{
  echo variable_get('lock_denied_html');
  exit;
}

I've scanned google, stack overflow etc but not much luck. So far as i can tell, it appears my approach is wrong and rather than triggering my own render page, i should just change which node the standard rendering process uses, something like this:

if (variable_get('lock_denied_response_type') == 2){
  $node_id = variable_get('lock_denied_node');
  /* insert awesome node override code here */
}
else{
  echo variable_get('lock_denied_html');
  exit;
}

Suggestions?

Cheers!


texts: Install a theme with its demo content -- via command line?

texts:
The tutorials I've seen all want me to use phpMyAdmin. Here is an example that's very apropos since my theme is Zircon.
https://www.weebpal.com/guides/step-step-guide-install-drupal-8-theme
AFAIK I don't have MyPHPAdmin and I don't have access to it. What I do have is sudo access on the Ubuntu 16.04 server.
I'm using Drupal 8


texts:
I have been trying unsuccessfully to alter the text of the message in the bulk submit.
The code, place inside _views_bulk_operations_direct_process ,producing the message is:

$context['results']['log'][] = t('Performed %operation on @items.', array(
  '%operation' => $operation->label(),
  '@items' => format_plural(count($entities), '1 item', '@count items'),
));

How can I modify this? The message is displayed on any change made on the bulk view by the edit form(hook_form_views_form_og_members_admin_default_alter).


texts: How to get and apply current page query parameters from current AJAX request

texts:
I'm having a hard time figuring out how to do this.

Essentially I have a table displaying users on a page. The table is paginated with the PagerExtender and sortable with the TableSortExtender.

Each user row has links with "use-ajax" classes; these links perform actions on the user, and then rebuild the current table after performing those actions -- this happens all in AJAX.

The problem I am having is, when I rebuild the table in AJAX, the current request is the request for the AJAX action, and not the request which built this page. This means when the table is rebuilt via AJAX, the pager and sort settings are lost and you are reset to the first page, without any sorts.

I have found code somewhere to pull the previous request, and get the URL and parameters, but I don't know how reliable this is or how to implement it:

$current_request = \Drupal::request();
$previous_url = $current_request->server->get('HTTP_REFERER');
$previous_request = Request::create($previous_url);
// $url_object is a Url with the previous page paramters and URL
$url_object = \Drupal::service('path.validator')->getUrlIfValid($previous_request->getRequestUri());

The problem with the above is:

I don't know how reliable the HTTP_REFERER will be
I don't know how to add the previous page request parameters to the current request, so the table is rebuilt properly
If the previous request is NOT the request that built the table/page, I'm stuck again

Is the solution always passing the previous request URL and Params with every AJAX request I make? I feel like someone has solved this somewhere or somehow but I am just lost in this area in Drupal 8, and have been beating my head constantly trying to figure out how to refresh parts of a page in an AJAX request.

EDIT: I am not certain the best place to put the "completed" code, but thanks to 4k4 I've put the following together:

  // create url object from route to render link
  $my_url = Url::fromRoute('my_module.my_route', array('param' => $value));
  // get the current query parameters for our page
  $query_options = \Drupal::request()->query->all();
  // add them to our Url
  $my_url->setOption('query', $query_options);


texts: Permit user roles to see node (not via view) based on a taxonomy

texts:
I have some content type with a term reference field (think a magazine site where news are linked to a category).

I must block the node view for a user role, but I don't want to set this access for single node (like tac/tac_lite do), but for single category linked to the node (via term reference field). For example I want that role "FOO" can see node of category "BAR" but not nodes of category "XYZ", where "BAR" and "XYZ" are terms od f the same vocabulary.

My idea is this:

add a select list field to the vocabolary's fields (and the allowed
values will be the role's ID) so that I can link role to each
category/term
when a user try to access to a node, I check (via hook_node_access() ) that current user's role is available in the node's category fields (that I have setted in previos step).

Is there a better way ?

M.


texts: How to remove a fieldset from around a Mailchimp Subscription field?

texts:
I have added a Mailchimp Subscription field to an entity form using the Mailchimp module. I'm having difficulty in removing the fieldset around this subscription field.

I have installed the Devel module and used the dpm function to display info on the form. But I can't seem to find what theme function I need to override to remove the fieldset.

I have an existing form alter applied to this form, what would I need to add to my existing form alter to remove the fieldset around the field?


texts: How to create an RTL CSS file (style-rtl.css) for Drupal modules

texts:
Say I have a "style.css" file for a module, and that file contains the following syntax:

.myCalss1 {
  right: 10px;
  margin: 0 5px 0 0;
}

I then create an extra file, "style-rtl.css" with the following syntax (flipping of the previous):

.myClass1 {
  right: initial;
  left: 10px;
  margin: 0 0 0 5px;
}

How can I make the system prefer the RTL file?


texts: Can't modify Content Access in Media Gallery Module

texts:
I've got the Media Gallery module installed and want to control the access to it using the Content Access module but can't find how to do that. I get an "Access Control" button on all my other regular pages but don't on the Media Gallery pages.

It sounded like there was an issue with permissions with Drupal 7.2 http://drupal.org/node/1147906 but it was fixed in 7.3. I'm running 7.8 right now. Thanks.


texts: How can I print a field from a referenced entity in my theme?

texts:
I'm trying to print a field from an entity reference field - but I don't have a clue how to do it!

A bit of background: I've got two content types - master and variation. Variation includes an entity reference field, pulling in fields from the referenced master. But they share an image field. When the variation's image field is empty, I need the master's to display in its place. On the other hand, if the variation's image-field is in use, the masters needs to be hidden. My first thought was to use a display mode, but as you can see I need a little more flexibility than that.

So the details.

A dpm($node) on a variation node gives me:

... (Object) stdClass

field_master_reference (Array, 1 element)

--und (Array, 1 element)

----0 (Array, 3 elements)

------target_id (String, 2 characters ) 11

------entity (Object) stdClass

--------(list of lots of strings which I'll leave out for concision)

--------field_country (Array, 1 element)

--------field_publisher (Array, 1 element)

--------field_catalog (Array, 1 element)

--------field_main_image (Array, 1 element)

----------und (Array, 1 element)

------------0 (Array, 13 elements)

--------------fid (String, 2 characters ) 10

--------------alt (String, 0 characters )

--------------title (String, 0 characters )

--------------width (String, 3 characters ) 518

--------------height (String, 3 characters ) 360

--------------uid (String, 1 characters ) 1

--------------filename (String, 21 characters ) testimage99_r1_c1.png

--------------uri (String, 38 characters ) public://masters/testimage99_r1_c1.png

--------------filemime (String, 9 characters ) image/png

--------------filesize (String, 4 characters ) 4627

--------------status (String, 1 characters ) 1

--------------timestamp (String, 10 characters ) 1366482521

--------------uuid (String, 36 characters ) 67gf4dbb-0a37-4ee9-893e-6g51e3et33c1

------access (Boolean) TRUE

(miscellaneous other fields which I leave out)

I've bolded the relevant structure. From it, how do I print field_main_image (as a fully rendered image)? Sincere thanks to anyone who can help me with something that has perplexed me since Wednesday.


texts: How do i show a not-equals operator for rules while setting up commerce shipping conditions?

texts: I am setting up my commerce shipping conditions and i need a NOT Equal operator so i can target all international countries. how can this be done?


texts:
I'm trying build a custom page for my content type with Views. What I've done so far:

Created a grid display type template, I change columns to bootstrap columns;
Hooked up a a template for teaser node--tutorial--teaser.tpl.php in template.php file.

What I would like to do next:

Modify print render($content);
Arrange my node teaser fields in this order: image, title, summary, other fields.

However, title seems to be seprated from content and not avaible as a field in teaser display settings.

How can I modify content output to include title and modify it's markup? What's the best way of acomplishing what I need?

Thank you

EDIT: Thanks to everyone for suggesting DIsplay Suite, but really after trying it out it just makes things more confusing... I'd much much rather assign some variables in a php files and arrange them the way I want in a template file.


texts:
Using menu token I have created a menu as shown in figure

I also have sub-menu items for this menu. Whenever the user clicks on this menu, the page is being refreshed (which is the obvious behavior), but I don't want any sort of action on the menu. In simple HTML we can do my simply using href="#", but Drupal is not allowing to set the Path of the menu to #. Is there a way to do it?
I also tried Menu attributes to do it, but I seem to be missing something.


texts:
I am trying to add a script code on all but few pages. I tried the following code on the template.php bfile, but it doesn't work.

 function THEME_preprocess_page(&$variables) {
   if (isset($variables['node']->type)) {
     $variables['theme_hook_suggestions'][] = 'page__' .
     $variables['node']->type;
   }

   if ($variables['nid'] == '77') {
     drupal_add_js(drupal_get_path('theme', 'THEME') .'/scripts/path.js');
   }
 }


texts: Creating products with Rules and calculating price in Drupal Commerce

texts:
I am creating products on the fly with Rules, using Drupal Commerce. After user clicks on checkbox near product (additional service to product), I need to "add the service" to cart. Service is always 15% of price of Base product.

I created a rule which creates new products, and add them to cart. This works nicely but I am unable to set up the price field. In Data Selector mode I can not see my calculation field anywhere, not even when calculated value is Integer and price is also integer.

Any help with this? I am posting a Rule here:

{ "rules_grafeon_doplnkov_slu_by_pri_pridan_do_kosika" : {
"LABEL" : "Grafeon - Doplnkov\u00e9 slu\u017eby pri pridan\u00ed do ko\u0161\u00edka",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_discount_extra", "commerce_cart" ],
"ON" : { "commerce_cart_product_add" : [] },
"IF" : [
  { "entity_has_field" : {
      "entity" : [ "commerce-line-item" ],
      "field" : "field_doplnkove_sluzby_item"
    }
  },
  { "data_is" : {
      "data" : [ "commerce-line-item:field-doplnkove-sluzby-item:0" ],
      "value" : "Service SLA"
    }
  },
  { "commerce_discount_extra_line_item_has_product_type" : {
      "commerce_line_item" : [ "commerce_line_item" ],
      "product_types" : { "value" : { "product" : "product" } }
    }
  }
],
"DO" : [
  { "variable_add" : {
      "USING" : { "type" : "date", "value" : "now" },
      "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } }
    }
  },
  { "data_convert" : {
      "USING" : { "type" : "text", "value" : [ "variable-added" ] },
      "PROVIDE" : { "conversion_result" : { "conversion_result" : "Conversion result" } }
    }
  },
  { "entity_query" : {
      "USING" : {
        "type" : "commerce_order",
        "property" : "order_id",
        "value" : [ "commerce-line-item:order-id" ]
      },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "entity_create" : {
      "USING" : {
        "type" : "commerce_product",
        "param_sku" : "DS-[commerce-line-item:order-id]-[conversion-result:value]",
        "param_type" : "doplnkov_slu_by",
        "param_title" : "Service SLA",
        "param_creator" : [ "site:current-user" ],
        "param_commerce_price" : { "value" : { "amount" : 1000, "currency_code" : "EUR" } },
        "param_commerce_stock" : "1000"
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },
  { "entity_save" : { "data" : [ "entity-created" ], "immediate" : "1" } },
  { "commerce_cart_product_add_by_sku" : {
      "USING" : {
        "user" : [ "site:current-user" ],
        "sku" : "DS-[commerce-line-item:order-id]-[conversion-result:value]",
        "quantity" : "1",
        "combine" : "0"
      },
      "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
    }
  }
]

}
}

Any advice how to get the value to Price value? Thanks a lot.


texts: Is it possible to make the jquery datepicker always visible in a form?

texts:
I'd like to have the jquery datepicker calendar always visible on a date element in my Drupal 8 form.

I see that this is possible to do by setting the datepicker to a div instead of an input.

However, since date elements of forms are declared like

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

this doesn't seem like an option that the date element properties allow.

Is there a method of doing this that is compatible with Drupal forms?


texts:
I am new to Drupal and I have started overriding Twig files in Drupal 8. I have a requirement where I want other top 5 posts by taxonomy term.

Suppose I have a category as JavaScript. And I am on the node where I am displaying a post on JavaScript. On the same page I need other posts on JavaScript.

I have looked for twig file theme/templates/content/node--article.html.twig and tried to override it.

I have even tried to debug the node using kint tool. I have looked for my requirements in node and content variable.

{{ kint(node) }}
{{ kint(content) }}

But no success. I need suggestion where can I can other posts of same category in twig file. Any suggestion is appreciated.


texts: How to Make File Description Field Required?

texts:
Use case: Users who are authorized to use the edit page are required

To upload at least one file
Must have an associated description with the file.

Plus: How can I edit "Description" to display "Alternative File Name" ?


texts: Commerce Paypal- How can I change the "Order No. at Site Name" string?

texts:
I'm using the Commerce PayPal module to redirect users to PayPal to pay for their orders.

However, when I do this, the transaction that Commerce provides to PayPal is called

  Order # at [Site name]

However, on my site, the store is just one part of it, and the store has a different name than the rest of the site, so I would like to override this string and replace [Site name] with the explicit name of my store.

However, I haven't been able to track down where I can edit this.  I tried searching for a number of variations on the Translate interface page and I also tried using grep on my modules directory but I haven't been able to locate it.


texts: Which host do I need to fill in the database connection?

texts:
So I have made a local Drupal site and now I'm moving it to my webhost. In the database connection array:

$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'drupaldb',
  'username' => 'username',
  'password' => 'secret',
  'host' => 'localhost',
);

So I filled in all my credentials (driver, database, username,...) but what do I need to fill in after 'host'? Can I just leave it 'localhost' or do I need to fill in the host of my webhosting?


texts: how to create a taxonomy Views combining terms from 2 different vocabulary

texts:
I have content types tagged from two different vocabularies (destination and category).

i.e. destination (main vocabulary, content must be tagged with of one of them)
- dest1
- dest2
- dest3
- dest4

category (content is tagged with at least 1 but could be more)
- cat1
-- subcat1.1
-- subcat1.2
- cat2
-- subcat2.1
-- subcat2.2

How can I create a view from these 2 different vocabularies?

i.e. dest1(term)/category(voc)/cat1(term)/subcat1.1(term)


texts: TinyMCE Filtered Html is stripping in line styles

texts:
Is there anyway to allow inline styles.  When setting a table width, using the Table icon width field, the width gets set as an inline style for the table tag, and that gets stripped out.  How frustrating!

Anybody have any solutions?


texts: How to manage / consume multiple Queue API queues in a module?

texts:
For a site I'm running, I'm going to have a few different queues for message sending. For example: high priority email, low priority email, high priority twitter, low priority twitter... etc.

I have set up queues (like "UrgentEmail", "UrgentTwitter") etc. using Drupal's Queue API, but now I need to work on the queue processing (consuming).

I can simply use hook_cron in a module to consume one queue at a time, or all of them, as much as possible, but I'd like to be able to maybe have one queue get hit every couple minutes, while the lower-priority queues would only get it once every half an hour or so...

Is this possible without writing up some of my own cron handlers? I know elysia cron for D6 was good at setting options for module-specific cron, but is there a way I could branch out cron in a single module and run different tasks at different intervals? Or is there another Drupal Way™ to do this?


texts: Why does my admin page appear corrupted after using Backup and Migrate?

texts:
I recently restored a site backup using the Backup and Migrate plugin. Now my admin toolbar looks like this.
Flushing cache does nothing. How can I fix this?


texts: Joyride Instructions for first time login user only

texts:
I want to guide users when they login for the first time. I am planning to do it with joyride module. Right now, I can either show a link in a block or can start it automatically as the page is accessed. Please suggest me a way to guide only authenticated users after they first login and never after.
Thanks in advance


texts: What happens when a site goes in maintenance mode while a user is editing an node content?

texts:
Let's imagine a user is editing a node content. In the mean time, a Drupal administrator puts the site in maintenance mode.

Does the user have a chance to save his work (assuming it does
not have the "Use the site in maintenance mode" priviledge)?
Is there a way to send them a warning, like 'maintenance in 5 mins'?

Thanks.


texts:
Hi I need to change the url path of the view which appears to be a block also,its a button and I want that it redirects to the correct URL, how do I change it?
Please help me..
Answers and directions will highly be appreciated thanks.


texts: Translate older custom content panes in panels

texts:
I am working on a Panel's based multilingual site. After some initial site build (Agile), it was decided that localization should be implemented. i18n to the rescue :-)

I am able to translate everything on the site now, however translating the custom content panes, in the Panels is giving me hard times. I have enabled i18n_panels module which comes as a sub-module of panels itself. This enabled me to find the custom content panes added earlier from the translate interface and then translate them.

The problem I am facing is with the content panes that were created before enabling the i18n_panels module. I am not able to find them in the interface. I am also not able to find a reason for this.
I exported the older content pane and the new content pane, just to check if some settings (some key in the exported code), is used to enable translation. But, I am not able to find anything particular.
It would be great, if anyone helps me to find it. I'd then implement it with an update hook.

I have an option to remove and add all the content panes again, however the number of content panes is quite huge, and I'm on a deadline :(


texts: Syncing Development Site with Production Site

texts:
I recently built my first Drupal 8 site. I've updated the production site since it's been launched, and I wanted to sync it with the development site before I create another content type.

Could someone point me in the right direction?


texts:
How to perform join with multiple columns using db_select? Any help?

Here below is the sample, which I'm looking for.

SELECT * FROM digitaliq_flds_by_node a
JOIN digitaliq_fld_category b ON
  a.fld_id = b.fld_id AND
  a.fld_collection_id = b.fld_collection_id AND
  a.fld_group_name = b.fld_group_name


texts: Some blocks not updating untill clear the cache

texts:
My Recent Forum Topics and Recent Contents blocks are not showing new contents untill I clear the cache from Performance section.

I've added these standard blocks to my homepage but they don't work.


texts: Programmatically change date field in hook_cron

texts:
I'm trying go buid a node who is updated every day updating a field 'field_data' to the current date.

This is my initial code:

function actomodule_cron(){
    $nid = 58;
    $node = node_load($nid);
    $simpleDate = time();

    $node->field_data['und'][0]['value'] =  $simpleDate;
    node_save($node);
}

but it didn't work so I add a watchdod print

watchdog('node', print_r($node->field_data['und'][0], true));

who give me this

Array (
[value] => 1402408294
[timezone] => Europe/Paris
[timezone_db] => Europe/Paris
[date_type] => datestamp
[db] => Array (
    [value] => DateObject Object (
        [granularity] => Array (
            [0] => year
            [1] => month
            [2] => day
            [3] => hour
            [4] => minute
            [5] => second
            [6] => timezone )
        [errors] => Array ( )
        [serializedTime:DateObject:private] => 2014-06-10T13:09:55+02:00
        [serializedTimezone:DateObject:private] => Europe/Paris
        [timeOnly] =>
        [dateOnly] =>
        [originalTime] => 2014-06-10T13:09:55+02:00
        [date] => 2014-06-10 13:09:55
        [timezone_type] => 3
        [timezone] => Europe/Paris )
    [value2] => DateObject Object (
        [granularity] => Array (
            [0] => year
            [1] => month
            [2] => day
            [3] => hour
            [4] => minute
            [5] => second
            [6] => timezone )
        [errors] => Array ( )
        [serializedTime:DateObject:private] => 2014-06-10T13:09:55+02:00
        [serializedTimezone:DateObject:private] => Europe/Paris
        [timeOnly] =>
        [dateOnly] =>
        [originalTime] => 2014-06-10T13:09:55+02:00
        [date] => 2014-06-10 13:09:55
        [timezone_type] => 3
        [timezone] => Europe/Paris ) )

)

So I updated the function to:

function actomodule_cron(){
  $nid = 58;
  $node = node_load($nid);
  $simpleDate = time();
  $bigDate = new DateObject('now');

  $node->field_data['und'][0]['value'] =  $simpleDate;

  $node->field_data['und'][0]['db']['value'] =  $node->field_data['und'][0]['db']['value2'] =  $bigDate;

  node_save($node);
}

but didin't work.

How can I edit this field?


texts:
I have 2 Contexts set up that each place a block in the same region.

There are times when both these contexts will happen at the same time and as such both blocks appear together.

Currently when both appear they are not in the order I require, is there a way of weighting these across contexts?  I know the weighting works within a context however this is not what I need at this point.

Currently using:
Drupal 6.22,
Context 6.x-3.0

UPDATE:

Hi All,

This post appears to get quite of interest but I'm afraid I don't use Drupal anymore or have any time (or sites) to check these answers.  If any answer gets enough interest and appear to be right then I'll happily mark it correct but I can't actually verify anything.


texts: How to build and embed the output of a Message entity created by the Message module?

texts:
I need to, given the mid (= Message ID), generate the Message content for a specific view mode. How can I do this?

It seems to be complicated by the fact that a Message is an entity (created by the Message module), and there are multiple Message types, each of which have their own fields and rely heavily on tokens.

I'm hoping for something simple like:

$message = message_load($mid, $view_mode);
$output = drupal_render(entity_view($message));

... but everything I've found that loads Messages seems to rely on weird wrappers and stuff and I haven't been able to find a working solution no matter how much I tinker with it.


texts: MSSql or SQL Server Wrapper for custom module?

texts:
I'm writing a custom module and I need to access data that is currently stored in an MSSql database. It would be great if I could use the built-in database abstraction layer, but obviously that isn't possible.

Are there any modules or resources that provide a similar abstraction layer for MSSql?

If not, how would I go about writing my own? I feel very badly about just putting the connection and query strings directly in the module, it seems so.. antiquated.


texts: How do I create nodes with comments enabled using drush?

texts:
I have a drupal 9.1.5 site with a custom node type. I can create test content for it using drush by running;
drush genc 1 --bundles=mynode --authors=test
However, half of the content has comments disabled. I think what is happening is that drush is randomly settings the COMMENT SETTINGS field:

Drush has a --skip-fields parameter, but I don't know what to put in there. I've tried a bunch of different things like field_mynode_comment (the machine name of the field) but none seemed to work. I'm basically guessing.
How can I use drush to create nodes that always allow comments?


texts: AJAX HTTP error occurred. HTTP Result Code: 503 for Views

texts:
I was trying to transfer my developed website from WAMP to Host - if I go to VIEWS - any button click responds with Error code:

AJAX HTTP error occurred. HTTP Result Code: 503

Then - I did a fresh install - Drupal 7.30 + VIEWS + (Ctools) - If I go to VIEWS - ANY button responds with

AJAX HTTP error occurred. HTTP Result Code: 503

I mean - if I try to Enable any default Views - ERROR;
If I click 'Edit' - it gives Error , but proceeds to edit screen...
In 'Edit' screen - any button click gives Error, and nothing happens....
PHP 5.3
Litespeed
it's a Shared Hosting, but I am able to change some PHP settings and extensions - I was trying to put more Max-Execution time - to 180 and more memory limit to 1024 , but to no avail so far....

What else could it be?!


texts: Webform select option list from another submission data

texts: I have a webform (webform 1) to record data. In another webform (webform 2) I would like to use the submitted data from webform 1 in select options (Load a pre-built option list). How can I do this? Is there any module that already available to do this?


texts: How to use "replacement tokens" created for a Message type in Views?

texts:
In my case a user with the role ("team member") flags a node created by normal user. I want to display "@team member_id flagged @node_id created by @user_id". Maybe later on I would like to add profile pics of both user/team member or the email or any information in the view about them.

Is this possible?

Here is an export of the Message type (created with the Message module):

{
  "name" : "utilisateur_finalise_intervention",
  "description" : "Utilisateur finalise intervention",
  "argument_keys" : [ "@utilisateur", "@equipier" ],
  "argument" : [],
  "category" : "message_type",
  "data" : {
    "token options" : { "clear" : 0 },
    "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
  },
  "language" : "fr",
  "arguments" : null,
  "message_text" : { "fr" : [
      {
        "value" : "@utilisateur a finalis\u00e9 une intervention avec @equipier",
        "format" : "filtered_html"
      }
    ]
  },
  "rdf_mapping" : []
}

And the rule I created looks like so:

{ "rules_link_set_finaliser_une_intervention" : {
    "LABEL" : "Rules link: Finaliser une intervention rules set",
    "PLUGIN" : "rule set",
    "OWNER" : "rules",
    "REQUIRES" : [ "flag", "rules" ],
    "USES VARIABLES" : {
      "user" : { "label" : "user", "type" : "user" },
      "node_id" : { "label" : "node_id", "type" : "node" }
    },
    "RULES" : [
      { "RULE" : {
          "PROVIDE" : { "entity_created" : { "log_fin_intervention" : "log_fin_intervention" } },
          "DO" : [
            { "flag_unflagnode" : {
                "flag" : "accepter_invitation",
                "node" : [ "node-id" ],
                "flagging_user" : [ "user" ],
                "permission_check" : "1"
              }
            },
            { "flag_flagnode" : {
                "flag" : "fin_intervention",
                "node" : [ "node-id" ],
                "flagging_user" : [ "user" ],
                "permission_check" : "1"
              }
            },
            { "entity_create" : {
                "USING" : {
                  "type" : "message",
                  "param_type" : "utilisateur_finalise_intervention",
                  "param_user" : [ "node-id:author" ]
                },
                "PROVIDE" : { "entity_created" : { "log_fin_intervention" : "log_fin_intervention" } }
              }
            },
            { "data_set" : {
                "data" : [ "log-fin-intervention:arguments:utilisateur" ],
                "value" : [ "node-id:author:uid" ]
              }
            },
            { "data_set" : {
                "data" : [ "log-fin-intervention:arguments:equipier" ],
                "value" : [ "user:uid" ]
              }
            },
            { "mail" : {
                "to" : [ "user:mail" ],
                "subject" : "Votre collaboration sur [node-id:title] est termin\u00e9e",
                "message" : "Votre collaboration avec [node-id:author:field-prenom] [node-id:author:field-nom] sur le projet  [node-id:title] est maintenant termin\u00e9e",
                "from" : [ "" ],
                "language" : [ "" ]
              }
            },
            { "drupal_message" : { "message" : "Votre collaboration avec  [user:field-prenom] [user:field-nom]  est maintenant termin\u00e9e" } },
            { "redirect" : { "url" : [ "node-id:url" ] } }
          ],
          "LABEL" : "Finaliser intervention"
        }
      }
    ]
  }
}

And also the view I created:

I also have an error displayed above the view

Notice : Undefined variable: table dans ViewsUiBaseViewsWizard->default_display_filters_user()


texts: How do I create an AJAX callback to Drupal video link?

texts:
We have a number of videos which are hosted locally and are simple HTML5 video tags. We want to keep track of play clicks. So to be clear, we don't want to track clicks on the URL, we want click tracks on the video tag.

So I want to write a little jQuery() to get the onclick() and then call a Drupal function to update a Drupal entity to store the # of clicks and their source.

I've written AJAX in other environments (PHPBB, Wordpress) but not Drupal. I guess I'm looking for a 'starter kit' which demonstrates interfacing Drupal CRUD functions with js.


texts: How can I show/hide node field values the same way items are shown/hidden in /admin/modules?

texts:
When viewing a node of a specific type, how can I show/hide the values like in /admin/modules?
I want to be able to click on the field title and show or hide the value. Is there a module that can help do this? Or will I need to add code to my custom module?
If I need custom code I've researched custom CSS/JS libraries. https://www.drupal.org/docs/creating-custom-modules/adding-stylesheets-css-and-javascript-js-to-a-drupal-module


texts:
I'm trying to get a Drupal 6 site up and running with the Vagrant Drupal Development project.

I can get VDD going.. get my site installed, the database imported etc.. but I need to make VDD use an old version of PHP. I see some instructions online that say you can set which PHP version to use, but it isn't happening.. it doesn't say where in the json the setting needs to appear.

I tried with the following json, but it ended up as PHP Version 5.4.39-1+deb.sury.org~precise+2 :

{
  "php": {
    "version": "5.2.17"
  },
  "vm": {
    "ip": "192.168.44.44",
    "memory": "1024",
    "synced_folders": [
      {
        "host_path": "data/",
        "guest_path": "/var/www",
        "type": "default"
      }
    ],
    "forwarded_ports": []
  },
  "vdd": {
    "sites": {
      "drupal6site": {
        "account_name": "root",
        "account_pass": "root",
        "account_mail": "box@example.com",
        "site_name": "drupal6site",
        "site_mail": "box@example.com",
        "vhost": {
          "document_root": "drupal6site",
          "url": "drupal6site.dev",
          "alias": ["www.drupal6site.dev"]
        }
      }
    }
  }
}


texts: Why would a multilingual site sometimes say "Save (this translation)" and other times say "Save (all translations)"?

texts:
We have a multilingual Drupal 8 site supporting 17 different languages and many more localized versions of those languages.

I have been noticing that sometimes when I am editing a node it says "Save (this translation)" but then other times it says "Save (all translations)".

What is triggering it to act differently at times? Have we configured something wrong with our translations/multilingual setup?

With what we are doing I believe we want them to save independently of each other.


texts:
I have two tables activity and activity_map. I need to join both the tables by aid. Below is my code for hook_views_data. Base table is working fine including custom text handler. But I do not see the joined table(activity_map) fields (entity_id, entity_type)  either in fields section nor in arguments or filters. Am I missing anything?

  <?php

    /**
 * Implements hook_views_data
 */
function activity_teamie_views_data() {
  $data['activity_teamie']['table']['group'] = t('Activity');
  $data['activity_teamie']['table']['base'] = array(
    'title' => t('Activity'),
    'field' => 'aid',
    'help' => t('Activity feed item')
  );
  $data['activity_teamie']['aid'] = array(
    'title' => t('Activity ID (aid)'),
    'help' => t('Activity ID'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric'
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric'
    ),
    'sort' => array(
      'handler' => 'views_handler_sort'
    )
  );
  $data['activity_teamie']['template'] = array(
      'real field' => 'template',
      'title' => 'Activity',
      'help' => 'Text describing the activity',
      'field' => array(
        'handler' => 'activity_teamie_handler_field_activity_text',
      ),

  );
  $data['activity_teamie']['data'] = array(
    'title' => 'Data',
    'help' => 'Data array',
    'field' => array(
      'handler' => 'views_handler_field',
    ),
  );
  $data['activity_teamie']['created'] = array(
    'title' => t('Created'),
    'help' => t('Created timestamp'),
    'sort' => array(
      'handler' => 'views_handler_sort_date'
    )
  );
  $data['activity_teamie']['updated'] = array(
    'title' => t('Updated'),
    'help' => t('Updated timestamp'),
    'field' => array(
      'handler' => 'views_handler_field_date',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date'
    )
  );

  /* ACTIVITY MAP */
  $data['activity_teamie_map']['table']['group'] = t('Activity');

  // Join with the {activity} table
  $data['activity_teamie']['table']['join'] = array(
    'activity_teamie_map' => array(
      'left_field' => 'aid',
      'field' => 'aid'
    )
  );
  $data['activity_teamie_map']['aid'] = array(
      'title' => t('Aid Map'),
      'help' => t('Aid Map'),
    'field' => array(
          'handler' => 'views_handler_field',
  ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric'
  ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric'
  )
  );
  $data['activity_teamie']['entity_type'] = array(
    'title' => t('Entity type'),
    'help' => t('Entity type of the associated entity'),
  'field' => array(
        'handler' => 'views_handler_field',
  ),
    'filter' => array(
      'handler' => 'views_handler_filter_string'
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string'
    )
  );
  $data['activity_teamie']['entity_id'] = array(
    'title' => t('Entity ID'),
    'help' => t('Entity ID of the associated entity'),
  'field' => array(
        'handler' => 'views_handler_field',
  ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric'
    )
  );
  return $data;
}


texts: How can I create a hierarchal book view page?

texts:
I created a node book with the following structure:

Introduction
Volume 1

Chapter 1
Chapter 2
Chapter 3

Volume 2

Chapter 1
Chapter 2
Chapter 3

Volume 3

Chapter 1

I'm trying to create a view that shows them all in a single page but i cant get them to be sorted in the correct way and it's causing the view to load pages in the wrong order. The expected order should be
Intro, volume 1, chapter 1, chapter 2, chapter 3, volume 2, ...etc
I currently have the view relationship set to the top level book and a contextual filter for the node id with a relationship to the top level book id. they are sorted by book depth in descending order but it doesn't match the book hierarchy. Any help with creating this view would be appreciated.


texts: Commerce Paypal WPP Sandbox: cURL error: SSL connect error

texts:
EDIT: Appears it is related to this issue: https://www.drupal.org/node/2616730#comment-10782646 . Still awaiting a fix though, as the patch in the issue doesn't fix it for me.

Our staging site was successfully using the Paypal sandbox with WPP for taking payments. As of three days ago, with seemingly no changes it is no longer working. The front end returns the error: "We encountered an error processing your payment. Please verify your credit card details or try a different card." Under reports all it says is cURL error: SSL connect error. Any idea how to fix this?

EDIT: I've tried to add CA certificate as per these instructions:

  // Commerce PayPal requires SSL peer verification, which may prevent out of
  // date servers from successfully processing API requests. If you get an error
  // related to peer verification, you may need to download the CA certificate
  // bundle file from http://curl.haxx.se/docs/caextract.html, place it in a
  // safe location on your web server, and update your settings.php to set the
  // commerce_paypal_cacert variable to contain the absolute path of the file.
  // Alternately, you may be able to update your php.ini to point to the file
  // with the curl.cainfo setting.

But now I get the error cURL error: Problem with the SSL CA cert (path? access rights?). I've tried restarting Apache with no effect. Please help!

More info on the request below:

Message PayPal API request to https://api-3t.sandbox.paypal.com/nvp:

Array
(
    [METHOD] => DoDirectPayment
    [PAYMENTACTION] => Sale
    [NOTIFYURL] => http://website.com/commerce_paypal/ipn/paypal_wpp%7Ccommerce_payment_paypal_wpp
    [BUTTONSOURCE] => CommerceGuys_Cart_PPP
    [CREDITCARDTYPE] => Visa
    [ACCT] => XXXXXXXXXXXX0331
    [EXPDATE] => 032016
    [AMT] => 126.00
    [CURRENCYCODE] => USD
    [CVV2] => XXX
    [INVNUM] => 5355-1453684794
    [CUSTOM] => Order 5355
    [DESC] => 1x product
    [EMAIL] => test@test.com
    [IPADDRESS] => [IPADDRESS]
    [FIRSTNAME] => test
    [LASTNAME] => test
    [STREET] => test
    [STREET2] => test
    [CITY] => test
    [STATE] =>
    [COUNTRYCODE] => HK
    [ZIP] =>  -
    [USER] => pro_api1.website.hk
    [PWD] => XXXXXXXXXXXXXXXX
    [SIGNATURE] => XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    [VERSION] => 76.0
)


texts: How to get Fragment value from url in Drupal 8?

texts:
I need to get the Fragment value from url like: admin/config/system/meta_custom?query=test#abc=xyz in Drupal 8.

Need value of abc - ideally using Drupal's API, rather than doing my own Url Parsing.


texts:
I have two content types documents and authors.
When creating a document a selection list of entity reference's to authors is used to select the author.

Searches for the author name find the correct author, but do not find the document that has an entity reference to the author. How do I get the search engine to to display both the author and the documents the author is referenced from.

EX Book "GOOD BOOK" is has an entity reference to Author "TOM".

When I do a search for TOM I get the "TOM"'s authors information but NOT an entry for "GOOD BOOK"


texts:
Is it possible to overwrite a Views Field hander without creating a new field?

For example, I am trying to overwrite the Geolocation ProximityField field handler.

<?php

namespace Drupal\mymodule\Plugin\views\field;

use Drupal\geolocation\Plugin\views\field\ProximityField;
use Drupal\Core\Form\FormStateInterface;

/**
 * Field handler for geolocation field.
 *
 * @ingroup views_field_handlers
 *
 * @ViewsField("geolocation_field_proximity")
 */
class RangeProximityField extends ProximityField {

  /**
   * Form constructor for the user input form.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  public function viewsForm(array &$form, FormStateInterface $form_state) {
    $this->viewsForm($form, $form_state);
    // Add custom logic here.
  }

}

I tried using hook_views_data_alter() but had no luck (I renamed in above annotation to mymodule_field_range_proximity):

/**
 * Implements hook_views_data_alter().
 */
function mymodule_views_data_alter(array &$data) {
  $data['node__field_latlong']['field_latlong']['field']['id'] = 'mymodule_field_range_proximity';
}


texts:
Will the view chosen (in the advanced settings) of a node reference in a content type get overridden by another view if the node reference field is shared between two (or more) content types?
In more detail: I am working with a Drupal site that has a content type that contains a node reference field. One of the things it asks you when creating the content type is - which views are used to reference the node. I am trying to create another content type that shares the same field as the first one, and it therefore will also be a node reference.
BUT, when I create this new content type, it again asks which view I want to use. If I chose a different one will it override the view in the first content type, since they share a common field?


texts:
I created a custom module which has the following hook_init() implementation.

function gate_init() {
  $curr_uri = check_plain(request_uri());
  if (strpos($curr_uri, 'admin') === FALSE) {
    if (strcmp($curr_uri, '/gate') != 0) {
      if (!sess_read(GATE_SESSION_NAME)) {
        if (!isset($_COOKIE[GATE_COOKIE_NAME])) {
          drupal_goto('gate');
        }
        else {
          sess_write(GATE_SESSION_NAME, TRUE);
        }
      }
    }
    else {
      if (sess_read(GATE_SESSION_NAME) || isset($_COOKIE[GATE_COOKIE_NAME])) {
        if (!sess_read(GATE_SESSION_NAME)) {
          sess_write(GATE_SESSION_NAME, TRUE);
        }
        drupal_goto('/');
      }
    }
  }
}

It's crazy, but this code causes login problems for authenticated users. I cannot login, I see no errors, I just cannot login if I provide correct username and password.

If I comment out these lines, I can login.

if (!sess_read(GATE_SESSION_NAME)) {
  if (!isset($_COOKIE[GATE_COOKIE_NAME])) {
    drupal_goto('gate');
  }
  else {
    sess_write(GATE_SESSION_NAME, TRUE);
  }
}

I check further and  if (!sess_read(GATE_SESSION_NAME)) is the part causing login problems.   Could anybody give me an advice?


texts: Panels "Page not found" when using required wildcard argument

texts:
I have a Panel Page, which displays several View Panes.  I have specified a term name as an argument in the path settings. This is used to filter the View Panes.

When I use an optional argument everything works fine - clinical-role/!role_name.  But when I change to a required argument clinical-role/%role_name then I get page not found when visiting /clinical-role and when visiting /clinical-role/early-skills-for-non-training-grade-doctors

I need the argument to be required because I don't want the panel to display when people visit /clinical-role.

Here is an export of the Panel Page: http://pastebin.com/ASmFnVU5

Here are my argument settings:

And also my context settings:


texts:
I run a very large D6 college website (upgrading to D7 isn't feasible right now due to time/budget restraints). I noticed today that a few users have the "admin" role even though they've never been granted it and shouldn't have it. I tried to remove the role from their accounts in three ways:

Via user/edit - no effect whatsoever. The role stayed checked.
Via VBO - again, no effect at all.
By deleting the appropriate roles in the user_roles table. This worked until they logged in, at which point Drupal re-assigns the admin role to them (!!!).

What in the world could be happening here? Most (but not all) of the affected users are members of another role called marcomm.

Server is IIS 8.


texts: Pass query parameters through local response

texts: I'm trying to pass query parameters received on a controller from an external redirect through TrustedRedirectResponse or LocalRedirectResponse. None of the options seem to be working.


texts:
I'm trying to run cron.php via a cron job set up in crontab on my server via the following command (running every 2 minutes purely for testing while I try and get it working - it will be every 6 hours when fixed);

*/2 * * * * /usr/bin/php -q /var/www/www.mysite.com/crontab-cron.php >>/var/log/server-cron.log 2>&1

The crontab file was needed to work around an error with the include file locations and looks like this;

<?php
$doc_root = dirname($_SERVER["SCRIPT_FILENAME"]);
chdir($doc_root);

include_once './cron.php';
?>

However now I'm receiving the error (shown in the cron log file)

PDOException: SQLSTATE[28000] [1045] Access denied for user &#039;root&#039;@&#039;localhost&#039; (using password: NO) in lock_may_be_available() (line 167 of /var/www/www.mysite.com/includes/lock.inc).

I've come across a few suggestions mentioning creating a new database user with the same permissions and changing those details in settings.php but that's not making any difference.

Any ideas how to get this working? I just need to run the cron job via crontab.


texts: What should be the reverse proxy settings in settings.php, if a site is behind a Load Balancer which is further behind a Reverse Proxy?

texts:
We have a Drupal 8 site, which is behind a Load Balancer (lets say the I.P of Load Balancer is a.b.c.d). This Load Balancer is further behind a Reverse Proxy (lets say the I.P of Reverse Proxy is e.f.g.h).

What should the reverse proxy settings in settings.php look like?

What should be in the array value for $settings['reverse_proxy_addresses'] ?

I'm assuming the settings would be the one mentioned below. Is it correct?

$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = array('a.b.c.d', 'e.f.g.h');


texts:
I want to display the contact form inside a block, so that a user can access it directly from another page. Using Webform Module to create a new form would be overkill.

Is there a simple way to do this, either core, a small module or custom module?


texts: Is it possible to replace more than one form element (wrappers) triggered by only one #ajax trigger element?

texts:
function ajax_example_simplest($form, &$form_state) {

  //This is my ajax trigger element
  $form['element_trigger'] = array(
    '#type' => 'select',
    '#options' => array(
      'one' => 'one',
      'two' => 'two',
      'three' => 'three',
    ),
    '#ajax' => array(
      'callback' => 'ajax_example_simplest_callback',

      /** Q: Can I somehow declare more than one wrapper? **/
      //Say for instance, something like:
      'wrapper' => array('replace_div_1', 'replace_div_2'),

     ),
  );

  //replace_div_1
  $form['element_to_be_replaced_1'] = array(
    '#type' => 'textfield',
    '#title' => t("My conditional field one"),
    '#prefix' => '
',
    '#suffix' => '
',
  );

 //... more form elements here

  //replace_div_2
  $form['element_to_be_replaced_2'] = array(
    '#type' => 'textfield',
    '#title' => t("My conditional field two"),
    '#prefix' => '
',
    '#suffix' => '
',
  );
  return $form;
}

function ajax_example_simplest_callback($form, $form_state) {

  //... do my stuff here

  //normally I would return only the form bit for replacing a single wrapper
  //declared in the trigger element, like this:
  return $form['element_to_be_replaced_blahblah'];

}

Is it possible to return more than one form bit in the callback function telling the AJAX framework that $form['element_to_be_replaced_1'] should replace
 and $form['element_to_be_replaced_2'] should replace
?


texts: How can I create a Views list of all users with either a node OR a comment?

texts:
I need to do some major user pruning. I run a Q&A site and need to find all users who have written a comment or created a node . Currently in Views I can't figure out how to do this.

Is it possible in Views or do I need a custom query ? What might that query look like?

Thanks!


texts: Create a dynamic Tabbed View from Group By

texts:
I created a View which show all the content tagged with user flagged terms and group the content by Term Name.

Right now I am trying to make each group appear in a tab, I don't know how to achieve it.

For example if the user "X" flagged terms "A", "B" & "C", Currently, The view come back with all content tagged with terms "A", "B" & "C" and group them by Term Name in this case "A", "B" & "C". I want these groups "A", "B" & "C" to be tabs. I need to auto generate them because I don't know either the number or which terms are flagged by the current user.

If I can't achieve it with views only, Is their anyway to achieve it with another modules e.g. Panels.

At the same time, I will try to trace the views template files to see If I can do it with jQuery Tabs and views template files. If you have any other suggestion please feel free.


texts:
I have one simple quick contact form (webform), it's working fine but sometimes when user fill form n submit it get submitted 2 times or 3 times.

I have checked the submission table that same data is submitted on same time 2 or 3 times.

This happens sometime but not for all submit .

If anybody have resolved this type of issue then please let me know how you have resolved it.

Thanks in advance.


texts: How to list articles by an author in a views?

texts:
In Drupal 7, I have defined a node type 'article' which has an 'author' field (The author is not a user, but just a 3rd party contributor). Now I want to list articles by the each author in a view. How can I do that?

I know that it can be done somehow using contextual filters but got quite perplexed so  appreciate your help.


texts:
How can I forward a request from module to a content page?

I have got a module that authenticates users; once authenticated, the module should forward the request to a content page or node (not redirecting).

public HttpKernel::forward($controller, array $attributes = array(), array $query = array()) allows to forward the request to a controller.

How do I forward the request to, for example, http://localhost:8080/techlab/evaluations, where evaluations is a created article?


texts: Update the date field to the date & time of the node being updated

texts:
I am sure that I am missing something very simple here, so I hope somebody can put me on the right track.

Use Case:

I have a simple content type "Article"
A date field of type: "Date and Time" is attached to this content
type.
Using any of "Rules" or "Business rules" module, I need when
updating a node of type "Article", to set the value of the "date
field" to be equal to the "date and time" of the node being
updated.

What is the right token that must be used ?

So far:

I have been trying for days with no success, I have tried to use the below token but yet no sucess:

[node:changed:custom:D-M-Y-H:i:s]
[node:changed:custom:D-M-Y H:i:s]
[node:changed:custom:D/M/Y H:i:s]
[node:changed:custom:DMYHis]

Any help PLEASE!!

UPDATE #1:

The real use case:

I am using the "Field Timer" module in my project which
provides field formatters for core module Datetime to display timer or countdown as a formatter.

So every time the node is updated, I want to set the "date field" to the current "date and time" of the node being updated (+) 20 minutes.

For Example if the current date & time of the node being updated is: 31/12/2018 15:00:00 so I want to set the "date & time" field value to: 31/12/2018 15:20:00

So the countdown formatter will start from 20 minutes and down until 0 minute.

Thank you,


texts: How to define an intermediate admin user as the default install profile on fresh drupal 7?

texts:
When generating a new drupal site (multisite), I would like to define the default user profile as an admin user without acces to administration menu.

How can I create this new user as an install profile with default login infos, keeping at the same time the admin user?


texts: launching parser script once in 24 hours

texts:
I have a file parser.php

$url = 'http://site.kz';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch , CURLOPT_USERAGENT , "Mozilla/5.0 ");
curl_setopt ($ch , CURLOPT_RETURNTRANSFER , 1 );
$link = curl_exec($ch);
curl_close($ch);

so all contents of the site -site.kz is in $content variable. If i call this script http://site.kz/sites/all/themes/mytheme/parser.php -> it starts to grab this page, right?

How can i make available that variable $link in a page.tpl.php? If i make include ('parser.php') then everytime i F5 my page → parser is going to work (creates load to the server).


texts: How do I control the (templated?) output of field_view_field

texts:
I'm using Billy Mail, Billy PDF and a custom module to generate custom 'booking sheet' documents relating to Commerce orders.  I'm getting different markup generated depending on where the custom code is called from.

The code in question is:

// in my_custom.module
$commerce_customer_billing =field_view_field('commerce_order', $order, 'commerce_customer_billing')[0]['#markup'];
...

<?php print $commerce_customer_billing; ?>

When I call the above through Drupal admin UI, I get complete markup, which is what I want:

Full name:

Testy McTestface

But when the code is called by Billy Mail to generate a PDF email attachment, it outputs just the field value, without any markup:

Testy McTestface

I'm assuming field_view_field is inheriting a template from the theme?  How do I force the field to always render with complete markup, or where do I look for those settings?


texts: I currently have an event entity, which is fieldable. My question is, how do I make it appear under admin/structure, and how can I access the Manage Fields page from the admin menu? Is there a tutorial on this? Any help is highly appreciated since I could not find anything related.


texts: execute drush command from devel/php drupal

texts:
Can any one please tell me how can I execute drush command from devel/php?

I can execute PHP codes from devel/php. But I don't know how can I execute drush command from devel/php. (As we know "devel/php" URL coming from devel module).

I have written some custom drush command for cron purpose. I can able to run those commands from command line.

> drush my-cmd or drush cc all or drush status , etc ... I can run it through command line.

Expecting some function as mentioned below to run from devel/php

some_function("drush cc all");


texts: how to add link to null path in menu in drupal 7

texts:
I have added superfish menu in menu bar in that one of the link have sub-link. How to add a sub-link with null path.

Please help me.

Thanks


texts: How to display data without html on ajax call?

texts:
How to display only content on ajax hit without html markup?

what i am trying to do i have to show data on button click in profile dashboard(custom page) ,for this i have created controller file .

class OutstandingPaymentPending extends ControllerBase {
  // callback for learning portal access
  public function GetPendingPayment() {
    /* TO DO
     * Making api dynamic via configuration
     */
    global $base_url;
    $user_id = \Drupal::currentUser()->id();
    $psid = '';
    $psid_request = \Drupal::request()->get('ds');
    if (!empty($psid_request)) {
      $psid = $psid_request;
    }
    else {
      $psid = get_psid_by_user_id($user_id);
    }
    // Get outstanding data from api
    $url = OUT_STANDING_API . '?PSID=' . $psid;
    //$url = OUT_STANDING_API . '?PSID=00002449846';
    $access_token = API_ACCESS_TOKEN;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('AccessToken:' . $access_token));
    $response = curl_exec($ch);
    $err = curl_error($ch);
    curl_close($ch);
    $rows = array();
    $result = json_decode($response);

    $result = trim($result, '"');
    if (trim($result) == 'No data found') {
      $rows = array();
    } else {
        $outstanding_result = json_decode($result);
         $course_count = 1;
        $rows = [];
        if (!empty($outstanding_result)) {
        foreach ($outstanding_result as $key => $value) {
          //if ($outstanding_result->ResponseCode != 401) {
          $rows[] = array('course_name' => $outstanding_result[$key]->CRSNAME,
            'course_validity' => $outstanding_result[$key]->VALIDITY,
            'course_type' => $outstanding_result[$key]->COURSETYPE,
            'course_installment_date' => $outstanding_result[$key]->INSTDT,
            'course_total_outstanding' => $outstanding_result[$key]->TOTALOUTSTANDINSTAMT,
          );
          //}
        }
      }
    }

    return array(
      '#theme' => 'pending_installment_template',
      '#installment' => $rows
    );
  }
  }

My ajax code is:

//ajax for showing installment payment pending block on click
$(document).on('click', '#gettoptracks', function (e) {
    e.preventDefault();
    $.ajax({
        url: "/outstanding-payment-left",
        context: document.body,
        success: function (data) {
            $("#show-pending-payment").html(data);

        }
    });
    // your statements;
});

On clicking ajax based button its rendering entire page along with data with all html, so js files and css rendering two times in same page .

how i can show only data instead of entire page html which is rendering on page.html.twig?


texts: Views - Filter "Content: Authored by" to show only content by anonymous users

texts:
When filtering content in Views using the filter Content: Authored by, you get these choices:

For the username, I typed "Anonymous", which gave me the UID of 0.

However, when I click Apply (All Displays), I get this error:

There are no entities matching "(0)".

Is there a way to filter a view in Drupal 8 to only show content posted by anonymous users?


texts:
How does Browscap work? Every Browser seems to be a crawler. I think that is a bug. How can I fix that?

I'll used this tutorial and get this execption on the mobile url:

  PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'false' for column 'is_crawler' at row 1: UPDATE {browscap_statistics} SET counter=counter + 1, is_crawler=:db_update_placeholder_0 WHERE ( (parent = :db_condition_placeholder_0) ); Array ( [:db_update_placeholder_0] => false [:db_condition_placeholder_0] => Firefox 10.0 ) in browscap_exit() (Zeile 134 von x:\somewhere\sites\all\modules\browscap\browscap.module).

In replay to paul-m here are my settings:

Current browscap data version: 4911.
Enable automatic updates is enabled.
Enable user agent log is also enabled.

If I refresh the Browscap data I'll get everytime a timeout after 30 seconds. Also If run the cronjob it timesout after 240 seconds. Not sure what I do wrong.

/admin/reports/browscap/browsers shows me an empty list, but /admin/reports/browscap/crawlers containes all browsers.


texts:
I'm having hard time integrating Entity Translation module with tags (Taxonomy and TagClouds modules). I want the following:

Cloud of tags to be showed on the site
Tags must be translatable, i.e. each tag must be showed in English or Russian, depending on the current language.

There are at least two problems. The first is that ET module breaks TagClouds. More specifically, whenever I enable these two modules (in any order), showed cloud of tags disappears. What is more suprisingly, it even doesn't matter was translation of tags enabled in ET module or not ( admin/config/regional/entity_translation -> translatable entity types -> taxonomy term) -- cloud of tags always ends up disappeared. Dblog doesn't show any errors. Is there any other place I can check for them?

The second problem is that if I make taxonomy term translatable in ET, I get strange errors when I'm trying to translate terms. For example:

If I get to the page of some tag created before enabling ET, for exampleen/taxonomy/term/8, than click Translate tab, I will see that current name is not English nor Russian. If click add button in either language, I will get not found error -- see screenshots.

If I click to edit button in list of tags (admin/structure/taxonomy/tags), I will get even more interesting error -- Access denied, You are not authorized to access this page.
Finally, If I click add items on some vocabulary and save it, I will get the following exception: Exception: Invalid translation language in EntityTranslationDefaultHandler->setTranslation() (line 635 of /var/www/drupal/sites/all/modules/entity_translation/includes/translation.handler.inc).

Name and Description fields of tags are marked as translatable (admin/structure/taxonomy/tags/fields/name_field -> Field translation
Users may translate all occurrences of this field: Name in Теги)

What I am doing wrong?

Drupal version is 7, all modules are up to date. I also use i18n modules for translating the interface, by the way.


texts: How to change add to cart css classes commerce

texts:
I'd like to remove all .btn classes on my commerce add to cart-forms as the design dictates text-based links and not buttons.
But I can't find the relevant markup in any of the template files.

It's a D7 site running the latest versions of everything. Theme is Bootstrap, and the add to cart forms are presented via a Viewfield allowing for an Add To Cart-form per variation on the Product Display.

Cheers,


texts:
I am getting errors once export user feature. I have just export and put inside my module folder.

Drush show below error:

  Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException: The service "ctools.serializable.tempstore.factory" has a dependency on a non-existent parameter "user.tempstore.expire". in /var/www/html/project/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php on line 84 #0


texts: How to conditionally not load js for anonymous users?

texts:
We have a situation where our contrib modules are being loaded for the anonymous user, but they are not needed. As a result, we are seeing higher page load times. We tried using hook_js_alter in a custom module with the code below. What is the proper way to not load the js files we don't need for the anonymous user?

mymodule_js_alter($javascript) {

  $javascript['somefile']['weight']=50;
  $javascript['somefile']['scope']=bottom; //region for bottom of the page

}

Current code:

function mymodule_js_alter(&$javascript) {

    if(user_is_anonymous()){
       unset($javascript['sites/all/modules/contrib/autocomplete/autocomplete.js']);
     }
 }


texts:
I have a view set on home page: http://www.userbase.com/

some of the row fields are blank for anonymous users. Logged in users see it fine. I assume its issue with caching. The site is getting approx 5-10 new content every minute through api which seems not getting pulled in cache.

Any ides?

I am using following cache plugins:

Block Cache Alter
Render cache
Render cache for comments added to a node
Render cache for display suite views integration
Render cache for node_show
Render cache for views_plugin_row_node_view
Safe cache_form Clear


texts:
On my content type I want to allow a content administrator to insert a hyperlink to a page and allow them to define a list of related pages. This works fine for linking to nodes, but I am unable to get Views Pages to list.

I have tried the following options:

references module - only allows you to reference nodes
View reference - Not an interface I want to give to a non-techie
entityreference - also does not allow you to reference views pages
viewfield - only allows you to insert views and the interface is not end user friendly
linkit with linkit views - could not get "views pages" to list, documentation seemed to imply it was possible

The items are all in my main menu, is there not a module or picker out there that allows you to pick menu items?


texts: Filter Taxonomy Widget Options by Entity Reference

texts:
I have two content types, Lesson Plan and Course. When creating a Lesson Plan, users select a Course (Entity Reference). Later, they choose course goals (Term Reference) that the Lesson Plan meets. I'd like to filter the list of course goals by the earlier selection, Course. Each Course has a number of course goals (Term Reference).

Is this possible? I've tried using Term / Entity Reference Views, but can't figure out how to pass the selected Course as an argument and have the term list update (AJAX).


texts: How many times drupal calls hook_node_presave for a node?

texts:
During debugging my code I noticed that hook_node_presave() is called 3 times when I edit a node. Why?

I use the following code to count how many times the function is called:

function mymodule_node_presave($node) {
  static $counter = 0;

  // Some code...

  $counter++;
  watchdog('mymodule', "hook has been called $counter");
}


texts: Re-submit form after confirmed AJAX form

texts:
I have a form with submit AJAX button. When clicking this button, it calls function callbackAjax(). In this function callback, I checked a condition A to show a warning dialog if A is FALSE. The warning dialog has a message and two buttons, Confirm and Cancel. Cancel action will close dialog and do nothing. Confirm action will continue doing the callback function with condition A is true.

function renderForm($form, $form_state) {
  $form['submit'] = array(
    '#type'  => 'submit',
    '#ajax'  => array(
      'callback' => 'callbackAjax',
    ),
  );
}

function callbackAjax($form, &$form_state) {
  if (!$condition) {
    // Show dialog with confirm button
    // If confirmed, doing code in else clause
  }
  else {
    // Save data
  }
}

Please tell me how to re-submit form to save data after I clicked button Confirm which be rendered from AJAX callback?

I tried to set button Confirm as same as Submit button from main from, to call AJAX again, but it shows error.

Thanks for your help.


texts: Start migration via rest or from a button within a view

texts:
I have a bunch of migrations that update a bunch of nodes. I want to automate the process and also be able to rollback / add / update specific nodes for specific migrations.

Basically I need a button next to an item in a list and clicking the button to execute something like:

drush mr migration_name --idlist="my item id"

or

drush mim migration_name --idlist="my item id"

I tried making a php file that I can call via rest and have it exec('drush whatever I want') but I'm having issues with that:

  array(7) { [0]=> string(0) "" [1]=> string(153) "Fatal error: Uncaught RuntimeException: Your environment or operation system isn't supported in /chroot/drush/vendor/webmozart/path-util/src/Path.php:257" [2]=> string(12) "Stack trace:" [3]=> string(75) "#0 /chroot/drush/drush.php(58): Webmozart\PathUtil\Path::getHomeDirectory()" [4]=> string(56) "#1 /chroot/drush/drush(4): require('/chroot/drush/d...')" [5]=> string(9) "#2 {main}" [6]=> string(77) " thrown in /chroot/drush/vendor/webmozart/path-util/src/Path.php on line 257" }

So I'm looking for some alternative or creative solution. Thank you in advance