texts: How to add permissions I have to another user in Drupal 8?

texts:
I have two roles, editor and employee. "A" user is in editor role and can change permissions, for example he can add users to employee role or remove them. However, it would be good that users in editor role can change permissions but only ones that they have.

Use case: "A" user in editor role can add member into editor role but cannot remove any members from administrator role because "A" user is not in that role.

How can I reach this above?


texts: Add a link on to /cart on /cart/checkout, using uc_cart_checkout_form. necessary or not?

texts:
I am trying to add a link or button from the checkout page
http://dev.hearst.gotpantheon.com/cart/checkout

To the update cart page
http://dev.hearst.gotpantheon.com/cart/

Right now there are only two buttons showing up, "review cart" and "cancel"

strangely enough if I press "enter" on my keypad I get redirected to the desired update cart page.
http://dev.hearst.gotpantheon.com/cart/

I am thinking of using

function MyThemeName_uc_cart_checkout_form($form) {

}

To add a simple link to 'update cart' into the html or as a form element, I am new to Drupal. How would I do this using the form API? Or is there simply a setting I can set to make the "update cart button" appear http://dev.hearst.gotpantheon.com/cart/


texts: Error 500 when downloading updates for modules

texts:
Recently I've transferred several Drupal sites to DigitalOcean.com VPS server (Ubuntu).
Almost all work well.

But when I try to downloading updates for modules I get error:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?render=overlay&id=82&op=do StatusText: Internal Server Error ResponseText

I see the error for every Drupal sites at VPS.
I can successfully update modules by drush.
But I want to understand the problem.

There is no error record at error.log (Apache)
And there is following line at access.log:

POST /batch?render=overlay&id=83&op=do HTTP/1.1" 500

How can I solve the problem?

UPDATE:
It seems the problem in PHP.
There is known bug with gzopen() for Ubuntu32.


texts: How to make a view specific to only 1 node, not all nodes

texts:
I am building a register event calendar so people can sign up for future events. I have the calendar and the registration for events already completed. Now all I want to do is create a view that will display all the current registered users for the event, but here is the problem i'm running into.

In drupal views it is listing ALL the register users for ALL events. So instead of viewing only a group for one specific event, its adding every single person that has ever clicked the register button.

What steps do I have to go through to say "no, only list register users for THIS event"?

My content type is "Date" for setting a event and my registration is set to "Meetings". I'm not quite sure how to tell views to organize each event separately, rather than together.


texts: Clientside-validation for form-api for field either digits or empty

texts:
A particular form field can be left blank or filled with digits, with no other valid characters including dash"-"

$form['hours'] = array(
    '#type' => 'textfield',
    '#title' => t('Hours worked per week'),
    '#size' => 3,
    '#maxlength' => 3,
    '#default_value' => '',
    '#rules' => array(
      "digit",
      'length[0, 3]',
    ),
    '#filters' => array('numeric', 'trim')
  );

I have a minimum length of 0, but an empty field appears to be invalid.  I've tried using "numeric" instead of "digit" but this allows dashes.

Is there some way to do this without using a custom handler?


texts:
The following problem has occurred:
A client fills in a reservation form, but the time requested is already fully booked. The clerk and the client negotiate a different time, and the clerk wants to change the requested time (f.e. 18:00) to the negotiated time (f.e. 20:00) -- but as the same form has a date restriction (one cannot reserve on the same day) the clerk can't save the form at the day of the appearance.

Is there any way to give a role the permission to change every webform, without any restrictions? I.e. any changes made by role "Trusted User" will not be checked in any way.


texts: Title changed programmatically is not put into breadcrumbs

texts:
I have 2 functions in template.php: The first attaches current page title to breadcrumbs; the second sets the title to 'Completion' when the user opens /scores/completion.

function lwt_breadcrumb($variables) {
    $breadcrumb = $variables['breadcrumb'];
    if (!empty($breadcrumb)) {
        // Adding the title of the current page to the breadcrumb.
        $breadcrumb[] = drupal_get_title();

        // Provide a navigational heading to give context for breadcrumb links to
        // screen-reader users. Make the heading invisible with .element-invisible.
        $output = '
' . t('You are here') . '
';

        $output .= '
' . implode(' » ', $breadcrumb) . '
';
        return $output;
    }
}

function lwt_preprocess_page(&$vars) {
      $path = drupal_get_path_alias();
      if ($path == 'scores/completion') {
            $vars['title'] = 'Completion';
      }
}

The breadcrumb is still scores. How do I fix it?


texts: Check whether a field value exists in a custom table when a webform is submitted

texts:
I created a custom table named "test_customerid" for the use of select queries from the drupal database. The fields are naid (for national id), name and surname.

My aim is to display an error message if the user attempts to insert an National ID which is already present in the table. Otherwise, all information are added to the table "test_customerid". This must occur when a webform is submitted.

Here are my codes that I included in the webform.module of my drupal project (inside function webform_webform_submission_insert($node, $submission)):

$accessnode=$node->nid;
if($accessnode==6)
{
    $dataSub=$submission->data[1]['value'];//submitted value of National ID

    $result=db_query("SELECT * FROM {test_customerid} WHERE naid = :naid",array(':naid'=>$dataSub));
    if(!(empty($result)))//I also tried "if($result)"
    {
        drupal_set_message(t('The NID already exists.'), 'error');
    }
    else
    {

        db_insert('test_customerid')
        ->fields(array(

        'naid' => $submission->data[1]['value'],
        'name' => $submission->data[2]['value'],
        'surname' => $submission->data[3]['value'],
        ))
        ->execute();
    }

The problem is:
It displays the error message even if the user inputs a new National ID. I can't add new information in the table.

I even tried to convert the data into strings by using these before placing the variable into the insert query but it gives me the same error message:

$dataconvert=implode(",",$dataSub);
$dataconvert=serialize($dataSub);

I want that the query to take the National ID value from the webform and check out if it exists in the table. Can you someone help me with this please?


texts:
I'm developing an eCommerce website using Drupal Commerce.
I've been asked from my management to allow several users to use the 'create order' page in the admin store section (orders page) to stimulate sales.

The 'create order' page is sufficient by itself, but adding a product (line item) isn't that friendly, so I need to figure out a way to develop a 'browse products' function that'll allow me to add products to the order I'm creating.

Is there an easy way to do so? Maybe creating an all new 'create order' page? If so, what is the best appraoch without changing the drupal core code?


texts: Drush 9 can't find installed module, yields CommandNotFoundException

texts:
On my newly installed Drupal 8.4.4 sandbox installation, I've installed Drush 9 and the Devel module:

composer require drush/drush:^9
composer require drupal/devel

After running these commands, I installed the Devel module using the Extend tab in Drupal.

Drush seems be be installed correctly:

www-data@39e134dc7690:~/html$ /var/www/html/vendor/bin/drush version
Drush version : 9.1.0

The Devel modules seems to be installed correctly:

www-data@39e134dc7690:~/html$ grep -r devel-container-service /var/www/html/modules/contrib/devel/
/var/www/html/modules/contrib/devel/src/Commands/DevelCommands.php:   * @aliases devel-container-services,dcs,devel-services
/var/www/html/modules/contrib/devel/drush/devel.drush8.inc:  $items['devel-container-services'] = array(

But Drush doesn't seem to find the devel module:

www-data@39e134dc7690:~/html$ /var/www/html/vendor/bin/drush devel-container-services
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "devel-container-services" is not defined.

Are there any path settings I need to tweak to get Drush to find the Devel module?


texts:
card.module

drupal_add_js('jQuery(document).ready(function () {

  currentRequest = $.ajax({
  timeout:0,
  cache: false,
  url: pageUrl,
  dataType: "json",
  type: "GET",
  success: function(data){
  $("#edit-field-currency-type-und-0-value").val(data.currency);

  }

});

ajax request module

$items['mccurr/%'] = array(
'title' => '',
'page callback' => 'ajax_currency_type',
'access arguments' => array('access content'),
'page arguments' => array(1),
'type' => MENU_SUGGESTED_ITEM,
);

function ajax_currency_type($ccode){
 drupal_add_http_header('Content-Type', 'application/javascript; utf-8');
$query = "SELECT countries_country.currency
        FROM countries_country
        WHERE countries_country.iso2 = '".$ccode."'";
$data = db_query($query);

return drupal_json_encod($data);
}

Is this the correct way to return json data. If not, how should it be accomplished? I would like to return the data back to car.module.

Thank You


texts:
We have a webform that uses a webformhandler to post the submission to our credit card processor.

The webform works correctly when executed by itself, but when the form is embedded in a Secondary page I get a blank screen.  All the pages that use this webformhandler quit working after the last update to the Drupal core 8.7.5

The webformhandler collects data and writes it to the database, it then does the following:

include(drupal_get_path('module', 'xxx').'/redirect.html');
die();

The redirect_form.html is a page that tells the user we are sending them to our payment processor.  The payment processor uses the information we send to create a form that present to the user to collect necessary data.  On submit, the payment processor send us a confirmation code (fail/success).

I have narrowed the error to the statement:

include(drupal_get_path('module', 'xxx').'/redirect.html');

the content of /redirect.html is as follows:

<title>Payment Required</title>

Payment Redirect

We are now redirecting you to our e-commerce partner, xxx. xxx handles secure payments for xxxxxxxxxxx. If you are not redirected within a few seconds, you do not have Javascript enabled. Please enable Javascript, then click the button below to continue to xxx. Javascript must be enabled for you to continue--xxxxxxxxxxx requires Javascript for its processing.

<form action="https://xxx.xxx.xxx/xxx" method="get" name="mainForm" id="mainForm" >
<?php if (!empty($lname)) { ?>
<input type="hidden" name="lname" value="<?php echo $lname; ?>">
<?php } ?>
<input type="hidden" name="itemcode1" value="<?php echo $glcode; ?>">
<input type="hidden" name="amount1" value="<?php echo $cost; ?>">
<input type="hidden" name="ref1type" value="TRANSID">
<input type="hidden" name="ref1val" value="<?php echo $id; ?>">
<input type="hidden" name="ref2type" value="VALCODE">
<input type="hidden" name="ref2val" value="<?php echo $valCode; ?>">
<input type="submit" name="Submit" value="Continue" id="_s">
</form>


texts: How to set value for multivalue field in drupal 8 programmatically

texts:
I was saving poll choices Programmatically in Drupal 8. I have used Drupal8 Poll choices module.

$node_poll = Poll::load($pollid);
//print_r($node_poll);exit;
$i = array(13,14,15);
foreach($i as $key => $value){
  $node_poll->choice->setValue(
        [
            ['target_id' => $value]
        ]
  );
// But I want to save multiple target ids. now this is saving 15 all the time.

}
$node_poll->question->setValue([
  'value' => 'test',
]);
$node_poll->save();

The following snippet is working fine.

$node_poll->choice->setValue(
        [
            ['target_id' => 13]
       ],
       [
            ['target_id' => 14]
       ],
        [
            ['target_id' => 15]
       ]
    );

How can I, make target ids to be saved dynamically?


texts: Pager at the same page as opened item from pager list

texts:
Default functionality of pager is that pager shows list of items on multiple pages and you can possibly open one of the item (node or something else) by clicking on it (you will be redirected to a page of that item or node).

Problem definition:

  But what if there is a pager showing list of items (nodes) in left side of page and also opened item (node) from that pager in right side of page?

Problem is that the pager is present at the same page as opened item, therefore we have to force pager to show that position (page of pager) where the opened item is. Pager should not show first "page of pager" because that item can possibly be at another "page of pager".

My solution

I've found my own workaround in order to define what "page of pager" should be displayed by adding a 'findpage' parameter to the links of pager items. If this parameter is present in url, my code will calculate the "page of pager" on which this item is and redirect again to url with proper 'page' parameter that defines what page of pager has to be shown. My code is:

// find page of selected project if 'findpage' is present
if (isset($_GET['findpage'])) {

    $item_order = null;
    foreach($items as $key => $item) {
        if (intval($item)==arg(1)) { $item_order = $key; }
    }
    $page_no = floor($item_order/PAGER_PROJECT_COUNT);

  // redirect to the same url, but with page argument
  drupal_goto(arg(0).'/'.arg(1), array('query'=>array('page' => $page_no)));
}

// if there is no 'findpage' load project info and return template with pager...

There are links like project/5?findpage, project/12?findpage ..., where the number is id of the project. Callback of this links defined in hook_menu() is loading the project right after the code above (when the position of project in pager is known) and returning template (with pager and project info). So the process has two steps:

Call the callback when the link with 'findpage' parameter is clicked and find the position in pager
redirect from that callback to the same page, but without 'findpage' parameter and with 'page' parameter (project/12?page=2)

Question

Is there any suitable Drupal solution for this?


texts: Alternatives to creating a large number of one-use, page-specific blocks?

texts:
I'm working on a relatively large site using Drupal 7, and find myself creating a large number of one-use, page-specific blocks in order to embed custom content on some of the pages in this site. Is this the best way to go about doing this, or are there other alternatives?

I've used the Views module for a few things, but it is not always able to meet my needs.


texts: 3 reset button with auto submit for each and reset all

texts:
I created a view page with exposed filters in a block. I have three exposed filters in a view, with apply and reset button for each one.

It shows results based on the filters. It is working fine. But I need these filters each having its own reset button and reset all button resetting all three.

Can it be done through views? Should I handle through code? If so where I need to write the code?


texts: How to create a an image gallery with a short description below each image

texts:
I have created an image gallery using views and a custom content type, Photo. It has 2 rows of three images each. I have uploaded the 6 images via the Photo content type, added a body describing the images and then used the views module to create the gallery. However in the gallery only the images and their titles are visible.

What I want is that the title should be displayed below and also the description for images should appear.

Here's a wireframe of what I am trying to build: http://imgur.com/bVgJyEN


texts: Writing custom PHP code in Rules to check if a file field has a new value

texts:
I need to create a condition in Rules that evaluates whether a new file has been uploaded to afile  field. The file field has an unlimited value setting and I need to send out notifications to users every time there is a new file.

EDIT
After much experimenting, I came to the conclusion that the only way to do this would be by inserting custom PHP code inside the condition that checks if a new file has been uploaded to the field and return true or false.

I stress that checking if a field is changed/updated doesn't do the job, the code needs to check if there has been a new file added. I have been reading the Field API and it might be that "columns" is what needs to be compared, but I still need a lot of help with this.


texts: Show rendered node in jQuery modal through JSON

texts:
Whenever a link has a specific class I want to show it as a jQuery modal. I have added the neccesarry data attributes to the link in order to be able to use it as a modal.

I have also created a route for nodes that has a custom controller that is run when a node is viewed with ?_format=json. The controller returns the rendered node as JSON which seems to work fine.

To see the route definition look here.

Here's my controller:

public function json(EntityInterface $node, $view_mode = 'full', $langcode = NULL) {
  $build = $this->entityTypeManager->getViewBuilder('node')->view($node, $view_mode);
  $output = $this->renderer->renderRoot($build);

  return new JsonResponse($output);
}

And here's the JS that makes the link a modal:

if ($(context).find('.class').length > 0) {
  $(context).find('.class').each(function () {
    $(this).attr('data-dialog-type', 'modal').addClass('use-ajax');
  });
}

The only problem is that when clicking the link it gives an error saying:

  SyntaxError: JSON.parse: unexpected character at line 2 column 1 of the JSON data

Why does JSON.parse fail to parse the JSON data that JsonResponse generates?


texts: How to really remove the node title of an embedded node?

texts:
I want to have easily reusable pieces of content inside my nodes. I did something with Node Embed and Exclude Node Title.

But then I found out that Exclude Node Title is really dirty and simply makes the string itself empty, but there's still HTML, so I have

, which sucks for design (can be hacked around with CSS) but even more for SEO: I don't want my piece of reusable content to be indexed in Google, I don't want Google to start thinking I'm playing them by having an empty .

Is there a good fix for this? Or maybe there's a better way to do this, e.g. by embedding blocks inside the content?


texts:
I'm running Drupal 7 site on WAMP Server!

I'm using below code in a custom block to get data from the database :

$result = db_select('event', 'x')
  ->fields('x', array('address'))
  ->execute()
  ->fetchAll();
foreach ($result as $value) {
  print_r ($value);
}

Event is the name of node we use

Every time I try to reload the page, I get this message :

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

When I check WAMP PHP error log, there is nothing in it about it !

Any idea ?

Update :
Now is see I get this error :

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.event' doesn't exist: SELECT x.address AS address FROM {event} x; Array ( ) in eval()

I understand that it mean it can't find the table, but why ? I found it like that in every example on the internet !


texts: How to add Google recaptcha to a custom form?

texts:
I have a form I'm creating programmatically with a custom module, and I need to add the Google recaptcha to it. In the Google reCaptcha module's settings page (/admin/config/spam_protection/google_recaptcha/forms) I only see the login, register and comments forms and no way to add a custom form (like in the captcha module).

I googled as well as looked in the Google Captcha module's files and API file and can't find any hooks or info on how I can add the captcha element to a custom form. Any pointers would be appreciated!


texts:
I use minipanels in specific regions of pages (such as the main menu region) and they generally conain content that stays the same. How can I cache these minipanels?

Is the block caching system independent from the minipanels? I am not sure about that, since minipanels also show in the blocks configuration admin page.


texts: How can I enable my community to flag (report) bad content on my site?

texts:
I got a dev site with Drupal 7.

I want to give my visitors the ability to flag (report) content that is abusive or problematic.
I tried using the Flag module together with the Flag Abuse module.

The Flag Abuse module can reset (remove) the flag/reports only one time; after that, it removes the Flag/Report and the Reset Button (for administrators). That is very bad, and totally not practical. Imagine a bad user creates 2 accounts, adds content with account "A," and reports that content with account "B"; you as administrator will check the content, see whats wrong, fix it and press the reset button. After that, the report and reset buttons are gone. So the bad user can edit his content and nobody can report it to administrators. So that module is pretty useless.

Do you know a similar module to solve this problem? Or do you know how I can fix the reset button? I have managed to do the reset button appear multiple times, but I get a lot of errors: The button only works every 3rd time that is pressed.


texts:
I am using the following code to add a user:

  $roles = user_roles();
  $userinfo = array(
  'name' => 'user2',
  'pass' => '123456',
  'init' => 'user2d',
  'status' => 1,
  'access' => REQUEST_TIME,
  // This is where we are different from the default function.
  'roles'        => array(array_search('student', $roles) => 6),

);
$account = user_save(drupal_anonymous_user(), $userinfo);

I am getting this error message:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 column name is not        unique:
INSERT INTO {users} (uid, name, pass, created, access, status, init) VALUES (?, ?, ?, ?, ?, ?, ?); Array ( [0] => 15 [1] => user2 [2] => $S$DrkIg0KuBFO12eQ9nQ5ViSx4ydfcWS0nS1TMvaTjYyZyfmVniGgh [3] => 1333135061 [4] => 1333135061 [5] => 1 [6] => user2d ) in drupal_write_record()
(line 6975 of

I am wondering if someone can explain what is going wrong with me trying to add a role. ......


texts: How to hide revisions tab in quiz module?

texts:
I am using quiz module in one of my project.

The module seems to be excellent and it satisfies all my need.. thanks to the development team... http://drupal.org/project/quiz

In the mean time i need to do one additional task. And i am struggling  with it..

There is a tab called "Revisions" which will be enabled when some updates are done.

According to my criteria the "Revisions" tab should be hidden always... Is there any way to do this...

Thanks in advance..


texts: What message is throwing InvalidArgumentException(s) in my contact forms?

texts:
When submitting a contact form it redirects to a WSOD and this is logged:

Uncaught PHP Exception InvalidArgumentException: "$string ("Message") must be a string." at /Applications/MAMP/htdocs/onb/core/lib/Drupal/Core/StringTranslation/

I've tried creating new forms and setting them as default. It didn't work. I've also tried uninstalling and installing the contact module without much luck. Any thought on how to fix it or dig up what exactly is causing it?

Thanks.


texts:
How can i select all users wich have only 1 role.
For example i got 4 users:

User 1:

Role 1,
Role 2

User 2:

Role 1

User 3:

Role 1,
Role 2

User 4:

Role 1

How can i retrieve a list of users wich only got Role 1? But not Role 2.

$query = db_select('users', 'u');
$query->leftJoin('users_roles', 'ur', 'u.uid = ur.uid');
$query->leftJoin('field_data_field_full_name', 'n', 'u.uid = n.entity_id');
$query->condition(...);
$query->fields('u', array('uid','name','picture'));
$query->fields('n', array('field_full_name_value'));
$result = $query->execute()->fetchAll()

EDIT:

SELECT
u.uid AS uid,
u.name AS name,
u.picture AS picture,
n.field_full_name_value AS field_full_name_value,
f.field_function_value AS field_function_value,
pi.field_phone_intern__value AS field_phone_intern__value,
ur.rid AS rid,
COUNT(*) AS rolecount
FROM `dev_drupal_wurth-intranet`.users u
LEFT OUTER JOIN `dev_drupal_wurth-intranet`.users_roles ur ON u.uid = ur.uid
LEFT OUTER JOIN `dev_drupal_wurth-intranet`.field_data_field_full_name n ON u.uid = n.entity_id
LEFT OUTER JOIN `dev_drupal_wurth-intranet`.field_data_field_function f ON u.uid = f.entity_id
LEFT OUTER JOIN `dev_drupal_wurth-intranet`.field_data_field_phone_intern_ pi ON u.uid = pi.entity_id
GROUP BY u.uid;

This give me the result all the users and their number of roles. Now i tried to filter on this role count with 'WHERE rolecount = 1' but this just gives and sql error.

I'm not very advanced in sql :), still learning.

Thx


texts: Hook_node_grants: how do I access a user account field?

texts:
Here is my implementation of hook_node_grants:

/**
 * Implements hook_node_grants().
 */
function gcac_node_grants($account, $op) {

    // Declare $user as having global scope.
    global $user;

    // Permit a user to view the node if the node and user are assigned the same
    // group.
    ** if ($user->field_group[LANGUAGE_NONE][0]['value'] == $node->group && $op == 'view') {
        $grants['gcac_view'] = GCAC_ALLOW;
    }

    // Permit the user to edit the node if the node and user are assigned the same
    // group, and the user is the author.
    ** if ($user->field_group[LANGUAGE_NONE][0]['value'] == $node->group && $user->uid == $node->uid && ($op == 'update' || $op == 'delete')) {
        $grants['gcac_edit'] = GCAC_ALLOW;
    }
    return $grants;
}

I have added a field to my user accounts called 'Group' and populated it with a value for several accounts. Yet, here is the error that is being thrown:

  Notice: Undefined property: stdClass::$field_group in
  gcac_node_grants() (line 21 of
  /homepages/99/d99999999/htdocs/node-access2/sites/all/modules/gcac/gcac.module).

As you can see I'm trying to access the 'Group' of the current user so that I can compare it  to the 'Group' assigned no a node. I just want to access the value. Originally, I tried accessing $account->field_group[LANGUAGE_NONE][0]['value'], but I got the same error.

I can go grab it from the database, if I have to because I know I can access $user->uid, but surely the user module is providing my the field for me use? Thanks.


texts: Error on module admin configuration page

texts:
I cannot find any documentation or similar problem with mine.

Whenever I am trying to go to the configuration page of some installed module like "Pagetitle" module and Add menu links module.

The page is at unformatted layout, doesnt seem to load the css or javascript, and some links in the configuration page are not showing

Here is the screen shot of the configuration page of page title module (I am logged in as administrator).

I dont know whats causing this, I have disabled modules Im not using and updated the core files as well as all installed modules I can not configure the module.

Please any idea to solve this?


texts: I am using the AddThis module on my site.  Can this be configured to use short URLs instead of the native ones?


texts: User or Content Type for employee directory

texts:
I am trying to create an employee directory using drupal 7. I have the following fields for each employee profile:

• Name
• Department
• Job Title
• Phone
• Email
• Optional photo
• A narrative-paragraph
• Note

Here is my requirement:

• Data (including photo) can be entered/updated by each employee using their login/password.
• Data can also be entered by the administrator
• Employees cannot remove their name.
• Admins can see when information was updated.
• Listing that is searchable by name and department

I could not decide which is the best way - content type 'employee' or user role 'employee' with profile fields.
If I create user as employee, how can I have the feature of the red information "updated" which we have in the content list (admin/content) when each content was updated?


texts:
I have installed the Recruiter distro.
I have also installed the Respond and Selectivizr libraries under site/all/libraries.
However I still take these messages:
Warning: file_get_contents(sites/all/libraries/selectivizr/selectivizr.min.js): failed to open stream: No such file or directory in omega_build_js_cache() (line 388 of /var/www/html/recruiter/profiles/recruiter/themes/omega/omega/includes/scripts.inc).

and

Warning: file_get_contents(sites/all/libraries/respond/respond.min.js): failed to open stream: No such file or directory in omega_build_js_cache() (line 388 of /var/www/html/recruiter/profiles/recruiter/themes/omega/omega/includes/scripts.inc).

How can this be fixed?
thanks


texts: Making the calendar stay on a specified month

texts:
I am using the FullCalendar module for Drupal 7. I need to set the calendar to stay in a specific month and not change months according to the actual current month. Im assuming that as soon as it hits January, the calendar will switch to the month of January.

FullCalendar also highlights the current day of the month in yellow. Is there an option to disable that feature?

I tried looking through the options in views and fullcalendar's settings, but was not successful. My guess is that I have to edit some of the javascript inside the module or create a custom calendar. (which I found the  documentation  to be a little confusing)

I just started drupal 2 weeks ago so im still trying to get the hang of it.

Thanks in advance


texts: Why are nodes not saving, and redirecting to edit instead?

texts:
When editing a node and attempting to saving it, the user is redirected to the edit form with no error message and the node is not updated. This situation is similar to the problem described in "Nodes do not save, but instead redirect to edit page again", but in Drupal 6 and in all content types. The nodes have at least one field, FileField, which is common to all nodes but I haven't had any problem with it in other sites. There're no errors, nothing in the logs. I'm clueless.

Edit:
I've identified that the problem is with content types that have a FileField field. Sadly, I still don't have a clue of what could be causing the problem.


texts:
I'm using a template that has this on the portfolio.tpl:

But I don't want to display the date of node created.
So, I added in the content type portfolio a field "date_field" (please see picture)

What I need now is to display this field on the tpl, replacing the "$node->created".

This is what I tried:

But it doesn't work.

How can I accomplish this?


texts: How to alter menu parent select list on node form?

texts: I would like to modify select list for choosing menu parent for creating node (from the Menu tab). I am looking in $form variable but I don't see this list data. How can I alter this select list?


texts:
I have a content type called as People that lists all users on the site.

Next i have a view PeopleList that lists the content type People in a list form and has a pager.

I have customized the pager to look like a Load More button that adds the next set of People and the list grows on the same page. Now when i view a node and hit browser's back button the pager comes to first state only that is on first page .

For example- If i have 30 people listed and i hit load more next 30 add up and now if i view node say number 51 and hit browser's back button the pager comes to its default state that is first 30 people listing only.

How to solve this issue. What should i need to incorporate to get this sorted. Please guide.


texts:
I have an interesting problem.
I try to build some kind of related content block.

Sortly, I use tags as a channels/catagories. For example; there is a content like best Spanish football clubs and this content got three tags; Barcelona, Real Madrid, Atl. Madrid.

For me, this three tags are channels and they got own pages. I try to find related channels with the best way.

I add a image and try to explain there. I give a example with three content.
That i need is last part of image, means counts of tags.
By this way i understand blue is most related with green.. after that yellow. Because many times they have taken place with together.

I am aware of this is unusual method and for this i cant answer anywhere.

Please help me, thanks :)


texts:
I can't seem to figure out, are you not allowed to chain db_select methods?

$nid = db_select("node", "n")
            ->fields("n", array("nid"))
            ->condition("f.entity_type", "node", "=")
            ->condition("f.deleted", 0, "=")
            ->condition("f.field_products_product_id", $entity->product_id, "=")
            ->addTag("node_access")
            ->join(
                "field_data_field_products",
                "f",
                "f.entity_id = n.nid"
            )
            ->execute();

I have the above, and it just won't work it keeps erroring on the join. Basically I want to do

SELECT nid FROM node JOIN field_data_field_products ON entity_id = nid WHERE ...


texts: How to truncating url at the word instead of limit

texts:
Background info:
By default, Pathauto has a maximum alias length is 100.

Request: It would be nice if this could truncate at the last space before the limit, instead of truncating directly at the limit, so that there are no partial words in the URL.

What is the easiest way to do this Drupal?


texts: Is responsive.desktop.css for desktop & laptops design?

texts:
I am also using the Adaptive theme and same question raised. I checked their documentation, but they do not have point to point instruction.

Its css file has following file,

global.base.css
global.styles.css
responsive.custom.css

1. responsive.desktop.css
2. responsive.smalltouch.landscape.css
3. responsive.smalltouch.portrait.css
4. responsive.tablet.landscape.css
5. responsive.tablet.portrait.css

So, if we see that five different screen size listed in adaptive theme as above, Do we have to use response.desktop.css for desktop/laptop design or just global.style.css?
Another thing when we see the adaptive theme setting at admin/apperance/ATthem(sub)/setting.....we see three option Standard Layout, Tablet Layout and smalltouch layout....So Tablet and Smalltouch are understable, they have their own css which means last 4 files, but for standard it is responsive.desktop.css?


texts:
I have a content type called slides, for now it has an image field, a body, a title and a link field (linked to the page that the slide is advertising... by the way some pages are views).

So for now I made a Views block to make them all appear in a Slideshow and it works. But now I would like to create a new Views block that will only show the slide related to the page you visit. So for example, on the homepage you have the slideshow of all my slides but when you click on one of them, you go visit the specific page advertised (e.g. contact slide linked to contact page).

But when you visit the page, you should see the new block with the specific slide related to the page. I search for answers and I think Contextual filter is the option to use in Views, but I am not accustomed to it and the examples that I found are not exactly using available value for me.

I am thinking I might be able to filter the slides vs the path they have vs the page they are on. But I am not sure if it's possible and have no idea how to do it. So please let me know how or send me a few thoughts on where to look at. Thanks!


texts: Webform using popup onload module drupal 7 . I have created webform and installed popup onload module. could you please let me know on how to add the webform in popup content


texts: How to add extra fields to user profile?

texts:
I'd like to add additional fields to the user profile. I'd like user to be able to edit almost all the information I store in the database about him.
I have some ideas: maybe it's possible to do using form api.


texts:
I have a view that has a generic title, but uses contextual filters to show the data. I would like to contextually update the title, but am not seeing a solution to this. Is this possible?

Page URL: /person/jon-doe/roster

Page Title: Jon Doe (based on %2)


texts:
I am attempting to use a pre-configured instance of a plugin.  The plugin is of type @CommercePaymentGateway.

I am currently trying to use something like:

/** @var PaymentGatewayManager $manager */
$manager = \Drupal::service('plugin.manager.commerce_payment_gateway');
$manager->getInstance(['module' => 'commerce_paypal']);

But I'm getting the error Error: Call to a member function getInstance() on null.  However, using kint(), $manager is clearly an instance of Drupal\commerce_payment\PaymentGatewayManager.

I see what I think is the instance configuration in the config table under commerce_payment.commerce_payment_gateway.paypal_ec.  But that paypal_ec part is specific to my site.

How do I get an instance of a plugin?


texts:
Possible Duplicate:
  Get a node ID from the URL

I have two content types which one referenced to another by url widget, when i click on the link the node id passing with the url.
How can i get this nid from the url?
Is there some function for that?
Thanks


texts:
How should I check if any taxonomy term contains content or nor. for e.g
parent
 --child1
  --child1.1
  --child1.2
  --child1.3
 --child2
 --child3
if let say child1.1 does not contain any content then this term should not appear in the list. Whenever content is added to the content type having this term reference field it will automatically appear appear in the list.


texts: what happen if i have the same route as path alias?

texts:
What if I have the following route in a custom module and a path alias that is equal to the route path?

mymodule.contact:
path: /contact
defaults:
    _controller: Drupal\mymodule\Controller\MyController::contact
requirements:
    _permission: 'access content'


texts: How to only display languages in language switcher block where a translation exists?

texts:
I need to enable thousands of languages on my Drupal 7 site, but I do not want to incur the rendering overhead of creating the language switcher sidebar for every language. The default behavior for the language switcher block is to show languages which do not have translations in gray font and struck out.

How would I modify the language switcher block to only show active links, i.e. only display the languages for which a translation exists? I looked at this code from this post but need help adjusting it for my needs:

<?php
  function YOURTHEMENAME_links__locale_block($variables) {
  foreach($variables[links] as $key => $lang) {
    if (isset($lang['attributes']['class']) && in_array('locale-untranslated', $lang['attributes']['class'])) {
      $variables['links'][$key]['href'] = '<front>'; // Set here any page link...
    }
  }
  return theme_links($variables);
}

What should the code be, and where do I put the code in my theme?


texts: How do I set up default.settings.php to use it for development, testing and production sites?

texts:
I use dev, tst and prd environments for my Drupal 7 site set up.
I use git for version control.

I would like to eliminate one manual step I need to do when moving site from dev to tst and from tst to prd.

Now I have to update settings.php separately for dev, tst and prd sites.

I would like to set up default.settings.php file so all the settings for dev, tst and prd are stored in one default.settings.php and. after copying to settings.php, Drupal will pick right settings depending on the environment.

I am looking for something like the pseudo code below:

common.settings

if environment = dev then
   ...
   dev.settings
   ...
else if environment = tst then
   ...
   tst.settings
   ...
else if environment = prd then
   ...
   prd.settings
   ...
end if

Do you know how to do this for Drupal 7, exactly?


texts: What to do when Drupal can't check for updates?

texts:
I am trying to check for updates using the core update module but I keep getting this error:

  There was a problem getting update information. Try again later.

I am checking from /admin/reports/updates.  When I press "Check manually," the screen quickly skips through the progress bar and then immediately returns the error (there are dozens of modules installed, so it normally isn't that fast).

The "Recent log messages" report has no information.

I'm trying to do this from a multidev environment in Pantheon; until a few hours ago, update checks were working fine, but after I created some new environments, it seems that I can no longer check for updates.

Uninstalling and re-enabling the update module does not fix the problem.


texts: How to eliminate duplicate results in a view?

texts:
I have a view in a D8 site displaying results of the content type "Projects", sorted by the taxonomy "Project area":

I'm getting duplicate results in my views output.
I've tried both setting the query settings to "Distinct", and turning aggregation on, neither of which removes the duplicates.
Is there a solution to this? I'm not so experienced with Drupal, so any simple explanations?


texts:
I have a view that displays a content type "offers" for a specific "task" (content type), the "task" content type has an entity reference field that reference an "offer". The view shows the title of the "offers" and in front of each title a button "Select this offer for your task"

I want that when I click the button "Select this offer for your task" set the value of the entity reference field I have in the "task" node, for reference the offer I have selected from the view

Is this possible?
Thanks for your help.


texts: What does 'Rebuild Permissions' actually do?

texts:
I've been working with a lot of custom content types lately, and I keep getting a message to rebuild my permissions.

It seems like it happens everytime I create a new content type. Is this normal behavior? And what exactly is happening when I do this?


texts: How to bypass menu link access permission

texts:
I have added some links from the admin page to a menu, but these links are not displayed in anonymous.
Certainly anonymous doesn't have access permission to the links, but I want to display the menu.
is there a hook or something that bypass access permission?
Thank you.


texts:
On a Drupal 6 site, I get a server error whenever I tried to access any of the content types, like:

index.php?q=admin/content/node-type/page

and I get Internal server error in my browser.

I can see the list of content types:

index.php?q=admin/content/types/list

But whenever I click on 'Edit' of any of the content types the error occurs.

The site works fine otherwise. I appreciate your hints to solve this problem.


texts: Redirect to webform from controller and back to custom form

texts:
I have a use case where I'm creating a custom form, but for business reasons, I need to obtain customer information in a separate webform prior to granting access to my custom form. So my workflow needs to be as follows:

Customer attempts to access form at /my-custom-form url
Customer is redirected to customer information webform at /customer-information-form
Customer fills out customer info form and submits it.
On submission, customer is redirected to /my-custom-form url.

My thought was to use a controller for the /my-custom-form url, and just do a redirect to the webform, and then when the webform has been submitted, redirect back to the form, having to note that the webform is submitted. However, what I'm having problems finding is how to redirect using an internal URL using the Drupal\Core\Url class. In order to use the redirect() method that is included in the ControllerBase class, it has to be a defined route name (e.g. my_module.my_custom_route. If I try something like this:
$url_object = \Drupal::service('path.validator') ->getUrlIfValid('/customer-information-form');
$route_name = $url_object->getRouteName();
$this->redirect($route_name);

$route_name = entity.webform.canonical, which throws an error, since that's a generic route name.
So my question is, how do I redirect my user to my webform using an internal path, especially when it is just a generic webform?
UPDATE: So the ControllerBase class has a redirect() method that from what I've seen, should allow me to redirect. However, when I use this code in my controller function:
$url_object = \Drupal::service('path.validator')->getUrlIfValid('/my-custom-form');
$route_name = $url_object->getRouteName();
$route_params = $url_object->getRouteParameters();
$this->redirect($route_name, $route_params);

but when I run it, I get an error that my controller must return a response. If I add some simple markup like so
return [
  '#type' => 'markup',
  '#markup' => $this->t('Hello, World!'),
];

Then I get that markup instead of the redirect happening.  What is the purpose of that redirect() method if it doesn't redirect?


texts: How to get error messages to display on the form, rather than after the page is refreshed?

texts:
I have a form that has radio buttons and the user needs to select at least one option. If they do, a modal window will pop-up.
If they don't, I need to redisplay the form with the saved values and the message "Please select one item" in the message area.
Right now, if they don't select one item nothing happens and then the message is displayed after the page is refreshed.

public function buildForm(array $form, FormStateInterface $form_state, $form_config = NULL)
{
    if (!empty($form_state->getBuildInfo()['args']['form_ajax'])) {
        $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
        $form['actions']['submit']['#ajax'] = [
            'callback' => '::crmform_ajax_submit',
        ];
    }
    return $form;
}
public function validateForm(array &$form, FormStateInterface $form_state)
{
    $selected = $this->crmform_validate_element_selected($form_state, 'radio');
    if (!$selected) {
        $form_state->setErrorByName('form', t('Please select one item'));
    }
}
public function crmform_ajax_submit(&$form, FormStateInterface $form_state)
{
    $errors = $form_state->getErrors();
    $response = new AjaxResponse();
    if (!empty($errors)) {
       $form_state->setRebuild();
       return $response;
    }
    $response->addCommand(new OpenModalDialogCommand($dialog_title, $form_data, $options));
    return $response;
}


texts:
Can I use hook_css_alter inside of hook_form_alter. I need to unset a css file only on certain forms and only to non-admins. This is what I have but it doesn't work.

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Session\UserSession;

function mymodule_form_alter(array &$form, FormStateInterface $form_state,  $form_id) {
  $user = \Drupal::currentUser()->getRoles();
    if(in_array("administrator", $user)) {

    function mymodule_css_alter(&$css) {
      unset($css['core/themes/stable/css/system/components/tabledrag.module.css']);
    }
  }
}


texts: From showcase website to e-commerce website

texts: I have a big Drupal 7 showcase website, that needs to evolve in a e-commerce website. I know Drupal e-commerce but I don't know if it's ("easily") possible to upgrade a content type to a "product" content type that can be added to a shopping cart?


texts: Hook_form_FORM_ID_alter problems with custom validating

texts:
I have created a custom module for altering the user_register_form and with custom validating I have an error:
Notice: Undefined index: values in custom_register_validate_password() (line 17

This is the 17 line:

if (in_array($form['values']['pass'], $badpasswords)) {

I cannot understand what I'm doing wrong. Here's the full code:

<?php

    /*
     * Implements hook_form_FORM_ID_alter().
     */
    function custom_register_form_user_register_form_alter(&$form, &$form_state, $form_id) {

        $form['#validate'][] = 'custom_register_validate_password';
        //krumo($form);
     }

     /*
      * Custom password validation
      */
    function custom_register_validate_password($form, &$form_state) {
        $badpasswords = array('pass','password');
        if (in_array($form['values']['pass'], $badpasswords)) {
            form_set_error('pass', t('Please use a more secure password!'));
        }
        krumo($form_state);
    }


texts: Some of my site's pages are retrieving the .css files from a different directory

texts:
I've been working on theming a Pages page on my local machine. This has been going fine, but now I have pushed the changes to a remote server and see that the site is trying to retrieve the .css file from the wrong directory.

On my local machine, this is fine. On the remote machine, it seems drupal is trying to retrieve the .css file from sites all:

@import url("http:/mysite.com/sites/all/themes/custom/mytheme/css/main.css");

Where as my local version has:

@import url("http://localdev.mysite.com/sites/mysite.com/themes/custom/mytheme/css/main.css");

Would anyone know why this is and how I could correct it?


texts: Drupal 7 Apache solr - how to index pages content instead of nodes content

texts:
I have a drupal 7 website with pages that include multiple nodes and I use Apache Solr as search module. It works but the results are very messy.

This is a page structure exemple:

As you can see, I have multiple nodes defined on my page. I'd like the indexer handles the content as page content but not like node content. In other words, I don't want the indexer handles this page as an addition of nodes but like an unique content.

In this case, I'd like to get a page URL as result but NOT multiple node URLs.

I hope it's clear enough.
Thanks


texts: Drupal Commerce: Can I split payment over multiple credit cards?

texts: I need to enable my customers to be able to split payments over multiple credit cards.  Is it possible with Commerce, and where can I find documentation to that end?


texts: Site affected by PSA-2014-003, revoke all public keys?

texts:
I didn't patch my website right after PSA-2014-003, it run about one week unpatched.

Now, I'm moving my website to a new server, using an old database backup. In my old server, I used an passphrase protected authentication key to login to the server over ssh. The website in question doesn't use SSL (https).

In the chart on http://drupal.geek.nz/blog/your-drupal-website-has-backdoor, is says: "Revoke public keys for any of the server's private keys." I don't really understand what does it means. Does it refers to certificate-authenticated SSL (https://) or does it refers to the authentication keys used to login to the server over ssh? Do I have to generate a new pair of authentication keys for my new server?

Thanks!


texts:
I have a site based on drupal. Few weeks back an error appeared on our site

  Fatal error: Cannot redeclare file_entity_file_presave() (previously
  declared in
  /home/newprofi/public_html/new/sites/default/modules/file_entity/file_entity.module:177)
  in
  /home/newprofi/public_html/new/sites/default/modules/file_entity/file_entity.file.inc
  on line 37

it happened after an upgrade that distorted our theme, and only restoring could have saved that.

i tried to find duplicates of that module, but there is nothing on our servers.
Is there anything else i could do to fix that?

Thanks,
Noam


texts: How to store content type structure (and paragraphs type) in a module

texts:
I have a content type (made of field name, field type, field settings, etc...) that contains also a paragraph type field (entity revision reference field) and I would like to use it in some other projects.
My idea is to create a module and when this module is enabled, the content type (and paragraphs type) is added to the project.
Note 1: I don't want to store the data, only the structure
Note 2:This is a D8 question


texts:
When should serial be chosen over an int when choosing a data type for a table column? Are they separated out for indicating a difference in the data types. If so what type of data should be stored as serial and as int?

Examples would be greatly appreciated.


texts: How to change "Add new node" button label?

texts:
I have created two content types "A" and "B".
I have included content type "B" in content type "A".
So when I am adding a content of type "A" that time it shows me a button "Add new node".
I want to change this label with another label.
Also when I click on this button it display form with fields of content type "B". This also shows a button with label "Create Node" and a title "ADD NEW NODE". I also want to replace with another string.
I have used form_alter() hook.

Can any one guide me how can do this?


texts:
I want a tree structure like below:
-parent1
 +child 1
 +child 2
 -child 3
  +sub child 1
+parent2
+parent3
...
 and when a user click on lets say "child1" then items in views related to them will be filtered.
How can I achieve this?Can any one please help me?


texts:
i need to add custom css id/class to views row after row first. example:

in default i see this :

Now, I need change this to:

Actually i need to print result like this:

views-row-first
 <-- example: 100% width

views-row-even
 <-- example: 50% width +
 views-row-last
 <-- example: 50% width

With this i combination of one and two columns. 100% width and one column for first row And at the bottom 2*50% and two column for other(even/odd/last). How to?

NOTE: i work with content-node / unforrmatted list.


texts: Membership contribution with profile required 'on behalf of' prefilled

texts:
I'm helping a nonprofit with a Drupal/CiviCRM site. They track memberships in CiviCRM which are associated with an organization as the primary member, and individuals linked to the organization by relationships to share this membership.

Using the "CiviMember Roles Sync" module, these individuals are granted access to a member role in Drupal.

I've created a contribution page in CiviCRM for membership signup or renewal, and since the primary member is actually the organization, I've checked "Allow individuals to contribute and/or signup for membership on behalf of an organization". Since it is a requirement, I've also made this required instead of optional. (Screenshot below).

The help text here indicates that "logged in users will be given a choice of selecting from a list of organizations that they have a permissioned relationship with OR entering a new organization" -- however, I am not able to produce the select/list despite assigning "view and update information" permissions in both directions on the relationship between the individual and the organization. The contribution page just allows typing in a text field for the org name, which will produce a lot of duplicates and extra work.

Am I missing a step to get the select list which will prefill the org's information?


texts: Display a value for an empty CCK Field without setting a default value?

texts:
I have a few fields in one of my content types that will not always have values entered for them. One such field is "Booking Contact." When content is created, if the author does not know the booking contact, then they are supposed to leave the field blank. However, this means that the field data is empty, and the field does not display in the node at all. I'd like to display a message for these empty fields-- similar to Views' no results text -- so that users can see that there is not a value assigned to the field. What would be the best way to go about doing this?

EDIT: I'd like to avoid using "default value" to define this. The message I want displayed doesn't make as much sense in the creation form, and will likely be confusing to users. Unless, of course, there's a way to hide the default value in the creation form.


texts:
I am trying to use the Google Chart Tools module to display graphs with data regarding content types inside a view (Views module). For example, lets say I have a content type called Car that has a field called Color. I would like the graph to display, say, the number of Cars that are blue, red and green.

Is there a way to do this using only the the Google Charts, Views, and Core drupal modules or do I have to download a seperate module? Is there another Charts module that would do what I am asking for more easily than Google Charts?


texts: is autopostback available in jQuery or Ajax

texts:
for Drupal 6 sites. I know that autopostback is an ASP.NET piece of functionality. Is there something similar that I can apply in Drupal 6. I want to apply autopostback to a drop-down select list in a view.

All I have found so far is this piece of code:

document.getElementById('mytextbox').AutoPostBack = true;


texts: Create a view to show the list of users who have certain permission

texts:
How can I create a view that lists all users with a certain permission?

When I use permission as a filter criteria in Views, only admin account is displayed for some reason.

I'm probably missing something too obvious, but can't figure it out for some time.

Here's an export of a very basic view. Try it out on a website that has more than 1 user who can access published content.

$view = new view();
$view->name = 'temporary';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'users';
$view->human_name = 'Temporary';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Temporary';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
/* Sort criterion: User: Created date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'users';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: User: Active */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'users';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: User: Permission */
$handler->display->display_options['filters']['permission']['id'] = 'permission';
$handler->display->display_options['filters']['permission']['table'] = 'role_permission';
$handler->display->display_options['filters']['permission']['field'] = 'permission';
$handler->display->display_options['filters']['permission']['value'] = array(
  'access content' => 'access content',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'temporary';

Any ideas?

Thanks!


texts: How can the author choose when to publish an article, whether the article gets a teaser or not?

texts:
Is there a possibility for the author/editor to decide - when publishing - whether the article (the content type) gets a teaser or not?
This is important for the look of the article on the front page.

I thought so far that would have to be defined before in the content Type.


texts: Search API and Domain Access: Filter user per domain

texts:
I've got a site with multiple domains using Domain Access.
I want to display a search form on each site that searches for users on that site.

I'm using a modified version of the code here (that code works fine when searching for nodes) but it doesn't work.
When searching it always return an empty result.

Here's my code:

/**
* Implements hook_entity_property_info_alter().
*
* Adds an entity property for the domain access of the user.
*/
function custom_search_users_entity_property_info_alter(&$info) {
  $properties = &$info['user']['properties'];

  $properties['custom_search_users_domain_access'] = array(
    'label' => t('Domain Access Information'),
    'description' => t('The domains to which the user has access.'),
    'type' => 'list<integer>',
    'getter callback' => 'custom_search_users_get_domain_info',
  );
}

function custom_search_users_get_domain_info($data, array $options, $name, $type, $info) {
  return (!empty($data->domain_user) ? $data->domain_user : NULL);
}

/**
* Implements hook_search_api_query_alter().
*
* Adds a filter for the current domain.
*/
function custom_search_users_search_api_query_alter(SearchApiQueryInterface $query) {
  $domain = domain_get_domain();

  $query->condition('custom_search_users_domain_access', $domain['domain_id']);
}

So basically what I've changed in my code is the use of $data->domain_user instead of $data->domain to comply with the user object.

Anyone got any idea of why this doesn't work?


texts: Boolean single on/off field - how to make it NOT render the off option?

texts:
I'm having some issues with boolean field. I want to have few fields that can be turned on/off, which will be used to show if something is available in the content.

So I thought single on/off checkbox is the way to go. Well, apparently not because even if I don't select the checkboxes, they're still rendered in the code. And I need them to NOT render.

Checkboxes/radio buttons works in this way, but it creates 3 selectable options (on, off, not available) whether I would like to have only one checkbox.

I also tried using List (text) for my needs, but here I'm limited by the fact I can't add individual CSS id/classes to every item in the list.

My target is using these lists/checkboxes, hidding them in CSS and replacing with icons. I did something like this few months ago but now I can't remember how exactly I achieved what I needed.


texts: In Drupal 8, how to automatically create a term in a specific vocabulary from the field present in node/add page?

texts:
Steps to reproduce -

Create two new vocabularies at - SITE/admin/structure/taxonomy/add
Add them as fields to the article content type. Set number of values to be unlimited, set form display to Autocomplete (tags style)
The new vocab fields do not work like the Tags field

Could you help me learn how to automatically create a term in a specific vocabulary from the field present in node/add page?


texts:
I had a working drush 5.6 (manually installed) on OSX (Yosemite) and decided I wanted to upgrade to the latest drush 7 version. I ended up with version 6.0-dev.

I followed the installation isntructions and decided to use homebrew to install composer and drush. So far so good, but the thing is, I can't seem to get to the latest "master" dev version: I'm stuck on 6.0-dev.

I tried different ways like:

brew install --HEAD drush
brew switch drush HEAD

and:

composer global require drush/drush:dev-master
composer global update

My composer.json looks like this:

{
    "require": {
        "drush/drush": "dev-master"
    }
}

which drush:

/usr/local/bin/drush

drush status:

 PHP executable        :  /usr/bin/php
 PHP configuration     :
 PHP OS                :  Darwin
 Drush version         :  6.0-dev
 Drush configuration   :
 Drush alias files     :  /Users/albert/.drush/aliases.drushrc.php

Any ideas?


texts: Custom Views Bulk Operation using Batch API

texts: I am using Views Bulk Operation for updating custom value. I created a custom Operation using hook_action_info. How can I use Batch API with my custom action if I have to Operate on maximum nodes.


texts:
I have 12 content types and a view that shows the title and description of each piece of content.

I want to sort the results of the view as follows:
First, node types 1, 4, 5 and 9.
Then, node types  2, 6, 10  and 12.
And finally, node types 3,7,8 and 11.

Is it possible to sort the results of this way?

Thanks.


texts: Issue while modifying and importing the manually content type data

texts:
I have a scenario like this:

I am using Feeds Importer to import one content type data. I am using GUID field as the unique field. Also, I am exporting these all the nodes of this content type using Views into a .csv file.

My problem is that users can create nodes using the Feeds Importer and also manually in the Drupal admin console.

While I export the nodes of the content type, it contains all nodes (manually created nodes and Feeds imported nodes). There will be no GUID for the manually created nodes.

In this case, how can I resolve the issue of re-import of this data into the Drupal tool?

Is there a way to update the GUID field in the database whenever a new node of this type is created? This will resolve the issue.


texts:
Is it possible to programatically update a module in Drupal 6? In otherwords, run an update as if running from update.php. I assume so. I looked at update.php and saw the function

update_do_once($module, $version, &$context);

I can't say I understand what $context is, and I can't get this working even after doing a full bootstrap. I get no errors, just nothing happens.

Has anyone every done this before?


texts:
I am creating a form which uses the form API '#ajax' attribute, and I need to make changes to $form_state when the AJAX-enabled button is pressed. Here's what I've got:

Inside my form builder function:

...
$form['some_fieldset']['add_more'] = array(
      '#type' => 'button',
      '#value' => t('Add more rows'),
      '#ajax' => array(
        'wrapper' => 'some-fieldset',
        'callback' => 'my_module_settings_ajax',
        'method' => 'replace',
        'effect' => 'fade',
      ),
    );

...

And here's the callback function:

function my_module_settings_ajax($form, $form_state) {
  // Make a change to $form_state
  if ($form_state['some_fieldset']['add_more']) {
    $form_state['values']['some_fieldset']['table'][] = array('first_field' => '',
                                                                'second_field' => '');
  }

  return $form['some_fieldset'];
}

The change I've made to $form_state seem to be lost once the callback has finished. Is there any way to make a change to $form_state in this function, or there any other function I should use for this instead?

EDIT

As it turns out, the callback is the wrong place to do this logic. Instead, at the top of the form builder function, I added this:

// Respond to AJAX-triggger:
// Add new row
if ($form_state['triggering_element']['#name'] == 'add_more') {
  $form_state['values']['some_fieldset']['table'][] = array('first_field' => '',
                                                                'second_field' => '');
}

Of course, I had to give the button the name:

$form['some_fieldset']['add_more'] = array(
  '#type' => 'button',
  '#name' => 'add_more', // <-- Right here
  '#value' => t('Add more rows'),
  '#ajax' => array(
    'wrapper' => 'some-fieldset',
    'callback' => 'my_module_settings_ajax',
    'method' => 'replace',
    'effect' => 'fade',
  ),
);

And now it works!


texts: Why is a content type's node twig template being used by taxonomy term?

texts:
New to Drupal (using drupal 8) .. please bear with me.. I 've tried to find an answer, but I couldn't...

I have created a content type, say 'course' that holds info about a particular course.  I have successfully created and placed a twig template, node--course.html.twig and through there I can control the layout of all dynamically created courses.

So far so good .. However, that course is linked to a simple taxonomy (entity reference) which has only two terms, say 'theoretical' and 'classical'.  Say that this value is held within field_course_direction.

Now the problem .. When I output any course I use my node--course.html.twig and somewhere I have something like:

Direction: {{ content.field_course_direction }}

So I get the appropriate value (say 'classical') as a link, which points to a view of all courses under 'classical'.

The problem is - that page which is something like 'my-site.com/taxonomy/term/37' for me, again uses the node--course.html.twig template, and as a result comes up really weird with some HTML stuff I dont want there.

I have enabled twig debug, and in the HTML source I indeed see the 'X' next to the template .. But why is that happening? What does this have to do with my 'course' content type? Why is that template being picked up? Is it because of the relationship between them? ...

I 'm quite confused .. Obviously I haven't understood how templates should be named and used, but still I can't get why that view has anything to do with a specific template such as node--MY_CONTENT_TYPE.html.twig ....

Thanks a lot for your patience and time ..

PS - I could replace my code with something like:

Direction: {{ node.field_course_direction.entity.label }}

and thus get only the 'raw' value, in this case a simple string saying 'Classical' without the link, but this is not what I want/ask .. I ask why is that template being picked up by a page that seems completely irrelevant to me ...


texts: Rule action to remove a product from the cart? (using the commerce module)

texts:
I'm using the commerce module to show product in a site.

I need to create a rule on the event of Calculating the sell price of a product which should involve removing products from the cart in a given condition.

I see that there is an action to Add a product to the Cart. But how do I remove a product from the cart?

Should I use the Remove from list action?


texts: How can I get the file id if I use the file_save_data function?

texts:
I will be adding new media files in D8 programmatically, how do I determine what the fid should be for each one? also how do i put the actual file contents into the media type?
this is my code

$file_name=$file_info['file_name'];
  $file = file_get_contents($fullpath."/".$file_name); // string
 $filesaved = file_save_data($file, 'public://'.$file_directory_name."/".$file_info['file_name')',FILE_EXISTS_REPLACE);
  $fid = ???;
  $static_media = Media::create([
      'bundle' => 'document',
      'uid' => '1',
      'langcode' => Language::LANGCODE_DEFAULT,
      'status' => Media::PUBLISHED,
      'your_image_field_name_here' => [
        'target_id' => $fid,
        'alt' => t('foo'),
        'title' => t('bar'),
      ],
    ]);
    $static_media->save();


texts: Edit content created by users with the same role

texts: Is there any module that would allow me to edit/delete nodes created by users with the same role I have?


texts: How to remove "Main Menu" title from Stark Theme

texts: I want to have just the main menu list elements displayed through only the stark theme and I can't seem to figure out where I should go to delete the title "Main Menu" that is above the main menu elements.


texts: Showing only one feed from different URLs

texts:
I am using the Drupal 7 core module feed aggregator to list rss feeds from different websites.
I am able to show 5 feeds in a block provided by the module itself as well as using views too(aggregator term type).
I want to show only one recent feed from different URLs which are provided by me in the aggregator module config. Right now it is showing 5 feeds from only two URLs.
It should come as:

*Most recent Feed from 1st URL

*Most recent Feed from 2nd URL

*Most recent Feed from 3rd URL

*Most recent Feed from 4th URL

*Most recent Feed from 5th URL

Can anyone please tell me how do I do that?


texts: Geofield Map - Filter attachment result by clicking marker

texts:
I'm facing a problem with geofield map and I can't find a solution. So I have a view with a geofield map format. There I show all nodes from one node type as markers.
Under my map I have an attachment also with all nodes, but as a list with more details.

Now the problem: I want to filter the attachment when I click on a marker from the map. For example - I have 10 markers on my map. These 10 markers represent 10 nodes which are also shown in the attachment beneath. When I click on one marker on the map I want the attachment to show only one node in the results. It would also be great if the result would be updated via ajax.

I hope somebody can help me. :)


texts:
I am trying to wrap my head around the Drupal 7 framework using the debugger in eclipse. The thing is, I'm feeling a little overwhelmed with the endless function calls and watching data bounce back and countless number of times (I'm sure it could actually be counted with more patience).

What is the best way to understand what is going on and get a good overview of how everything fits together? Is using just a debugger the wrong approach?


texts: Drupal 7 Rules: Compare Group Reference Field and fire Rule if data changed

texts:
I am using a content type called "question" which has an organic group reference field (og_group_ref).

I want to trigger an action with Rules, when the field "og_group_ref" is changed on node update.

So I have created the following rule:

{ "rules_notify_question_author" : {
"LABEL" : "Question has moved - notify user",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update--question" : { "bundle" : "question" } },
"IF" : [
  { "AND" : [
      { "NOT data_is" : {
          "data" : [ "node-unchanged:og-group-ref" ],
          "value" : [ "node:og-group-ref" ]
        }
      }
    ]
  },
  { "NOT data_is_empty" : { "data" : [ "node:og-group-ref" ] } }
],
"DO" : [
  { "mail" : {
      "to" : "[node:author:mail]",
      "subject" : "Some handy subject",
      "message" : "E-Mail to author",
      "from" : "[site:mail]",
      "language" : [ "" ]
    }
  },
  { "drupal_message" : { "message" : "Message text" } } } }
]

The idea is that the author of a question gets notified, when the questions was moved to another group. The logic should be like this:

  EVENT: On Node question Update

  CONDITION: node_unchanged:og-group-ref != node:og-group-ref AND node:og-group-ref != EMPTY

  ACTION: Send Mail an show a message

My problem is, that the rule fires when the content of the field og_group_ref was changed and when it was NOT changed.

I printed the compared values in the drupal message. The values are correct. But I do not know, why the rule is triggered although the field "og_group_ref" did not change.

Has anyone an idea?


texts: I've been given the files to a Drupal site so I can create a new theme. I haven't, however, been given the Drupal admin user/password date so I can't sign in to the admin area. Is there a way I can create a new user directly in the database or some other way?


texts: The vertical tabs don't show when is one vocabulary

texts:
I am working in Drupal 6, and I am using the Hierarchical select. If my taxonomy consists in two or more vocabularies associated to a content type, the vocabulary shows into vertical tabs but if my taxonomy consists in one vocabulary associated to a content type, the vocabulary doesn't show into vertical tabs.

I thank to you for your help.


texts: How do I get request parameters when using fragment AND query with drupal_goto

texts:
I was successful in using fragment with drupal_goto, but when I use it AND query, I am not able to get the request parameters using $_GET from the query.

I can see the request parameters in the URL, but it returns NULL.  The URL is constructed as http://mydrupalsite/?code=success#overlay=admin/vendor/auth-stripe.

I am attempting to use $_GET['code'] to get the parameter.  I also tried $_REQUEST


texts:
I have a issue trying to activate REST SERVER from services. I need to add this library. I'm using drupal 7.19 on Ubuntu.

Reading this question, I add the spyc.php in 'servers/rest_server/lib/'

But where I must place the rest of files?

Reading the issue, #2 suggest that the best solution will be allow to place the library on 'sites/all/libraries', this doesn't work in my version.


texts:
I'm using the Rules module to execute custom PHP script whenever a new node is saved after importing via Feeds module.

<?php

$lid = db_insert('location')->fields(array(
    'additional' => $node->field-address, //saves as '0'
    'city' => $node->field-locality, // saves '0'
    'province' => $prov, // //saves correctly
    'country' => 'xx', //saves 'xx' correctly
    'latitude' => $node->field-latitude-temp, //saves as 0.00000
    'longitude' => $node->field-longitude-temp, //same
    'source' => 1,
    'is_primary' => 0
))->execute();

This is the location table (from the Location module) and I'm importing data from a csv file.

All the other constant values are saved properly except for when it is coming from the $node object. Lat and Lon goes 0.00000 while all the other string values such as city and address also goes 0.

Been dealing with this for hours.

EDIT: I'm using Feeds module. But I need to import also location data. While a row is getting committed to db, the values are all 0!

node:field-latitude-temp shows the actual imported value correctly when viewing the node. But it is not getting absorbed in within the PHP Execute custom code page in Rules.


texts: How can I insert search box in page.tpl?

texts: How can I insert search box(search block) in my theme programmatically?


texts: htmlLawed in text format corrupts Scald insert in CKEditor module

texts:
I have htmlawed text format filter. When I enable it for any filter that it is used by any CKEditor profile, it causes corruption for inserted Scald atoms in the CKEditor.

In other words, the following is a correct code for an image atom as shown in CKEDITOR source view:

After changing the text format to a format that it uses htmlawed and saving the node and then edit it again and switching to Rich Text Editor, I got the following code in CKEDITOR source:

This cause alerting an error message:

Just removing htmlawed filter makes ecerything works fine, but this is not an option for me.

I tried the following settings - in the screen shoe - for htmlawed:

However, it does not work as expected to preserve the scald attributes.

I alse tried to change the order of the filter by making it before or after Embedded atoms filter

Where is the mistake?


texts: How to implement a searchable addresses database (for a form)?

texts:
I'm not sure if I should ask this type of question in this site, but I already tried to ask in the Drupal forum here with no reply so far.

I'm trying to find out the best way to implement a solution in an existing Drupal 7 site that must meet the following requirements:

a option to import addresses to the database from a csv/xls file, with:

fields: id, city, locality, street, street-number, postal code
around 100000 records/addresses

a form that include a address section/field(s) with a search functionality to search the addresses

where the user would fill up some of the address fields (ex: city, street; or just street)

and it would show a list with the matched addresses
that would be sorted by relevance

for example: is more relevant if it's found in both "street" and "city" fields, than only in the "street" field
(ideally it would be nice to replicate the google maps search)

a option to export the submitted form values to a csv/xls
  (if this is too of topic, just ignore this step (3))
(The site is on a Drupal 7, with mysql 5.5, and php 5.5)

Previously the client had tried to implement the import requirement, but it was to slow (a few days just to load the csv file), using the feeds plugin and a taxonomy structure to save part of the address fields.

I'm relatively new to Drupal backend development, mostly frontend, theming (templates with html, js, css/sass, and just a bit of php) in Drupal and doing some simple forms in backend, but I have some MySQL and PHP background.

So I was thinking in building a module to:

create database tables of:

addresses (fields: id, city, locality, ...)
addresses_searchable, where it would have addresses strings fields, by converting the strings:

to lowercase
replacing non-latin text to US-ASCII (ex: "á", "à" to "a")
in order to help speeding up the search

when using "like" in Drupal database search api

form_submitions (fields: id (of the submitted form), name, ... (other form fields) , adress_id)

create a form
. using ajax to load the search addresses list by pressing a button
set up a backend page (using permissions) for the import and export pages

import:

include a button to load addresses file (csv/xls), and other to run latest loaded file, and show a progress bar, and a log with possible errors

export:

using a button to download all form submissions up to now, or up to / after a selected date

From what I researched so far:

for reading files:

xls: could use the Drupal module phpexcel
csv: by using PHP native functions

to search the addresses:

by checking the Drupal api,

(in https://www.drupal.org/docs/7/api/database-api/dynamic-queries/expressions)
it doesn't seem possible to do relevant searches, like using the MySQL Match function:

SELECT *, MATCH ('city','street',...) AGAINST (':adressInputText' IN NATURAL LANGUAGE MODE) as 'relevance' ...

there is a Search API module that maybe would be the way to go

I haven't used it before, but maybe it would work if i create a entity for the address with the matching fields. Would be faster that a dedicated table?
in case it's better this way maybe, i could still use the address table as a temporary table, just to speed up the importing of the csv/xls addresses file

I'm not sure if this is the best approach to the problem, and what are the best practices to implement this in Drupal 7.
Or even if it is something that should other solution/framework like for example:

use something like Laravel (v5.4) (which i also would have to learn), and load the forms in Drupal 7 through a iframe that would show the form from the other server and framework.

I've searched Google but I’m still a bit confused. Can someone point me in the right direction?


texts:
I have two content types: man and food;

The man content type contains the man's name several more fields and a unique id field created by the serial module.

The second content type is created by the users via an external form.
The results from the form are set as the food content type. One of the fields is equal to the unique id field at the man content type.

My question is:
1. I want to create a view that will show me all the man values, But when the value is clicked, it will lead me to a table that contains all the food content type entries where the unique id in food is equal to the man unique id value.

It so easy to do this in php but I am new to drupal.

Any help of lead will be great.


texts: drupal site crash and went to maintenance mode

texts: While creating a huge volume of pages in drupal website, our live site went down after 5 hours. We investigated logs on Apache, PHP and MySQL thoroughly but couldn't identify any specific cause or error for the site crash.


texts: Drupal assuming admin created user, when user registered normally

texts:
This is something that I'm pretty sure worked when in beta, but doesn't work now anymore.

I have setup the user registration to be allowed by visitors, but a confirmation by the admin is required. Email verification isn't required. I have composed all the necessary emails.

Now, when a user registers, two things go wrong:

no mail is sent to the admin
the wrong mail is sent to the new user

The new user receives a mail stating that the admin created his account and that he can use the one-time login link to change his password. When he clicks on this link, he doesn't have access to the page, because the account isn't active yet.

The user should receive the mail telling him he registered succesfully and his registration is waiting for approval. The admin should receive the mail that a new user was created.

Sometime, the admin will create the users, so both mechanisms will be used. But I get the impression Drupal thinks it was always the admin that created the user, even if it was a normal user registration.

I have a rule setup (from the Rules module) for when a new user registers, to add him to certain roles. But this worked in beta, now it doesn't anymore. Also, disabling this rule, or disabling the rules module entirely didn't help.

Any ideas where I can start looking?


texts: Shared subset of users in a multi-site instance

texts:
Can I have a shared subset of users in a multi-site instance? In other words, I have the same list of administrators across all sites. Can these administrators be admins for all sites through a shared database rather than producing the same list of admins for each site?

I am aware that each site in a multi-site instance has its own database, which contains content and users specific to said site.
I am aware that content and users can be shared by configuring a shared database. However, I only want to share administrators among sites and keep content and other users with site-specific roles and permissions specific to its respective site.


texts: Is there any convention about the name to use for a file containing a class definition?

texts:
I have a static class I want to call in my module.

Does the file containing the class definition need to have a special name convention, such as MyStaticClass.class.php? The file is in my module folder.


texts: How to resolve an XMLReader warning produced by Wordpress Migrate module?

texts:
I'm converting a Wordpress site to Drupal. To do so, I need to import a wordpress export file. But whenever I try to import my wordpress export file, I get this error:

Warning: XMLReader::open() [xmlreader.open]: Unable to open source data in WordPressBlog->__construct() (line 188 of /mnt/www/html/dev/docroot/sites/all/modules/wordpress_migrate/wordpress.inc).
Exception: Could not open XML file wordpress://blog.wordpress.2013-09-05.xml in WordPressBlog->__construct() (line 219 of /mnt/www/html/dev/docroot/sites/all/modules/wordpress_migrate/wordpress.inc)

As shown in the path names within the error mesages also (ie: 'wordpress_migrate'), I'm using the Wordpress Migrate module. For this module, only a 7.x version exists.
I'm not quite sure why it can't read the XML file. I've run the file through the xmllint command with no errors.
Can anyone help me with this?


texts: I was looking the insertion point to change some stuff in the search form. I manage to change the search block, but I can't find a way to do the same with the form I see in site.com/search/node I was 100% sure the hook should be function SearchformMod_search_form_alter(&$form, &$form_state, $form_id) { } But it seems like I'm wrong. If I try to use Theme developer I don't get any .tpl suggestion either. Any Idea ?


texts: How can I send mass emails as part of a bulk operation?

texts:
I have a view where the webform submissions of the site authenticated users are shown. In that view I have some bulk operations (created by me) that change the value of a field in these submissions (e.g. status).
My question is how a mass email can be send to the users that made an application when the admin change the status in selected submissions?

Here is my custom code for the status update (I sent a test email to my self):

namespace Drupal\webformbulk\Plugin\Action;

use Drupal\Core\Action\ActionBase;
use Drupal\Core\Session\AccountInterface;

/**
* Push term in front.
*
* @Action(
*   id = "cancel_submission",
*   label = @Translation("Cancel submissions"),
*   type = "webform_submission"
* )
*/
class CancelSubmission extends ActionBase {

 /**
 * {@inheritdoc}
 */
 public function execute($entity = NULL) {
/** @var \Drupal\webform\WebformSubmissionInterface  $entity */

  // Modify submission values
  $entity->setElementData('status', 'canceled')->save();

  //call the email method
  $mailManager = \Drupal::service('plugin.manager.mail');
  $langcode = 'el';

  $email = 'test@hotmai.com';

  $message ='Your application has been marked as canceled';
  // Send the email.
  $params = array(
    'subject' => '[Aplication Status] - Application marked as canceled',
    'body' => check_markup(
      t($message),
      'plain_text'
    ),
  );

$mailManager->mail('mailsend', 'completed', $email, $langcode, $params);
//drupal_set_message($entity->id());
 }

 /**
 * {@inheritdoc}
 */
  public function access($object, AccountInterface $account = NULL,
  $return_as_object = FALSE) {
  /** @var \Drupal\webform\WebformSubmissionInterface $object */
  $result = $object->locked->access('edit', $account, TRUE)
  ->andIf($object->access('update', $account, TRUE));

  return $return_as_object ? $result : $result->isAllowed();
}

 }

I thought to use the Rules modules but unfortunately I can't find how I can use it, plus I have some doubt about sending a mass email from Rules.
Would be reasonable to some other module as views send or the mailchimp module? Is there an API I can use?


texts:
I'm trying to use a drush function to flush out all of the drealty module's nodes in my drupal 6 install.  However, something is causing a memory leak and the nodes are not being deleted after node_delete is called.  What can I do?

Here is the memory exhausted error:

drush rets-flush
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /home/directory/public_html/sites/all/modules/filefield/field_file.inc on line 300
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 71 bytes) in
/home/directory/public_html/sites/all/modules/filefield/field_file.inc,
line 300

Here is the drush rets-flush function:

function drush_drealty_rets_flush() {
  set_time_limit(0);

  $result = db_query("SELECT nid FROM {node} WHERE type = 'drealty_property' OR type = 'drealty_agent' OR type = 'drealty_office' OR type = 'drealty_open_house'", $conid);

  $count = 0;
  while ($nid = db_fetch_object($result)) {
    node_delete($nid->nid);
    drush_log(dt('Deleting node id: @nid. ', array('@nid' => $nid->nid)));
    $count++;
  }
  drush_log(dt('Deleted @count nodes', array('@count' => $count)), 'success');
}

There are about 5000 records total.


texts:
I have created data export view. I need to include a date field in this format: Y-m-d (yyyy-mm-dd). I went to 'Date and Time', then added a new format and assigned it to the short format.

In views, I then select the date field, and select 'short' as the format. The new format (Y-m-d) displays in the view preview correctly.

I download the XLS and open it up, but the date field is defaulting to m/d/y (1/10/13). Why would the date appear correctly in the views preview but not in the download? I also verified all the correct formatters are set in the CCK date field settings. If I just show the fields in a plain old table view layout, it is also displayed correctly. the only incorrect format is in the XLS I download.

Please note: If I change the date field to include a 'From date' & 'To Date' and display both To and From dates in one column, the XLS then displays the dates correctly but unfortunately, I can't have these sets of dates in one column. I need them in 2 columns and in the 'Y-m-d' format.

To further troubleshoot, I also tried selecting the same date field in views and only displaying one date per column. One column to display From and the same date field to display To. This also results in m/d/y (1/10/13).

Is this a bug? I can replicate this on my local environment as well. Basically, the custom date formatters are not being portrayed on the export.

I am using:

Linux CentOS
PHP 5.3.3
MySQL 5.1.61
Drupal 6
Views 6.x-2.16
Views Export 6.x-2.0-beta6


texts: Is there a way to force Drupal not to base any contact form on the native Personal contact form that comes with it, and thus freely creating contact forms from scratch as done with Webform in Drupal 7?


texts: How to create a node with mulitple field-collection items?

texts:
I've a content type having filed collection item (3 fields of 5 sets). Created a custom module form, when user submits that form, it should create a node with all 5 set field collection items.

So far tried the following code. it's working for 1st set but not for all.

$values = array(
  'type' => 'ct_machine_name', // Content Type machine name
  'uid' => $uid,
  'status' => 1,
  'promote' => 0,
  'title' => 'xxxx',
);
$entity = entity_create('node', $values);
$ewrapper = entity_metadata_wrapper('node', $entity);
$ewrapper->save();
$node = node_load($entity->nid);

$fc_val= entity_create('field_collection_item', array('field_name' => 'field_fc_mcnename'));
// Attach to the node
$fc_val->setHostEntity('node', $node);
$fc_val->field_field1[LANGUAGE_NONE][0]['value'] = $val1;
$fc_val->field_field2[LANGUAGE_NONE][0]['value'] = $val2;
$fc_val->field_field3[LANGUAGE_NONE][0]['value'] = $val3;

// Save field-collection item.
$fc_val->save();

The above code working. But I need to loop through it and save all field collection items in an user submitted order.

I tired as follows, but doesn't work. (example)

for ($i=0; $i<=4; $i++) {
$fc_val->field_field1[LANGUAGE_NONE][$i]['value'] = $val1;
$fc_val->field_field2[LANGUAGE_NONE][$i]['value'] = $val2;
$fc_val->field_field3[LANGUAGE_NONE][$i]['value'] = $val3;
}
$fc_val->save();

Also tried

for ($i=0; $i<=4; $i++) {
$fc_val->field_field1[LANGUAGE_NONE][0]['value'] = $val1;
$fc_val->field_field2[LANGUAGE_NONE][0]['value'] = $val2;
$fc_val->field_field3[LANGUAGE_NONE][0]['value'] = $val3;
$fc_val->save();
}

Any inputs or suggestions would be much appreciated.


texts:
I'm trying to create my own AreaPlugin. But there's submit handler doesn't work.

Here is a part of my code.

class MyAreaPlugin extends AreaPluginBase {

  /**
   * {@inheritdoc}
   */
  public function render($empty = FALSE) {
    $result['my_plugin_form'] = [
      '#type' => 'form',
      '#form_id' => 'my_plugin_form_id',
    ];
    $result['my_plugin_form']['actions'] = ['#type' => 'actions'];
    // There will be more actions.
    $result['my_plugin_form']['actions']['button_id'] = [
      '#type' => 'submit',
      '#value' => 'Button text',
      '#name' => 'button_name',
      '#submit' => [[$this, 'buttonClickHandler']],
    ];
    return $result;
  }

  /**
   * Button click handler.
   *
   * @param array $form
   *   This form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   This form state.
   */
  public function buttonClickHandler(array &$form, FormStateInterface $form_state) {
    drupal_set_message('exportData');
  }
}

How it can be done correct way?


texts:
I'm migrating a Drupal 6 site with CCK filefields to Drupal 7. I installed the Drupal 7 CCK module, and I'm ready to do the migration except for a filefield field.

Migrate fields states:

  Missing field module: 'filefield'. This field cannot be migrated.

The filefield module isn't available for Drupal 7. Is there an other module, or any other way of migrating a Drupal 6 CCK filefield to Drupal 7 fields?

Update

I just realized it's an audiofield. Basically it's a filefield with an audio widget.


texts: Using hook_form_alter() to prevent free email addresses from registering on a Drupal 6 site

texts:
I have been tasked with blocking specific email address domians from registering at our Drupal 6 site (gmail.com, aol.com & yahoo.com). I implemented some JQuery code to do this but the problem was that spammers with javascript disabled in their browser readily bypassed this prevention.

I also cannot use Drupal 6's Access Rules as we already have registered users on the site with those domains so this method blocks them from logging in so it's more of a going forward prevention that we would like to implement.

I found this code on Stack Overflow but the code was somewhat incomplete:

function example_data_form_user_register_alter(&$form,&$form_state) {
  $form['mail']['#element_validate'] = 'example_mail_validate';
}

function example_mail_validate($element, &$form_state) {
   if ( -- Whatever condition you like -- ) {
     form_error($element, t('Free email is not allowed.'));
   }
}

I thought it would be better to open a new question on this forum since it's Drupal specific.

I think what I need help with is filling in the gap where in the code it says: -- Whatever condition you like --

I am not a PHP guru so any help would be appreciated. I assume this is the spot where I would have some code that disallows the domains that I want to block.


texts:
I have a content type named gallery and under this, I have created
the gallery content which is belong to that content type and added the
multiple images but the problem is when I click the thumbnail image
color box window opened but small images opened.


texts: How can I loop through checked entity reference values with a taxonomy condition?

texts:
I'm using Drupal 7 and Commerce. We have several product displays: Caramel, Chocolate, Cinnamon, Cheddar, etc. Each of these product displays has 5 SKUs (5 products) for the 5 different sizes we offer. Each product display also gets tagged as either "premium" or "standard."

I'm trying to then build a "sampler" where they choose up to three of those flavors. To do this, I'm using an entity reference field so that that list always has the current flavors. i.e. If they had Hazelnut, the sampler gets updated with Hazelnut.

If they choose a premium flavor, it should add $5 to the total price per premium flavor, but if there are no premium flavors, then it should stay the same price.

I have a rule set up that is halfway there. Problem is, if there is even just one premium flavor, it charges $5 per item checked, regardless of whether they're premium or standard.

I can't figure out how to only apply the upcharge per premium flavor. Any help is greatly appreciated. Willing to help fund this some if needed.