texts:
In regards 7.x.

Say a user that has a role of (registered user) wants to block another user with the same role that is harassing them and they don't want to see any more posts or comments from the harassing user. But, I as the "Admin" don't want to Block either user. The user just wants to block the other harassing users comments or posts to be viewable by them....

For example: Other websites offer a way for a user to block someone that is harassing them. They can even block that harassing user from ever seeing their information/profiles/comments or posts.... But, that blocked user isn't blocked to everyone else, just blocked to that specific user from being able to see their information/profiles/comments or posts.

Is there a way to do that in drupal? What modules would I use to make that work? How can I make that work?

I am concerned that users could start harassing one another in posts and comments, there should be a way to mute users posts or comments from being viewable.

For example: Say I start a conversation with you and you don't like what I'm saying and you don't want to see those type of posts anymore from me. How can you block me from me posting such things on the drupal about you? So if there was a way to mute me, then my posts or comments would nolonger be visible by you but still visible by everyone else.

Is this possible?


texts:
I have a quick question. I work with a form that consists of the following:

$form['data_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Killer search engine!'),
    '#id'   => 'killer-search-engine',
    '#maxlength' => 1024,
    '#description' => t('Search by using tags and free text'),
);

$form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Go!!',
);
...
...
fill $table
...
...
if(sizeof($form_state['input'])!=0) {

    $form['table'] = array (
        '#title' => 'TABLE',
        '#type'   => 'table',
        '#value' => $table,
    );
}
return $form.

The form is appearing but the table element of it, even though it is filled with html code of an actual table(I checked through dpm($form)) does not appear.
Anyone with a quick fix?

Thanks beforehand


texts: How do I modify Drupal so that ONLY relative URLs are used through the whole site?

texts:
I have a client who says that he is unable to view his company's website from inside his company's building. Their network engineers have asked to make sure that DOMAIN.COM is not included in any of the URLs generated by Drupal.

They want only relative paths everywhere in the code. Any insights?


texts: How can i fix broken link of an image being viewed in Drupalgap after being uploaded with Drupalgap also

texts:
By using Drupalgap i create an article and attach/upload an image to that article. Image of name: myimage.jpg has the actual absolute path in website: http://www.example.com/sites/default/files/myimage.jpg. In View(and also in Edit) menu tab inside Drupalgap the image seems to be broken. By debugging i get that in the View it tries to show an image with absolute path of http://www.example.com/sites/default/files/styles/medium/public/myimage.jpg which doesn't exist. What exists in that specific folder is a renamed clone of my image with absolute path http://www.example.com/sites/default/files/styles/medium/public/1495486688801.jpg .
To make things weirder, yesterday's articles created with the same method, which appeared also to be broken yesterday, today are shown just fine. Just fine means that the link of the image being shown points to the correct cloned image: http://www.example.com/sites/default/files/styles/medium/public/1495486688801.jpg .
?q=drupalgap/node/55.json is today's article json  with broken links
?q=drupalgap/node/53.json is yesterdays's article json which shows image as expected.
Both get 200 OK response.
In the 2nd json references the image (...)"filename":"1495486688801.jpg","uri":"public://1495486688801.jpg"(...)
 and the 1st as

(...)""filename":"IMG-8a92960d1864691a4e03c9cfe9ee8516-V.jpg","uri":"public://IMG-8a92960d1864691a4e03c9cfe9ee8516-V.jpg"(...).

Default Display in site uses Large image style and Drupalgap display uses Medium image style for the article node.
I have to mention that the same warning as the issue 776 appears to my log file.
 WARNING: drupalgap_remove_page_from_dom() - not removing the current page (node_add_article) from the DOM!
Maybe medium style is not created as per need of my mobile's request.

UPDATE

I installed the imageinfo_cache module and now (confirmed after 3 newly created articles nodes with images) images are not broken in the View menu tab in Drupalgap. But in the Edit menu tab is still broken.


texts: Unable to save audio file to node in drupal 7

texts:
I am attaching an audio file to node using services 3 in drupal 7. When I hit my URL:

www.mysite/api/nid/attach_file

I get an error:

STATUS 500 Internal Server Error: An error occurred (23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_attach_audio_activity_display' cannot be null

I also tried by setting field_attach_audio_activity_display to 1 in POST parameters. But it gave same error.

Anyone who knows please help me to solve this issue. Thank you.


texts: mkdir permission denied error when running Browser based test

texts:
I've wrote a browser based test for the contributed module, code can be seen here, when I run test in terminal I get following error

./vendor/bin/phpunit   --configuration /home/sharique/Projects/drupal/d8/d8contrib/core/phpunit.xml --filter "/::testReadOnlyModeEnabled( .*)?$/" Drupal\Tests\readonlymode\Functional\ReadOnlyModeTest /home/sharique/Projects/drupal/d8/d8contrib/modules/porting/readonlymode/tests/src/Functional/ReadonlymodeTest.php -v
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

Runtime:        PHP 7.1.10 with Xdebug 2.5.5
Configuration:  /home/sharique/Projects/drupal/d8/d8contrib/core/phpunit.xml

Testing Drupal\Tests\readonlymode\Functional\ReadOnlyModeTest
E

Time: 2 minutes, Memory: 6.00MB

There was 1 error:

1) Drupal\Tests\readonlymode\Functional\ReadOnlyModeTest::testReadOnlyModeEnabled
Exception: User warning: mkdir(): Permission Denied
Drupal\Component\PhpStorage\FileStorage->createDirectory()() (Line: 173)

/home/sharique/Projects/drupal/d8/d8contrib/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:44
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/Promise.php:203
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/Promise.php:156
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/TaskQueue.php:47
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/Promise.php:246
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/Promise.php:223
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/Promise.php:267
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/Promise.php:225
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/promises/src/Promise.php:62
/home/sharique/Projects/drupal/d8/d8contrib/vendor/guzzlehttp/guzzle/src/Client.php:131
/home/sharique/Projects/drupal/d8/d8contrib/vendor/fabpot/goutte/Goutte/Client.php:155
/home/sharique/Projects/drupal/d8/d8contrib/vendor/symfony/browser-kit/Client.php:315
/home/sharique/Projects/drupal/d8/d8contrib/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php:144
/home/sharique/Projects/drupal/d8/d8contrib/vendor/behat/mink/src/Session.php:148
/home/sharique/Projects/drupal/d8/d8contrib/core/tests/Drupal/Tests/BrowserTestBase.php:333
/home/sharique/Projects/drupal/d8/d8contrib/core/tests/Drupal/Tests/BrowserTestBase.php:472

FAILURES!
Tests: 1, Assertions: 1, Errors: 1.

Same error when running from PhpStorm


texts: How to limit drush tar-options="--exclude pattern matching to be specific and not recursive

texts:
With the folder structure like so
/site_root
/site_root/images
/site_root/core
/site_root/core/modules/images
/site_root/libraries
etc

When doing a drush archive dump backup, from the inside site_root (usually it's public_html but in this case it's another folder), I use
$ drush ard tar-options="--exclude=images" --destination=~/.backups/[date].tar.gz

That way the archive dump skips the /site_root/images folder and the ard is much smaller.
Unfortunately for me pattern matching then causes all images folders throughout to be excluded due to recursivity.
So I would lose
/site_root/images
/site_root/core/modules/images
etc

I know in linux you can make tar-options look at the folder structure by making the pattern relative, like so
$ drush ard tar-options="--exclude=./images"
But that is not working for me via drush ard tar-options.

I also tried the home folder shortcut '~' (which works a treat on drush ard destination) like so
$ drush ard tar-options="--exclude=~/site_root/images" --destination=~/.backups/[date].tar.gz
But, for some reason, that does not work like it does on the –-destination switch.

What is the best way to limit the drush tar-options="exclude switch to either no-recursive or pattern match looking at relative path to working directory?


texts: How to add weight to the total weight of the order witn Commerce Shipping with rules?

texts:
I want to add a constant weight to the total weight of the orders in my shopping cart to account for packing materials in the weight calculation.

I'm also using Commerce Shipping Postal Code Code Weight. The Postal code weights work brilliantly.Shipping Postal Code Weights

What I want to do is add a 6oz to the total weight of my order.


texts:
Can I use php ftp wrappers using file_copy or file_move. like this:

file_copy($file, 'ftp://user:pass@site.com/file.flv', FILE_EXISTS_RENAME);

Or is this limited to drupal default wrappers?

And if I can't, do I have to use drupal built-in ftp hanlder(FileTransferFTP Class) or I'm allowed to use my own php ftp functions(ftp_put)?

Which one's better?


texts:
I am using hook_query_alter to make changes in get taxonomy terms query.

    function MYMODULE_query_alter(QueryAlterableInterface $query) {
    global $user;
    if($user->uid > 1) {
        if ($query->hasTag('term_access') && strstr(current_path(), 'admin/structure/taxonomy')) {
            $permission = $query->leftJoin('term_permissions_user', 'tpu', "t.tid = tpu.tid");
            $ored = db_or();
            $ored->condition('uid', NULL, 'IS');
            $ored->condition('uid', $user->uid, '=');
            $anded = db_and();
            $anded->condition($ored);
            $query->condition($anded);
        }
    }
}

I want to have above query clause on the page which lists taxonomy terms only but this hook is adding the clause on all pages. I mean this hook is called on any page load of my drupal site.

Other issue is that the alias for table taxonomy_term_data is base on same pages and t on other pages and if i join using alias t it gives me error on most of the pages and vice versa.

I am checking the table alias to ensure the use of table alias used in my query and have changed the code as

function MYMODULE_query_alter(QueryAlterableInterface $query) {
    global $user;
    if($user->uid > 1) {
        if ($query->hasTag('term_access') && strstr(current_path(), 'admin/structure/taxonomy')) {
            $tables = $query->getTables();
            if(isset($tables['t']) && isset($tables['t']['alias']) && $tables['t']['alias'] == 't' && $tables['t']['table'] == 'taxonomy_term_data') {
                $permission = $query->leftJoin('term_permissions_user', 'tpu', "t.tid = tpu.tid");
                $ored = db_or();
                $ored->condition('uid', NULL, 'IS');
                $ored->condition('uid', $user->uid, '=');
                $anded = db_and();
                $anded->condition($ored);
                $query->condition($anded);
            }
        }
    }
}

But I am not sure if I have used a correct check, as of now my aim of adding query clause is fulfilled. Just to ensure this will work for long and will not break in any case.
Please help me to have this hook call on the page where I need this and use the exact table alias.

Thanks in advance for your help.


texts: How to place Drupal_Security_Do_Not_Remove_See_SA_* into httpd.conf instead of .htaccess

texts:
I run several Drupal 7 installations on a dedicated server with CentOS 6.4 and Apache 2 (the package httpd-2.2.15-29.el6.centos.x86_64).

I wonder, how to properly configure the Drupal_Security_Do_Not_Remove_* handlers in my /etc/httpd/conf/httpd.conf file since .htaccess files are disabled at my server by AllowOverride None directive.

Currently I have the following sections in httpd.conf for each of my sites:

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
......
<VirtualHost 123.123.123.123:80>
    DocumentRoot /var/www/html/mysite1.de
    ServerName mysite1.de
    ServerAlias mysite1.de *.mysite1.de

    <IfModule mod_rewrite.c>
        <Directory "/var/www/html/mysite1.de">
            RewriteEngine on
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_URI} !=/favicon.ico
            RewriteRule ^ index.php [L]
        </Directory>
    </IfModule>
</VirtualHost>

And the recommended settings for the .htaccess are those here:

Options None
Options +FollowSymLinks

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

Should the result in my case be the following?

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
......
<VirtualHost 123.123.123.123:80>
    DocumentRoot /var/www/html/mysite1.de
    ServerName mysite1.de
    ServerAlias mysite1.de *.mysite1.de

    Options None
    Options +FollowSymLinks
    SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
    <Files /var/www/html/mysite1.de/sites/default/files/*>
        SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
    </Files>

    <IfModule mod_rewrite.c>
        <Directory "/var/www/html/mysite1.de">
            RewriteEngine on
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_URI} !=/favicon.ico
            RewriteRule ^ index.php [L]
        </Directory>

        <Directory "/var/www/html/mysite1.de/sites/default/files">
            php_flag engine off
        </Directory>
    </IfModule>
</VirtualHost>


texts: Using filter strtolower in custom Twig Extension return no result

texts:
I created a module to extend Twig Extension for filter functions. However the usage of strtolower in custom module end up with no result. Below are the sampel code of my custom module.

  public static function removeSpaces($string) {
    $string = str_replace(' ', '-', $string);
    $string = strtolower($string);

    return $string;
  }

Filtering {{ title|removeSpaces }} in template end up with empty.


texts: Mutliple rewrites/redirects in settings.php on a Pantheon hosted site

texts:
We are in the process of migrating a Drupal site to Pantheon. The site uses about 55 rewrites and redirects rules in its pre-migration NGINX configuration. Most of them (32) include widlcards (eg. ^/something/(.*) redirects to /something-else/) and an handful even keep the matching substring into the redirect-to URL (eg. ^/another/one/(.*)$ redirects to /something/else/$1).

Pantheon does not support redirects at the web-server levels and suggests doing redirects in the settings.php (to avoid boostraping Drupal). But 55 redirects seems enough to start worry about maintainability of a bunch of if blocks. There is also the performance cost of 32 pattern matching for each request. So a little care has to be taken to avoid maintenance nightmare in the future.

I'm not too worried about performances since the site is mostly cached anonymous traffic. But in addition to requiring a full bootstrap, the Redirect module (already used on the site) is not an option as it does not support wildcards.

I'm toying with the idea of crafting something with nikic/FastRoute to be used from settings.php. But this seems a bit overkill for 55 redirects.

I'm curious what options have been used on other sites with similar requirements.


texts: Drupal 6 site updates are not been applied

texts:
I have a Drupal 6 site running fine, but when trying to apply updates to its modules by uploading the latest version of the module and visiting update.php the update process complete, but when I check the available updates report it still show me the old module versions marking them as outdate.

I can read and write in the DB, and I can upload files to the server so it is not a DB  or file permission.

Can you explain why the updates are not being applied/seen?


texts:
I have created the module and it show the error in login block. But only problem with this did not show the error in first time. If user again enter the wrong username and password then it show the error. Why do not understand. I check the session value it store in first time but did not show on the screen only after second time.

function usermoved_form_user_login_block_alter(&$form, &$form_state) {
   $form['warning'] = array(
  '#value' => t(''),
   '#weight' => 11
   );

   $form['#validate'][] = 'usermoved_form_validate_code';
 }

function usermoved_form_validate_code(&$form, &$form_state) {
   if (empty($form_state['uid'])) {
       form_set_error('warning', t('Sorry, unrecognized username or password.'));
     $_SESSION['usermoved_form_user_login_block_alter'] = t('The error message');
    }
  else {
    unset($_SESSION['usermoved_form_user_login_block_alter']);
  }
  }


texts:
It seems (correct me if I'm wrong) that there are some classes or services that must be used in relevant cases in Drupal 9 that are not present in Drupal 8.
For example, New in Symfony 4.3: Simpler event dispatching Symfony\Component\HttpKernel\Event\RequestEvent in place of Symfony\Component\HttpKernel\Event\GetResponseEvent.
Same with temporary session storage and more.
This means that if these features are used in a module, the module can only be compatible with one of these core versions; but it seems like a complete waste to manage two codebases at this point, since the versions are still very similar.
What is the correct way to manage this compatibility in one module, and has this question been addressed by the Drupal 9 release team?


texts:
I'm not able to understand the use and role of the node_access tag. I used the Node View permission module to restrict the access to the article content type for anonymous users.

Now I have created an auto-complete search box that searches node titles. This is the query I used.

$query = \Drupal::entityquery('node');
$query->condition('title', trim($search));
$query->condition('status', 1);
$query->addTag('node_access');
$nids = $query->execute();
$nodes = Node::loadMultiple($nids);

I don't want this search box to search titles that belong to the article content type, and I used the node_access tag.

Will this tag serves my purpose here or is there any other approach to achieve the same?


texts:
I have this scenario:
- We have domain access to show different content by location including menus
- we have one top menu to show different "home pages" where the user could target information. Home 1, home2, home 3, etc...
- we have a main menu for each "home page".
- we have 3 type of content that can have a lateral menu and even the same lateral menu for those 3. This lateral menu has 3 levels. and those content types could be linked in every one.
- a node of content type 1 for example, could be referenced many times in the lateral menus.

We need some help with this issue. We are considering the menu block and/or NodeSymlinks, and/or multiple node menu modules.

Could you advice us ? regards.


texts: How do i add a background image to a imput submit button in my module?

texts:
So i have a input submit button that needs an image.

I've been looking at the module styling documentation where it says i can attach the styling to a render array of a block plugin. What does this mean and how do i do this? I'll include the trimmed down code where i want to include this styling.

LoginBlock.php:

class LoginBlock extends BlockBase implements ContainerFactoryPluginInterface {

  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('plugin.manager.pixelpin_openid_connect_client.processor'),
      $container->get('form_builder')
    );
  }

  public function build() {
    return $this->formBuilder->getForm('Drupal\pixelpin_openid_connect\Form\LoginForm');
  }

}

LoginForm.php:

class LoginForm extends FormBase implements ContainerInjectionInterface {

  public function buildForm(array $form, FormStateInterface $form_state) {

        //submit button that i want to add styling too

          $value = 'Log in Using PixelPin';
          $label = 'Log in Using PixelPin';

          $form['pixelpin_openid_connect_client_pixelpin_login'] = array(
            '#type' => 'submit',
            '#value' => t($value, array(
              '@client_title' => $client['label'],
            )),
            '#name' => $client_id,
            '#prefix' => '<div>',
            '#suffix' => '</div>',
          );
    }
    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    //code
  }

}

pixelpin_openid_connect.libraries.yml:

pixelpin_logo:
  version: 1.x
  css:
    theme:
      css/style.css: {}

style.css:

#edit-pixelpin-openid-connect-client-enable-login {
  background: #f0f0f0 url(/ppicon.png) no-repeat center;
  cursor: pointer;
  height: 26px;
  margin-left: 0;
  margin-right: 0;
  overflow: hidden;
  padding: 0;
  text-indent: -9999px;
  direction: ltr;
  width: 34px;
}


texts:
I need to set some info for SEO and sharing. I know that I can use the Metatag module for nodes, views and front page. In fact, I use it for them. Now I need to set some information for custom paths (create via hook_menu()). I know that I can use something like drupal_add_html_head($metatag_description_custom, 'description'), but I want to give to my client the possibility to change this and others tags (e.g. og:description, og:image).

Is there a way (or a module) to do this without create and change a custom module's code?


texts: How do I update Drupal 8.2.3 REST configurations for an entity?

texts:
According to the documentation, I need to update the REST configuration for each entity type. RESTUI seems not to work with 8.2.3, so I figure I'm supposed to update this by hand, for example in rest.resource.entity.node.yml.

I do that, and then I'm stuck. Where does this file go? Does it go in my code somewhere? Am I supposed to import it through Configuration Synchronization (admin/config/development/configuration/single/import)?

I did try to import using Config Synch, but I got the following error, which means nothing to a newbie like me: An entity with this machine name already exists but the import did not specify a UUID.

Sorry if this is already documented somewhere, but I can't find an explanation anywhere for how to update these settings, and they seem pretty important for using the REST services. I'm currently using the Features Module as a workaround but it's kind of an ugly approach for something that seems like it should be simple.

Thanks in advance!


texts: Why my Data Export View uses default value for an exposed Grouped Filter?

texts:
I am using Views 7.x-3.8, Drupal 7.28 and Views Data Export 7.x-3.0-beta7.

From a view (page) with multiple fields and exposed filters, I created a homemade search engine with search results within a table. I have created an export view, attached to that view, with exactly the same fields and exposed filters. So users can export filtered search results.

From the search engine, after choosing a value for a field with exposed grouped filter (Any, Yes, No), the export does not consider that choice and keeps the default value for this filter. Same result if I activate the option "Remember last selection" on the export view.

Any idea why?

Thanks in advance.


texts: Unable to debug $items variable in hook_menu_alter(&$items)

texts:
I want to print out $items variable (the argument of hook_menu_alter) for debugging the menu properties in various pages.

I tried:

/**
 * Implement hook_menu_alter()
 */
function mymodule_menu_alter(&$items) {
  debug($items);
  kpr($items);
}

cache cleared.

but $items are not printed out on the page. Any ideas?


texts: I have created a drupal menu and added a couple of links. Unfortunately, when displayed, these come with bullets. How can I remove these? I am using the Precise theme, but it does not seem to be added by this theme.


texts:
I want a block to be visible only for Admin in Drupal 6.

To do it I've selected the third option(Show if the following PHP code returns TRUE (PHP-mode, experts only).) and entered the php code:

<?php
global $user;return $user->uid == 1;
?>

But the problem is that now this block shows only when I'm on some specific urls while logged in admin and not always when logged in admin.
What's wrong?

I don't want to use the second option (Show on only the listed pages).


texts: Load AJAX form on every page via drupal_get_form

texts:
I'm trying to load this contact form on every page via drupal_get_form()

<?php
function MYMODULE_menu() {
    $items = array();
    $items['contact'] = array(
        'title' => t('Contact'),
        'description' => t('Contact'),
        'page callback' => 'contact_page',
        'access callback' => TRUE,
        'type' => MENU_CALLBACK
    );
    return $items;
}

function contact_page () {
     $output = '
'.drupal_render(drupal_get_form('ajax_contact_form')).'
';
}

function ajax_contact_form($form, &$form_state) {
    $form = array();
    $form['name'] = array(
        '#type' => 'textfield',
        '#title' => t('Name'),
        '#required' => TRUE,
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#ajax' => array(
            'callback' => 'ajax_contact_callback',
            'wrapper' => 'ajax_contact_form',
            'name' => 'submit1',
            'method' => 'html',
            'progress' => array(
                    'type' => 'throbber',
                    'message' => t('Message is sending...'),
                ),
        ),
    '#value' => t('Send'),
    );
    $form['box'] = array(
    '#type' => 'markup',
    '#prefix' => '
',
    '#suffix' => '
',
    );
  return $form;
}

function ajax_contact_callback($form, &$form_state){
    drupal_validate_form('ajax_contact_form', $form, $form_state);
    $name =  $form_state['values']['name'];
    if (form_get_errors()) {

        $form['box']['#markup']='
'.t('Please check your fields!').'
';
        $form_state['rebuild'] = TRUE;
        return $form;
    }
    return $form;
}
?>

Basically everything is works on /contact page but when I try to load this form from page.tpl.php. It doesn't want to validate. What should I do?

<?php  print render(drupal_get_form('ajax_contact_form'));  ?>

Here


texts: Creating custom panel page gives page not found error

texts:
I have been striving hard to make this work.I have created a custom panel page with the page url as taxonomy/term/%term/content-type/how-to.
So i have this via pathauto url
Vocab : Category
Parent term: food
Child term : pizza

After setting up the panel page when i go to
www.example.com/category/food/pizza/content-type/how-to it gives me 404 error(page not found).

And when i manually set up a custom panel page for each url(for e.g www.example.com/category/food/pizza/content-type/how-to)  it is working fine.

Can you guys point out whats wrong withtaxonomy/term/%term/content-type/how-to url ?


texts: How to print formatted contents of Viewfield in a custom template?

texts:
I am having trouble printing the contents of two Viewfields in my custom node template. They are two separate blocks in the same overall View. I have tried the following, but it did not print anything:

<?php echo $node->field_fieldname1[0]['view']; ?>
<?php echo $node->field_fieldname2[0]['view']; ?>

When I add

<?php print_r($node); ?>

to my template, it returns the following for the two Viewfields in question:

  [field_fieldname1] => Array ( [und] => Array ( [0] =>
  Array ( [vname] => myviewname|block_1 [vargs] => ) ) )

  [field_fieldname2] => Array ( [und] => Array ( [0] =>
  Array ( [vname] => myviewname|block_2 [vargs] => ) ) )

Can anyone direct me on how I can print the contents of these Viewfields in my tpl file?

Thanks!


texts: Disable subscription auto-renew by users

texts:
I'm working on a website with commerce 2.x subscriptions auto-renewal with Drupal 8.
The problem is that after an user will pay for membership, they can not cancel anymore the auto-renewal.
I can't find any relevant information about this functionality.

I would like to cancel auto-renewal when they wants while keeping the current subscription running to the end of the billing period.


texts: This import is empty and if applied would delete all of your configurations

texts:
Customer bought a theme that has Commerce plugin installed with sample data.
Anxious to get running and try out the new configuration system, I did what I do prior to Drupal 8.6. Commit everything but sensitive info into git and cloned to my local, dumped the MySql db. After getting the index page, every page returns a 500 error. One is Attempt to create a field commerce_remote_id that does not exist on entity type user despite the commerce_remote_id table in existence. The entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() in another.
Drag copying all files from modules/commerce, modules/profile should get me past these errors.
drush updb returns no updates needed.
drush cr offers no relief.
OK, I wanted to start using the new configuration system. On customer site drush cex and committed to git.
On my local after git pull, drush cim returns:

This import is empty and if applied would delete all of your configuration, so has been rejected.

As I research this, it appears that drush will not import, but prefer to use drush site:install with an existing configuration.
OK, the strong imperative within the community is to use composer to do a new site install.
Can drush 9.5.2 install a new site onto itself using the existing settings.php file? I would like to get the sync configuration files working so that I can remove that as a factor to resolve my local site being hosed.

I read in another tutorial that the UUID must be copied over because if the customer and my local are to have the configuration work together that the UUID in system.site.yml must match. I can confirm that they do match.
drush config.get system.site returns the UUID that the source Drupal install is using.


texts: Change views Contextual Filter based on select list value

texts:
Using Event Calendar Module I displayed dates in a calendar views. Now I have to create a select list with options like

IST
CST
EST
PST

Changing the values should change the Date displayed in the Calendar.

Now I added four different fields for each time zone and added values to it.

By adding a contextual filter in the views for a specific date field, I could see Calendar with dates marked perfectly. Now I created four different view display for each time zone as a tabbed view.

But I actually require it as select list. (for eg: Pick Date & Time)


texts: How to get the real sql query of a view?

texts:
One of drupal view displays reviews based on a selected event. It should display 3 reviews but instead it displays only 2. It doesn't happen for all the events and only for certain events instead of 3 it displays 2 items. As the data is all correct and I have validated the same. I wanted to see the query that is being used. The query that is displayed in the view is not helping me either. If I copy paste the same and run the sql, it throws a lot of error.
How can I debug and see what is the query that got executed for that particular view?
The view has relationsships and also it uses contextual filters.
Thanks


texts: Why are comments enabled on my content types in Simpletests?

texts: When I run Simpletest, it's showing comment forms at the bottom of all the nodes, even though I don't even have the comment module enabled, nor permissions assigned for it. These comment forms showing up in tests is interfering with my tests and I need to disable them, but I don't know how since I never enabled them in the first place.


texts:
I added a term reference field (field_department_term_ref) to user entity (/admin/config/people/accounts/fields), then I need use Views to list all the users with the same term as current logged in user (including current logged in user himself). I referenced this post, But unfortunately there are 2 differences:

Contextual filter "User: field_department_term_ref" can not get the right default value.
If I don't select the "Exclude" checkbox in the MORE section, it will only show current user himself; if not, it will show others users but no current user.


texts: How do I render a node's link field in a page template?

texts:
I have a custom page template that's intended to display a couple of fields for a specific content type in an aside, along with the sidebar contents. My searching and reading seems to indicate that one of these should work:

{{ node.field_links }}
{{ node.field_links.value }}

However, these produce the following errors, respectively:

Object of type Drupal\Core\Field\FieldItemList cannot be printed.
Object of type Drupal\link\Plugin\Field\FieldType\LinkItem cannot be printed.

I feel that I must be missing something very obvious here. How can I simply render the entire field, with all values, in the page template?


texts: How can I alter ctools access plugin expectancies?

texts:
How can I tell a access plugin to expect a different argument plugin? Surely there isn't a one to one ratio.

So I'm working with panels. I've written a custom argument plugin that will take the node name from the URL and send back a node context. The problem I'm having now is that since I have "Selection Rule" on my page variant that is looking for a node of a specific type. "Selection Rules" are indeed access plugins. So with this said, the "Node: type" access rule requires a "Node" type context.

I'm providing that... the only thing is when the plugin sets up it's access rules it's looking for the following argument:

What my plugin is providing for some reason I haven't found out yet is the following:
argument_node_name_1

node_name.inc is the name of my file, by which if I remember correctly what provides the system name because as far as I can tell is some magic provided by ctools.

I can however us the entity_id argument plugin and of course this all works, but then I don't get to use the node name in the URL.


texts: How to display a flag to anonymous users?

texts:
I'm using the Flag module, but I have a problem in displaying a flag to anonymous users.

I have 2 flags called "make feature" and "add to Favorites". I want to display this flag to anonymous users too. Currently it is displayed only to the users who are logged in (authenticated user).

I want these flags to be displayed to all users (whether logged in or not). But when an anonymous user clicks on flag than such user should be redirected to the login page. After login the user should be able to set flag.

Is this possible?


texts: Is there any way to sort by Image Quality?

texts:
The idea is to sort Images in views from lowest to the highest quality (not only size).

Ex:

Image A = 640x480 100ko (blurred darkened)

Image B = 480x320 50ko (detailed)

Sort

1 - Image B

2 - Image A


texts: Relation Between Drupal Commerce Line items and Products

texts:
I am making a website in Drupal 7 and Drupal Commerce with some custom modules. Now, I have a set of Products.

The Products are,
 - Product 1
 - Product 2
 - Product 3
I have two line items. Lets say Product Sizes. And product weight.
Each have select or another module implemented. I have followed the concept of Randy Fay's Screencasts.
http://www.commerceguys.com/resources/articles/237

http://www.commerceguys.com/resources/articles/238

Now with each line items the cost of the product changes.
As per the screenscasts, the process will be,

Create Line Items
Create Products
Create Product Display and add a Product Field Reference to it.
Then it will display the line item in the product display page.

But, I am not creating the Product display. This is going to be via the custom module. So can you tell me from the coding point of view, what is the relation between a line item and a product. So that I can list all the created line items for a displayed product.


texts: Best way to store custom commerce pane form data as part of an order?

texts:
I have a custom checkout pane that only loads if there is a product of type 'Event' in the cart. For each product of type 'Event' in the cart, the pane prints out two custom fields: 'Ticketholder's Name' and 'Ticketholder's Email'. Further depend on the event there are upto another 8 extra fields such as 'Dietary Requirements' and 'Arrival Time'.

In the past, if I have a custom value that I want sent through with the order, I have created a custom field within the order fields, and then set the value in the following way:

$order->field_my_custom_field['und']['0']['value'] = 'my custom value';
commerce_order_save($order);

Now this seems fine for custom values that need to be set for all orders. However with this custom checkout pane, these custom fields only appear for 'events'. Further it is dynamic, so if there are 2 tickets for the same event (i.e one product of quantity 2) in the cart, it will need to store Ticketholder's Name & Email etc. for both ticket 1 and ticket 2.

So is there a more appropriate way to set the custom values and display them when you go to Store > Orders > View Order? Can I programmatically attach the custom fields to the order?

In the past I have looked at adding custom line items to checkout to store this kind of data but have been unsuccessful in getting them to display within Store > Orders > View Order. Further the same event, with quantity 2 will just be one line item in the cart so I'm not sure how you would attach the data for both ticketholders in this way.

What is the best way to store this data as part of the Order, so that it is accessible at Store > Orders > View Order?

Thanks for your help!


texts: Zen sub theme: page--node--name.tpl.php not working!

texts:
I'm hoping someone can help me because I'm at my wits end!  I'm using the zen theme - then created a sub-theme and now I can't seem to get the custom templates to be recognized by the custom content type name (page--node--custom_content_name.tpl.php).

I've created a new template.php in my sub-theme and placed text that I've found in other blogs and forums to help make it recognize the content type so I can use it in the tpl.php name but nothing seems to work.  If I use the dev module it only says that I can name them page--node--1.tpl.php, which would be fine if we weren't going to be adding more content on an ongoing basis.

Right now I have so many tpl.php just so that I can show people what the pages will look like - it's crazy!! What am I doing wrong?!
Help!!


texts: How to use hook_menu to add an item to the secondary links?

texts:
Adding an item to the primary links is easy:

function hook_menu()
{
    $items = array();
    $items['bla'] = array(
        'title' => 'bla',
        'page callback' => 'mymod_blah',
        'expanded' => TRUE,
    );
    return $items;
}

This adds it to the primary links. How do I add it to the secondary links?


texts:
I have 2 webforms: survey webform and task webform.
The entry point is task webform and it requires user to login.
There is a controller or something to check if user has previously filled in a survey webform, if he/she did, go straight to task webform. Otherwise, need to go to survey form.
I know how to create webforms, but not sure how to make such controller.


texts: Blocking a certain user from apearing in user search results

texts:
I'm looking for a way to exclude certain users (by ID or name) from appearing in the user search results in Drupal 7.

Any thoughts?


texts: Change the way results are shown when using the Quiz module

texts:
I have installed the Quiz module. Using the quiz module you can see the results of all the persons who have taken the quiz under node/*/results. Right now it shows shows the username of person in the table.

In the database I have a table that is called "profile_value" and there are some columns in it, "fid", "uid", "value".

Now I want to show the "value" of this where "fid" is equal to "1" and the user id is equal to "uid" instead of user-name in the result of the quizes.

I think I should be able to do this by changing  the file theme/quiz-results-browser-body.tpl.php.

Am I right?  How should I change it?


texts: How do I assign a role to a user after the user's email is confirmed?

texts:
I want to assign a role to a user after the user confirms his/her email.

How do I do this?


texts: How do I return JSON data compatible with the Boost module?

texts:
In a custom module a, I return a JSON string that needs to be compatible with the Boost module.

My first try was using the following code:

if ((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'XMLHttpRequest' == $_SERVER['HTTP_X_REQUESTED_WITH']) || strpos($_SERVER['REQUEST_URI'], '?json') !== FALSE) {
  header('Cache-Control: no-cache, must-revalidate');
  header('Content-type: application/json', true);
  $json = loadData();
  die(json_encode($json));
}

This is obviously that this output won't be cached. Than I replaced the line with die() with the following one:

return drupal_json_output(($json));

This works, but it is not cached. I enabled the JSON output in Boost, but nothing happens.

What should I try?

Removing the two header lines does not change anything. The function drupal_json_output adds the Content-Type: application/json. But I belive that boost only accepts text/javascript. Also if I override the Content-Type again nothing will be cached.


texts: What does "The Language field needs to be updated." mean?

texts:
It may be a stupid question, but I don't quite understand how to go around drush entity-updates from Drupal Version 8.7 on.

For example on /admin/reports/status, it says:

  Textbox

  The Language field needs to be updated.

The textbox is a custom entity.

I've read https://www.drupal.org/node/3034742 and I understand what I had to do if I knew what I want to update and how. In this case, I just don't know what to write inside the update function.
The notice says that the "language" field needs to be updated, but not exactly what about that field.

I think I am missing something really simple here, but I don't get it.


texts: Hide "Submit"/"Save" button until file has finished uploading

texts:
I'm having a problem where my site users are submitting a form before the files they are uploading into filefield are finished, this is causing an ajax error to pop up along the lines of "an ajax HTTP request terminated abnormally".

To stop this mistake from happening is there a way to hide the "Submit"/"Save" button until file has finished uploading?


texts:
I have a page that is supposed to output a table of values from my database. I am logged in as an admin and another page I created works just fine, outputting a form for data to be entered into the database. I have the following lines of code pertaining to the new page..

function achievementList_menu() {
$items = array();
$items['achievementList/list'] = array(
    'title' => 'Achievement List',
    'description' => 'A list of all of my achievements',
    'page callback' => 'achievementList_generate_table',
    'access arguments' => array('access content'),
);
return $items;
}

and

EDIT:

function achievementList_generate_table() {
$header = array('ID', 'Name', 'Description', 'Points');
$rows = array();
$results = db_query("SELECT * FROM {achievements}");

foreach ($results as $row){
    $rows[] = $row;
}

return theme('table', array('header' => $header), array('rows' => $rows) );
}

The headers render fine but the $rows array does not. Any idea why?


texts:
I am using entity_translation module for translating node titles. And with this Translate tab appears on node view like in screenshot.

I am trying to override titles and access permissions for this menu tab and found that its coded in /sites/all/modules/entity_translation/entity_translation.node.inc like below:

/**
 * Node-specific menu alterations.
 */
function entity_translation_node_menu_alter(&$items, $backup) {
  if (isset($backup['node'])) {
    $item = $backup['node'];
    // Preserve the menu router item defined by other modules.
    $callback['page callback'] = $item['page callback'];
    $callback['file'] = $item['file'];
    $callback['module'] = $item['module'];
    $access_arguments = array_merge(array(1, $item['access callback']), $item['access arguments']);
  }
  else {
    $callback = FALSE;
    $access_arguments = array(1);
  }

  $items['node/%node/translate']['page callback'] = 'entity_translation_overview';
  $items['node/%node/translate']['page arguments'] = array('node', 1, $callback);
  $items['node/%node/translate']['access arguments'] = $access_arguments;
  $items['node/%node/translate']['access callback'] = 'entity_translation_node_tab_access';
  $items['node/%node/translate']['file'] = 'entity_translation.admin.inc';
  $items['node/%node/translate']['module'] = 'entity_translation';
}

In my custom module I tried overriding like this:

function my_module_node_menu_alter(&$items, $backup) {
  $items['node/%node/translate']['title'] = "My New Title";
  $items['node/%node/translate']['access callback'] = 'my_module_transaltion_access';

}

function my_module_transaltion_access(){
   // code for my permissions according to user roles.
}

But I am not able to alter this menu item. Please suggest what is right way to do this ?

UPDATE:

function my_module_menu_alter(&$menu,&$items) {

   $items['node/%node/translate']['access callback'] = "my_module_transaltion_access";
}

function my_module_implements_alter(&$implementations, $hook) {
  switch ($hook) {
    case 'menu_alter':

      // Move some of our hook implementations to the end of the list.
      $group = $implementations['my_module'];
      unset($implementations['my_module']);
      $implementations['my_module'] = $group;
      break;
  }
}

Thanks!


texts: How to make new post show instantly in a View Display for the author who created it?

texts:
I have this Views Display (profile page) that shows the author's content. However for some reason whenever an author post a content, it does not show instantly in his Profile Views. Yet when you check his profile page as an anonymous user or other account, it's there instantly!

I'm completely astonished as this is weird for me. Is this a bug or I'm missing something?


texts:
The theme I am using has a slider -- a panel of automatically changing images to display a topic that the user can choose -- but it only shows a few slides.  I want to extend it to a dozen slides.  I did simple text searches to determine which files in the theme are used code files to provide the functionality to the slider.  That was the easy part.  I was able to extend the code from the few slides to 12 slides.

Now comes the more difficult and hidden part.  As I see it, each slide has two parts that are not hard coded.  First, each slide has a caption -- a text description.  Secondly, each slide has a URL associated with it that is where the browser goes if the user clicks on the slide.  These two things are not hard coded in any of the PHP or other files, as far as I can tell.  They can be edited by the admin in the drupal backend admin settings.

So I assumed that these fields are somehow set and retained in the database.  But I did a search on a downloaded copy of the database and I did not find this text.

Please advise.  What additional work do I need to do to complete this task?

I suppose I could just forge ahead.  Obviously this data is being stored somewhere.  Maybe they are stored in the database in an encrypted form for security reasons.  I could do an ftp upload of the site theme files.  But then what?  Do I uninstall the theme and then reinstall it?  Do I just deactivate it and then reactivate it?  How do I make my code changes work?


texts: Moving drupal site to the root of the server

texts:
I have finished my drupal site and about to launch it in the end. Now everything is in a subdirectory called www.mysite.com/drupal_test, to do that, I had to change one line in the .htaccess file:

uncomment #RewriteBase /drupal

and change to

RewriteBase /drupal_test

I realised that .htaccess and some of other files in drupal are hidden files. I just blindly uploaded it and can't really see it in the ftp.

Now, I am ready to move everything to the root. I suppose I have to change that line back. But will I lose all the hidden files if I move? I can re-upload .htaccess, but there so many other hidden file that I don't know, will I lose them?

Is there anything else I should do when I move the directory or is there a better/proper way to do so rather than dragging and dropping all the files to the root?

Sorry if the question is stupid, I only have one day left to do this and I am terrified by moving drupal sites.


texts:
I have a book with few children article nodes. I would like to create a navigation block tree, that can be placed anywhere on page.

Problem: Normally if I place book navigation block using context (on book and article content type) - the menu shows all links with the link to main book.
However, if I try to print inside tpl.php like this

$block = module_invoke('book', 'block_view', 'navigation');
print render($block['content']);

The menu shows only child items. How to show the parent book as well?


texts: Date selection with price - without commerce

texts:
I need a option to let users set up dates and price when creating node with unlimited number of entries.

For example:

"from: 15/01/2015 to 20/02/2015 - Price = 50 USD"

from: 21/02/2015 to 15/03/2015 - Price = 70 USD

from: 16/03/2015 to 15/05/2015 - Price = 90 USD

It would be nice if could look user friendly too since users will make atleast 7-8 entries.

Something like "from: __________ to __________ : price __________"

Instead of underline it should be date popup and for price i would use integer.


texts: Use db_select with multiple conditions of which one needs to apply

texts:
My question is not a duplicate and it has complex conditions. Please let me explain. In my second condition, first I need to check if number value is correct (in first condition I checked complete opposite). If so, then check if there's a value in email column. Then show error message if there's a value in email column. My problem is I need to write first query (already done by me) and second query under the same 'db_select'

Checking for email value only activates if webform value matches a value in 'number' column.

I have a table containing two columns namely, 'number' and 'email'.

I need to run a db_select query to display same error message when a webform is submitted. My conditions are as follows:

Show error message if number value provided by webform does not matches a value in 'number' column
Show error message if number value provided by webform matches a value in 'number' column but corresponding 'email' column is not empty.

So far I'm able to show error message for the first condition.

db_set_active('mydatabase');
    $query = db_select('mytable', 'c');
    $query->fields('c', array('number','email_address'))
    ->condition('number', $phoneval, '=');
    $result = $query->execute()->fetchAll();

if (empty($result))
{
    form_set_error('phone_number','We have no record of that Assessment Number');
}

How can I show the same error message for condition 2? I don not want to query the database again and thinking of using for db_or this.

Thanks


texts:
I'm working on a custom field type module for a Drupal 7 project and tried to make use of Drupal's AJAX framework in forms.
For some reason not even the simplest AJAX requests work on my machine (MacBook with Mac OS Lion) whereas the same code works fine on the Linux machines of my colleagues. When I click the button that's supposed to trigger the request I also get that little blue spinner and the "Please wait..." message but nothing happens after it disappears. In Firebug I can see that it posts to /system/ajax and also sends a "200 OK" header but an empty response.

The code was something similar to this:

$element['ajax-btn'] = array(
  '#value' => t('AJAX Test'),
  '#type'  => 'button',
  '#ajax'  => array(
    'callback' => 'test_callback',
    'wrapper'  => 'ajax-test',
    'method'   => 'replace',
  )
);

$element['new-ingredients'] = array(
  '#markup' => '
test
',
);

function test_callback($form, $form_state) {
  return array('#markup' => 'response');
}

Any ideas?


texts: How to replace I18nVariableLanguageRealm controller?

texts:
I have done custom module with .class.inc and .module file. Class file is added in module info file.

Inside class file:

/**
 * Controller for Language realms.
 */
class MyModuleI18nVariableLanguageRealm extends I18nVariableLanguageRealm {
  public function getKey() {
    return isset($this->current_key) ? $this->current_key : FALSE;
  }
}

Inside module file:

/**
 * Implements hook_variable_realm_info
 */
function mymodule_i18n_variable_variable_realm_info() {
  $realm['language'] = array(
    'title' => t('Language'),
    'weight' => 1,
    'controller class' => 'MyModuleI18nVariableLanguageRealm',
    'store class' => 'VariableStoreRealmStore',
    // Variables for this realm can be selected from a list.
    'select' => TRUE,
    'select path' => 'admin/config/regional/i18n/variable',
    // Name for variables that belong to this realm: 'multilingual' variable/s
    'variable name' => t('multilingual'),
    'variable class' => 'i18n-variable',
    // Automatically handle these variables in system settings forms.
    'form settings' => TRUE,
    'form switcher' => TRUE,
  );
  return $realm;
}

but debugging shows that custom controller isn't in use. What am I doing wrong here?


texts: Theme not working after database transfer (Theme key "0" not found)

texts:
I have copied the database of my production site to my dev site and my theme is not working anymore (on the dev). The content (nodes) is not exactly the same, but theme folder is.

All the information in the CSS files is still displaying but the settings in admin/appearance/settings/corporateclean (UI for basic colors) have no effect anymore.

The logs show the following warning: Theme key "0" not found.

I have tried flusing the caches, de-activate cache pages, CSS aggregation without success. I had the issue in the past and copying all the files fixed it but it's a brute force fix and I'd like to understand what happens. I am 100% sure the theme directory is up to date, so some other files may be messing. Any idea?


texts: Backtracing an SQL error shown in drupal set message with no specifying information

texts:
I am using a feeds hook to email some information to workbench section users. I've been changing some of my code and suddently I'm getting a database error:

SQLSTATE[42000]: Syntax error or access violation:
1064 You have an error in your SQL syntax;
check the manual that corresponds to your MySQL
server version for the right syntax to use near '))' at line 2

This error doesn't show enough of the query to let me know which one it is, what line number or function it originates in, etc. I've tried putting a debug_backtrace() in the core definition of the drupal_set_message() function but I did not find my functions in it, just batch functions. I also tried putting backtraces in the DatabaseStatementBase classes' execute() method, but that caused the site to output a bunch of junk information on the screen.

How can I backtrace this error or otherwise track it down? The only thing that occurs to me put error messages around each query I'm running to see where the actual error falls. Is this the best way?


texts: Changing the tite of your page to match the title of your tabs

texts:
I have the following function:

function cvminterviews_menu() {

  $items = array();

  $items['admin/settings/cvminterviews'] = array(
    'title' => 'Interview Schedule Overview',
    'description' => 'Overview',
    'file' => 'cvminterviews_admin_overview.inc.php',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('cvminterviews_overview_form'),
    'access arguments' => array('administer cvminterviews'),
  );

  $items['admin/settings/cvminterviews/overview'] = array(
    'title' => 'Overview',
    'description' => 'Overview',
    'file' => 'cvminterviews_admin_overview.inc.php',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('cvminterviews_overview_form'),
    'access arguments' => array('administer cvminterviews'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );

  $items['admin/settings/cvminterviews/setup'] = array(
    'title' => 'Interview Schedule Setup',
    'description' => 'Setup',
    'file' => 'cvminterviews_admin_setup.inc.php',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('cvminterviews_dateroomsetup_form'),
    'access arguments' => array('administer cvminterviews'),
    'type' => MENU_LOCAL_TASK,
  );

  return $items;
}

This outputs two tabs at the top of the page. However, when I click on each tab, it has the same page title as the parent menu item "Interview Schedule Overview".

Is there a way to set unique page titles for each tab?


texts: Where should I place hook_block_view_alter?

texts:
this may be a trivial question, but I have no clue to how to get this working. I have this theme 'nexus'. When try the hook

function nexus_preprocess_block(&$variables)

in the file nexus.theme, it works,

but function nexus_block_view_alter(&$data, $block)
doesn't.

Should I put it in a module? I tried creating a module using hello_world example, and put in the the module's controller but no avail.

Any hint would be much helpful.


texts: How to get nid as int (and not as string)

texts:
This code snippet:

var_dump(
    db_query("select nid, title from node limit 1")->fetchAssoc()
);

Prints this:

array(2) {
  ["nid"]=>
  string(4) "6247"
  ["title"]=>
  string(5) "test!"
}

The database table node though has the following structure:

nid int(10) unsigned NOT NULL AUTO_INCREMENT
...
title varchar(255) NOT NULL
...

Is there a way to make the query above return nid as an int?


texts:
I have a menu block that displays the sub-pages of a parent page. In addition to the sub-pages I would like at least the name of the parent page displayed but I cannot figure this out.

So in the image above, I would like to have 'About' displayed instead of the title of the block and with its sub-pages (children) below. It would be nice if I could do it in the block's template but I am sure it is more involved than that.


texts: .htaccess https rewrite for single domain on multisite installation

texts:
I have a multisite installation with 2 sites running off separate domains. One of these sites needs to go through https:// while the the other can stick to http://. I also want all traffic to be rewritten to include the www. prefix.

So:

example.com rewritten to https://www.example.com

example.co.uk rewritten to http://www.example.co.uk

I'm trying to set my .htaccess file to handle this, and have tried with the  syntax discussed here.

RewriteEngine on
<If "%{HTTP_HOST} == 'example.com'">
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</If>
<If "%{HTTP_HOST} == 'example.co.uk'">
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !http
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</If>

Needless to say, it's not working. Any input would be much appreciated!


texts: Drupal views to display content updated today

texts:
For a drupal view, I want a filter such that in the block I can see Articles (created with a taxonomy term) either

Created/Posted today
Updated today (might be created earlier)
This is what I've done. I've added filters to the view:

Content: Has taxonomy term (= something)
Content: Published (Yes)
And contextual filters:

Content: Created day [With default value to be Current Date]
Content: Updated day [With default value to be Current Date]
With these settings I'm achieving my purpose of getting the posts which were created today, but the posts which were created earlier and updated today are not being picked.


texts: Noob question about private files and Content Access

texts:
This is almost certainly a really stupid question, but the Drupal 7 site we're building has an image gallery that users can upload content to. Unauthenticated users should not be able to see these images, but some other rôles should be able to see all the images uploaded by other users. The way we first built it, images all show up from a directory below the webroot, so anyone can see the image, if they know the URL.

I thought Private files would be my solution, so I followed the instructions there, setting up a folder in our filesystem (above the webroot, so you can only get there via Drupal) and changing the field settings within the appropriate content type to use Private files as the Upload destination and then went to set a bunch of Custom permissions, so that the appropriate users have "View anyone's value for field Image" (and so on) but that Anonymous users don't.

Then I cleared all the caches and went to upload a new image. If I go to the node page and right click to get the image URL, though, pasting that into an Anonymous Browser Mode window still shows me the image.

So I figured maybe I just needed something more fine-grained or that I'd implemented it wrong.

So I enabled the Content Access module and went back to the appropriate Content type and set the Access Control settings so that only the appropriate rôles can "View any gallery_image content" (and so on). Clearing the caches, uploading another new image, I can still grab the URL and see it from a new Anonymous Browser Mode window.

Now the Private files thing seems to be doing the right thing — the image URL is now /system/files/styles/image_thumbnail/private/gallery/images/filename.jpg and the files are appearing in the right part of the filesytem, but Drupal doesn't seem to be respecting the access control — or even just requiring that you log in.

Presumably I've done something wrong somewhere, as it seems like I'm implementing the right thing and I've just made a mistake somewhere. So is there an obvious step I'm missing?

Update: The hosting environment is RedHat Linux and we don't allow .htaccess files (we're developing the site, a third-party is responsible for security, so they would rather everything go into the httpd.conf instead). This is part of why I deliberately close a directory above the webroot, so that a .htaccess file would not be necessary. I do notice, though, that if I try to access /system/files/styles/image_thumbnail/private/gallery/images/ in a browser, I get a Drupal 403 message, not the apache one.


texts: How to create a password field on an entity of which the value can be obtained?

texts:
I would like to store a password in Drupal using a BaseFieldDefinition (since that's what the other fields on this entity are using) for use with authenticating via a third-party service, using OAuth 2.0. Currently, I'm storing the password using BaseFieldDefinition::create('password'). I would like to use this value at one point to authenticate using API requests, however, I am unable to get its value like a normal field.

How can I implement a password on an entity, using BaseFieldDefinitions? The password is not for use within Drupal, so I need to be able to access the value.

One thought that I had was storing it as a string field, not loading a default value on the form, and using the encryption module to manually encrypt the data before storing it and decrypt it when I need it, but this is very cumbersome and I'd rather not add the extra dependency.

Edit: Here's the code showing how I construct the field:

  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = [];
    /* Code constructing other fields... */
    $fields['password'] = BaseFieldDefinition::create('password')
      ->setLabel(t('Password'))
      ->setDescription(t('Password for authenticating via vendor\'s API.'));
    return $fields;
  }

And here's where I attempt to retrieve the value in the same entity:

  public function getPassword() {
    return $this->get('password')->value;
  }


texts: How can I use the logged in user's group ID as a contextual filter in Views?

texts:
I have Views, Context and OG installed on Drupal 7.

One of the default views is OG User Groups (/user-groups.) It is a content view that shows the user which groups they belong to.

I'm trying to create something similar, as a block (and therefore cannot use URL arguments.) I want a user view that shows all of the users from the logged in user's group.

In Views, it would make sense that I get the user ID from the logged in user as a contextual filter and then perhaps pass it as an entity ID (etid) to get the group ID (gid). But no matter what I do I cannot make a view that allows this to happen.

Does anyone know I can get the group ID from the current logged in user to use in this view?

http://i.stack.imgur.com/xU2zi.png


texts: Till this date i was working all alone on drupal projects.  Now i am into a team of 10-15 members. They are using common DB on a machine and different code base on each machine. So was wondering which is the best way to manage and work on drupal project when in a team ?


texts: Can View content be filtered to what's new since user's last login?

texts: We have a View that displays recently created content of a specific custom type – currently, it's showing the titles of the most recent 3 items. The site requires login, so can identify unique individuals. So how might we get this View to display only the items that are new since a particular user's last login? Or is there another way to display such a content list, other than by Views?


texts: How to remove "Submitted By" data from google search engines in drupal7?

texts:
How can I prevent showing of Submitted by username information on google search result pages.

I looked into some of the answers but I am not sure those solutions will remove from google search. I am thinking those are related to drupal search engines.

Here are the links:

Remove "Submitted by" on search results

https://www.drupal.org/node/1101554

Please help me regarding this. It will be more appreciated if solution will workout for already created data/nodes as well.


texts: One of two field is required in drupal 7 view?

texts:
I have one view in which i want to upload picture(image) or embed video(text). I want to add condition either picture or video field required. and also user can not fill both value user can fill only one value.

I also tried to use https://drupal.org/project/conditional_fields but it can not work for me.

I reffered https://drupal.org/node/355264 . I hope this will help me but I am new in Drupal so how can I used this.

Any help will be appreciate.

Thanks in advance.


texts: How to override views template preprocess function of other module

texts:
I am using Views Responsive Grid module in a project.

This module uses a preprocess function like template_preprocess_views_view_responsive_grid().

Now I am trying to override it by either of following way:

MYTHEME_preprocess_views_view_responsive_grid() in template.php

OR

MYMODULE_preprocess_views_view_responsive_grid() in mymodule.module

Problem:

It is not overriding. Is there any other way?

I am using Drupal 7.51 and Views 3.0.


texts: Views Contextual Filter - Full Month display

texts:
I created a View and it is working perfectly. There is only an issue with how it's formatting the dropdown list for Month filtering. Right now it's displaying the months in abbreviated format (ex. Jan, Feb, Mar, Apr). I'd like it to display the months in full format (ex. January, February, March, April).

Is there a way to override this behavior?

Thanks for any help.


texts:
In the .theme file of my custom Drupal 8 theme, how do I customize the default search block so that I can add custom classes and also alter the input label to remove the word "search" but instead have a search icon from fontawesome?

Pretty much, I'd like the final output code to look like this:

<div class="infoBar-search">
  <form action="#!" class="searchForm">
    <input type="search" name="sitesearch" placeholder="Search...">
    <input type="submit" class="searchForm-submit fa" value="&#xf002;">
  </form>
</div>

Would the .theme approach be the best way to go about this? I tried altering a few template files but noticed this would affect the other forms on the site as well.


texts:
I know that in Drupal 8 the taxonomy term reference is deprecated and it's implemented by an entity reference in Drupal 8 Core.

Is there any widget to select items by checkbox list instead of the default autocomplete entity reference widget?


texts: Solutions for frontpage that consist of only blocks

texts:
What methods are there to construct a frontpage that consist of only blocks. I know i can setup panels + pagemanager and add blocks in that manner, but it seems a bit overkill to install panels just for 1 page of the site. Another solution was to create an empty Views page, but that seems a bit hacky.

Having that the frontpage consist of only blocks, what other methods are there that doesnt seem hacky or bloated?


texts: Ubercart module, understanding drupal_get_form

texts:
This is all taken from ubercart uc_attribute module.

So in hook_form I have this:

  $items['admin/store/products/attributes/%uc_attribute/edit'] = array(
    'title' => 'Edit attribute',
    'description' => 'Edit a product attribute.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('uc_attribute_form', 4),
    'access arguments' => array('administer attributes'),
    'file' => 'uc_attribute.admin.inc',
  );

As far as I understand this menu entry will call the function drupal_get_form that will call the function uc_attribute_form using %uc_attribute as a parameter.

Now if I go to the function definition:

function uc_attribute_form($form, &$form_state, $attribute = NULL) {

  // If an attribute specified, add its ID as a hidden value.
  if (!empty($attribute)) {
    $form['aid'] = array('#type' => 'value', '#value' => $attribute->aid);
    drupal_set_title(t('Edit attribute: %name', array('%name' => $attribute->name)), PASS_THROUGH);
  }

It is clear that $attribute is not an integer when it is used by this fucntion. It actually is an attribute stdClass object probably loaded by uc_attribute_load(...).

My question is: What's happening behind drupal_get_form that at the end an integer (the attribute ID) coming from the URL, ends being a full attribute standard object.

I'm kind of learning / developing a module extension and tried to backtrace but definitely couldn't get to an answer.

Thanks!

Juan B.


texts: How to duplicate nodes programmatically?

texts:
I want to create duplicate nodes of a content type programmatically.

Is there any way to do this?

Note: I don't want to use any module to do this.


texts: Different node / entity templates based on display type

texts:
Is it possible to have different template files for different display modes of the same entity without using template_preprocess_page()? If not, how can I get all the available display modes for a certain entity type so I can create some sort of automatic template suggestion?

Eg: For a node I have by default the 'Full' and 'Teaser' display types. I can add more display types using Display suite module or by creating a custom module. I need to create multiple template files like node--content-type--teaser.tpl.php to keep everything clean and not use lots of IF statements.

Thanks :)


texts: How do I display an array of entities from a controller?

texts:
I am new on Drupal 8 , so i have created a service class which return a list of data, 'articles' (node entities), and I call this  service class inside a controller, but no data showing up :
My getArticles() method inside my service:
  public function getArticles(){
    $storage = \Drupal::service('entity_type.manager')->getStorage('node');
    $my_entity_ids = $storage->getQuery()
      ->condition('type', 'article')
      ->condition('status', 1)
      ->execute();
    $my_entities = $storage->loadMultiple($my_entity_ids);
    return $my_entities;
  }

My controller:
public function myPage() {
    $data = \Drupal::service('mymodule.service');
    $dataService = $data->getArticles();
    return $dataService;
  }

My result is a blank white page when I view the path routed to my controller, but I see the following message in my error log:

Recoverable fatal error : Object of class Drupal\node\Entity\Node could not be converted to string dans Drupal\Component\Utility\Xss::filter()'' -----"Warning : strlen() expects parameter 1 to be string, array given dans Drupal\Component\Utility\Unicode::validateUtf8()

Can anyone tell me please why i can't get the articles?


texts:
Ive been searching around drupal and google to find some awnsers but get lost and fustrated and came here for some help.

What i want to do is have a drupal site which is not public, and has the functionality of google docs, calendar and drive...yes i know i could just use what google have already made but im a little paranoid in this world and would like to have TOTAL control over my documents as this will also be on a dedicated server.

So are there modules/ways out there where i can upload/download + edit text documents and spreadsheets? I know i could use a WYSIWYG but could i then download the page/node as a .doc file for example?

Sorry if it doesnt make much sense,
Many Thanks in Advance
Russel


texts: How to use Rules to send an email to customers 1 month prior to license expiration date?

texts:
I am using the Drupal Commerce module and I have a product type service for license to be sold on site. I have different licences (products) like 1 year license, 2 year license, 6 months license and many more.

I need to send an email to customers 1 month prior to their license expiration date. Like if customer purchased a license for 1 year, then the email should be sent 11 months after date of purchase. Similarly with other products like after 5 months if license is for 6 months.

How can I achieve this using the Rules module?


texts: My $_SESSION array in drupal 7 is empty after login

texts:
I tried to view the $_SESSION and $_COOKIE details by print_r ing those two arrays

But my session array is empty before and after login.

I wrote the code in template.php file.

But the user is loggin in with out any problem.

Is there any problem with my installation, am running it as http://localhost/drupal7/

echo '
';print_r($_SESSION); echo '
';
echo '
';print_r($_COOKIE); echo '
';

this is the code i have written to print it.I am going thru it to know whether its session and cookie values are colliding with that of magento as i am working on single sign on into drupal and magento.


texts: Contextual filter to show only nodes of the same type

texts:
I am trying to create a View that will be a sidebar block on node pages of various content types. The View is pretty basic, just a linked title. I figured I could use Contextual Filters (what used to be Views Arguments in Drupal 6) so I don't have to set up many Views that will all be the same and just use one for all.

My goal is to get only nodes in the sidebar block View of the same type to show up on a node page. So for example on a single Blog node page, the sidebar View will only show other blog stories. However, that same View on a News content type node page will only show other News stories in the View sidebar block and so on...

I have various content types including "News", "Services" and "Blog".

Here is what I have tried so far.

Set up the basic View, showing linked titles.
Added a contextual filter using Content: Type
"When the filter value is NOT available"

Provide default value >> Content id from URL

"When the filter value IS available or a default is provided"

"Specify validation criteria" >> Validator >> Content >> Checked off the content types I want i.e. Blog, News, Services.

After I save this, no data shows up on any of the node pages.  I also tried playing around with other various options in the Contextual settings but to no avail. My google-foo is also failing as everything I found for something like this deals with Taxonomy and that's not what I am after here.


texts: How to change path that username points to

texts:
I have basically disabled user accounts from being accessed, because I am using Profile2 module for user profiles. So there is no need to view the users account page. But in posts and forums in my site the username shows up by default and links to the user's account, not their profile. Is there a hook somewhere that I can use to have the user account path /user/uid, always point the the profile /main-profile/uid?

I know I can change the link in views, but I was looking for a site-wide solution. That will always make the username link to the profile. I'm thinking there has to be some hook I can use to redefine $user_path, but I can't figure it out.


texts: Calendar events showing all dates for that day

texts:
I am using a pretty standard calendar for handling events for a site I am making. I didn't change anything from the default, but this is happening.

Here is an image of the calendar view from the views ui: http://i.imgur.com/oQjLxvTh.jpg
Here is the actual output on the page: http://i.imgur.com/UEFytxW.jpg

I see what it is doing. It is spitting out all of the dates on that day for each event. I just can't figure out how to make it stop.


texts: Some #states not working for custom field but do work on identical webform field

texts:
I'm working on a project where I'm programmatically cherry picking elements from a webform and then creating a custom form with all sorts of alterations and additions to the "cloned" webform fields.
$my_custom_field = $webform->getElement($webform_field_id, TRUE);

I'm then rendering a number of custom fields like the above in a custom form that extends from FormBase. The custom webform consists of fields, custom containers, attributes etc.
Everything works fine, #states included, apart from the "pattern" state and a few other states that are based on relative values e.g. "greater" / "greater_equal" / "lower" / "lower_equal". I'm adding these #states programmatically to the custom fields.
Example:
$custom_field['#states'] = [
  'visible' => [
    ':input[name="controlling_field_name"]' => [
      'value' =>
        // I've tested this pattern, it works in the webform field fine.
        'pattern' => $some_regex_pattern,
      ],
    ],
  ],
];

Apart from 'pattern', I've tried 'between' and 'greater', 'greater_equal', 'lower' and 'lower_equal' with no success.
The same exact #states (same field being dependant on same controlling field under the same exact conditions) work fine on the original webform field (when I view the webform on the admin theme for example) which makes me think that something is missing from / messing up with these #states on my custom theme.
No JS errors in the console whatsoever.
The structure of "data-drupal-states" when I render this custom field (webform field "clone") in my custom theme is exactly the same as the webform field that's rendered on the admin theme ie in its "native" webform.
Other #states work fine for the custom field ("value", "checked" etc.).
Any ideas on what's possibly messing up these specific states?


texts:
I made a sub-theme of the admin theme "Seven" and called it Seven2
Because I wanted to customize the node-edit-form.twig.html file.
That works.

My next step, I want to add a block I made in a custom module, to that node-edit-form.twig.html.
There are several ways of doing that, and one I chose is preprocess page (or node for that matter), where I want to load my block.

The preprocess functions can either be in Seven2 .theme file or the custommodule.module file.

When I execute:

$block = \Drupal\block\Entity\Block::load('checkmark_block');

The $block is NULL when I do kint($block). Its like it can't find the damned block!! I have spent like 4 hours trying to make this thing work, in different ways, but no matter what, I can't load that block in my preprocess function. I don't know why but I think it's because it's an admin theme? Or... please help.

One of the blocks located in custommodule/src/Plugin/Block:

<?php
namespace Drupal\custommodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;

/**
 * Provides a 'CheckMark' Block.
 *
 * @Block(
 *   id = "checkmark_block",
 *   admin_label = @Translation("CheckMark block"),
 *   category = @Translation("CheckMarks"),
 * )
 */
class CheckMark extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $markup = 'Test test';

    $build = array(
      '#type' => 'markup',
      '#markup' => $markup,
      '#cache' => array('max-age' => 0),
    );

    return $build;
  }

}


texts: hook for disabling fields on add and edit node for a content type

texts:
I have a content type called article where i have 6 fields.

But i need to display and hide this fields based on user group while add and edit node.

I am confused about which hook should i use.I am planning to use hook_page_alter().Please let me know wheather it is the correct hook i am using.Thanks a lot.


texts: Printing out path from views - /drupal/ appears twice

texts:
I'm using this to print out a custom link format in views. I'm using it in the unformatted views tpl.php file.

<?php print l(' a',
              $view->style_plugin->row_tokens[$id]['[path]'],
              array ('html' => TRUE)); ?>

This line calls the relevant HTML path:

$view->style_plugin->row_tokens[$id]['[path]']

For example it might contain the value: localhost/drupal/node/31.

But when I put it in the l() function I get localhost/drupal//drupal/node/31.

Anyone know how I can stop the double print out? This is driving me mad.


texts: I don't believe I have never run into this before, but I have a Panels page with a few variants based on selection rules.  Is there a way that you can serve up cached results for the whole page (not just the individual panes) after the selection rules have run?  I am not seeing any options or other modules to get Page Manager to do this.


texts: How to use Font Awesome with Bootstrap LESS theme?

texts:
I have created a sub-theme, using the LESS Starterkit, of the Bootstrap theme. I would like to self host the Font Awesome icons and make them available to a custom module.

I have downloaded the Font Awesome project to: sites\all\themes\MYBOOTSTRAPTHEME\font-awesome.

Following these instructions, I have added the following (last four) lines to: sites\all\themes\MYBOOTSTRAPTHEME\less\variables-overrides.less:

//== Iconography
//
//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.

//** Load fonts from this directory.
@icon-font-path:          "../fonts/";
//** File name for all font files.
@icon-font-name:          "glyphicons-halflings-regular";
//** Element ID within SVG icon file.
@icon-font-svg-id:        "glyphicons_halflingsregular";

//** Load Font Awesome fonts from this directory.
@fa-font-path:            "../../font-awesome/fonts/";
//** File name for all Font Awesome font files.
@fa-font-name:            "fontawesome-webfont";

I have added the following line to my custom module:

<button type="button" class="btn btn-default btn-lg">
   Camera
</button>';

After recompiling my LESS: nothing. What am I missing. Thanks.


texts: How to pass term id from the exposed filter block selection to a view pane

texts:
I have a requirement to show courses by semester dynamically when semester is changed via an exposed filter.

Firstly, I have created a taxtonomy term jumplist view block for semesters. This view block shows as an exposed filter for semesters.
Secondly, for displaying courses I followed the following blog and a video (on view panes) to implement the a view pane for courses.

https://www.youtube.com/watch?v=a_j3xUpdLEs
http://www.metaltoad.com/blog/passing-page-arguments-view-panes

Created custom panel page where these views are placed.

The pane page URL works when I manually append an ID to the term URL.

My question is how to pass filter selection from the first jump menu block view (step 1) to the view pane (step 2)?


texts: Node reference solution for a content type which referenced to two fields. (company, product & review)

texts:
My website has three content types: company, product & review.

1). The product has a field referenced to a company node using Node URL Reference module.

2). The review has two fields, one referenced to company node, another referenced to product node.

The question is how to implement the item 2) following the behaviours described below:

While creating review node from company node, the product field should be updated to the products which belongs to that company.
While creating a review from product node, the company & product fields should be auto-filled.

Could you help me? I research this issue for several days but haven't resolved completely. Thanks a lot.


texts: Drupal aligning blocks and content next to each other

texts:
i have a view page and two blocks which i want to display next to each other. I want view content on left and two blocks on right, with one block on top and other just below it. But i am having trouble in achieving the same. My html guy says its not possible to do that without a wrapper container as we need to have things in center as well.

I have omega 4 installed, so sidebar is also below the content block. Also i don't have consistent layout view, as on some pages i have only content with full screen background, and with no side content and on some i have content in which i am facing a problem.

I have searched on google and SO but every solution says to have a wrapper, which is not possible as placing a wrapper globally will limit the display on every screen, which i can't have.

One solution i can think of is use javascript to add classes on page load where i have two column display but it is not a good way to do that i believe.

How can i solve this, can anyone please help??


texts:
I am building a module to that uses taxonomy, I would like to use drupal functions as much as possible vs going to the database directly. In addition I am using the Field Module to add additional information to each of the Taxonomy entities.  I would need to be able to dynamically pull back a given set of taxonomies and all fields used. Does anyone have a nice example for doing this. I know there is a function taxonomy_get_tree and there is the field APIs just not sure the best way to implement.

Thanks


texts: how to add a redirection after password change without modifying Drupal Core?

texts: how to add a redirection after user's password change without modifying Drupal Core? (user_profile_form_submit)


texts: Adding CSS around taxonomy terms in node field

texts:
In my node, I have a taxonomy field that displays one or more taxonomy terms (as plain text using DS).  I want to wrap a CSS class around the term, depending on the term value.

Where is the best place to do this?


texts:
I am trying to generate a email address that reads as no-reply@example.com.

Using the global base_url the output is http://example.com.

Is there another global, or some other easy solution, to remove the "http://", so that I get the string example.com?

Thanks in advance


texts: how to set a variable in module and get it in theme

texts:
i want set a variable in module and use it in my theme,
(except variable_set and variable_get way.)

for instance . in module file

      if(in_array(arg(1),$ex))
      {
//      set a variable
      }

in theme file

if(//variable)
{
echo '

';
}

thank you so much for help me


texts: autocomplete field show name pass uid to form

texts:
In my module I'd like to allow admin/moderator to add some user specific settings e.g. user steve1 has to work between 8am and 3pm.

To make work easier for the admin I'd lke to use autocomplete field for choosing user.

Suggestions are made via user name, but to form, I need to pass uid instead of a name.

Is this possible via modyfinig my autocomplete code, or should I change provided name to uid during form_submit operation?

$matches = array();
$query = db_select('users', 'u');

$return = $query
  ->fields('u', array(
    'uid',
    'name'
  ))
  ->condition('u.name', '%' . db_like($string) . '%', 'LIKE')
  ->range(0, 10)
  ->execute();

foreach ($return as $row) {
$matches[$row->name] = check_plain($row->name);
}

// return for JS
drupal_json_output($matches);


texts: Add download file feature to ubercart products using rules

texts:
I am using drupal 7 and ubercart along with ubercart file download module.

Is there any way to add download file feature to ubercart products using rules, based on some attribute conditions I have to add the file with a ubercart product, so I prefer to use rules for this.
Now I do not understand is there any way to add files with particular product using rules...help will be greatly appreciated...


texts: Webform module issue - content type not displaying

texts:
By accident I deleted the Webform content type in my Drupal 7 installation. It was a complete accident and thought that I was deleting a different content type. I tried going through a couple of tutorials that I saw online but was unable to get the content type back. Does anyone have any ideas on how to do this?

I stumbled across this: http://www.drupalgardens.com/documentation/feature/webforms/recreate which was a small step forward, but it still doesnt work. Has this happened to anyone before? I have tried uninstalling the and re-installing the module, clearing my cashe, and running cron. Still nothing.

Can anyone provide any suggestions? I can't be the only one that this has happened to before and there has to be so sort of fix to this... Also, please note that I am a relatively new Drupal developer.


texts: add name field with email to invite block

texts:
I want to capture the name of the user who is invited by an existing user, along with the conventional email field. This is because I want to use this name in the email that is sent to invited user so that he finds his own name on top of the mail bosy as "Dear 'name'" .

How can this be done?


texts: How can I allow users to create private pages?

texts:
I want a way to create a way to allow only specific users to see a specific page.

One page per user where one user can't see another's page.


texts: Using "Model Entities" Module to Create Custom Entities

texts:
Model Entities: http://drupal.org/project/model

I've been trying to use this contrib module to create my own entity (the "client" entity). Steps I've undertaken:

Search and replaced "model" with "client", "Model" with "Client".
Upon enabling the module, the "client type" appears in "admin/structure", and I create a "client type" from the UI.
Go to "admin/content/clients" and added a new client, but the new "client" entity does not appear.

So far debugging has gotten me this far:

The database is being populated correctly - so the creating functions (and rest of CRUD - tested via direct calling) is working.
I checked entity_load('client') and it's loading the client entities properly as well.

So I suspected it's something to do with the custom "views" that the module is implementing. And indeed, it did not register the custom view properly since it did not appear in "admin/structure/views".

I can't seem to pin-point the error here. Any idea why the view isn't registering?


texts: pass parameters drush_make or drush_make_process

texts:
I would like to call the following drush make command within drush script:

drush make someFile.make --no-core --contrib-destination=sites/all --yes

However, the Drush API for drush_make and drush_make_process only takes the directory name of the make file(thats how i uderstand, but may be wrong). So, i tried something like:

  drush_set_option('no-core',true);
  drush_set_option('contrib-destination','sites/all');
  $status = drush_make_process('.');
  //$status = drush_make_process('someFile.make');

This doesn't work. It appears that the make file is not even processed.  Any help i would much appreciate


texts:
I'm looking for direction with regards to how to get a file to download only after you are logged in, and to be prompted to login if you try to download it and then upon a correct submission, have that file automatically download.  The login form is to be presented in a modal dialog upon clicking the file when logged out.

Right now I have the modal form displaying when clicking the file download link, but I essentially need to reconstruct the login mechanism to work via AJAX I believe.  This includes validations and establishing the user's logged in session.  I'm not sure how to go about it... thoughts from the Drupal Answers community?


texts: How to create a RSS feed of certain content type ( without affecting the front end layout )?

texts:
I would like to create a RSS feed of certain content type ( without affecting the front end layout ), but I am not quite sure how can I add this feature to Drupal. Any clues for me to start with?

p.s. I'm using Drupal 7.


texts: I need to send a message to the customer when I change the order status (e.g from pending to processing-completed-canceled). How can I do this with Rules?


texts:
I'm using Webforms (via the Webform module) and using Rules (with the Rules module and the Webform Rules module)... as a side note, I'm also using CiviCRM although I don't think that is has an impact of the issue I am having...

When using Rules I can specify an action to take place on a given event - in my case when a particular webform is submitted.  When webform 'a' is submitted I want a Drupal user to be created...

If I use the action 'create entity' and specify that the entity to be created is of type 'User' then if I statically enter the value for the username and the e-mail address the Drupal account is created.

However, if I try to tell the action creation process to use the value entered in the webform as the username and the e-mail address ( e.g. [data:{component}-value] where {component} is substituted for the machine name of the field in question ) for the intended Drupal account, no Drupal account is created.  Does anyone know why this is the case and what the solution for this is?

Side note: I know the value used in [data:{component}-value] is correct as I added an action saying output a message and added the data field to the message and it shows the correct details (e.g those entered in the webform)


texts:
Im trying to print the full path to my theme in my html.tpl.php file. In the following code the 2nd part prints correctly but the first part does nothing.

<?php print base_path() . path_to_theme(); ?>


texts: How do I determine the values to use in the payload for the add to cart method in the Commerce API

texts:
The documentation for the Commerce API gives the example payload below for adding items to a cart. How do I find the type and ID values for the product variants in my store configuration?
{
  "data": [
    {
      "type": "product-variations--default",
      "id": "e8daecd7-6444-4d9a-9bd1-84dc5466dba7",
      "meta": {
        "quantity": 1
      }
    }
  ]
}


texts:
I am running drupal on nginx and I have the services module installed (https://www.drupal.org/project/services). I have some views enabled to get and edit web content via http requests. The url's are of type http:/base_url/end_point/view. It works pretty well on apache, but in nginx I get a 404 error specifically with those urls (the rest of drupal pages are correctly displayed).

In apache I used the following configuration on
 /etc/apache2/sites-available/000-default.conf to get those links working

<VirtualHost *:80>

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

<Directory /var/www/>
    Options FollowSymLinks
    AllowOverride All
    Allow from all
    Options Indexes FollowSymLinks
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

In nginx I have tried with disable_symlinks off, but it does not work. The following is the configuration at /etc/nginx/sites-available/default

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.php index.html index.htm;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        autoindex off;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
        disable_symlinks off;
}

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    autoindex off;
    # With php5-cgi alone:
    #fastcgi_pass 127.0.0.1:9000;
    # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    disable_symlinks off;
}

How should I configure nginx to be able to follow the services links?


texts: Create two nodes from webform submission

texts:
I have webform with many fields.
And I need to create two nodes after webform submission.
First node would have some values from the webform.
And second node would have other values from the same webform.

How can I do this?
(rules? hooks?)

Would be using Webform Default Fields or Webform report the right solution?


texts: How can I know whether user has logged in through facebook account or through Site login?

texts: How can I know whether user has logged in through FB or through site's login section? I am giving points to user based on FB login that's why It's important to know. Thanks