7,hooks,redirectRelated issues-Collection of common programming errors


  • Clive
    7 autocomplete
    I’m kind of new to drupal (been working with it for 2 months) and i seem to hit a wall with this issue . I’ve written a little module to allow my users to find phone numbers quickly . It uses autocomplete and works perfectly fine when the user is logged in , but fail when it ain’t the case (no icon in the field no http requests fired).Digging a little further , i can see that neither the autocomplete.js is loading nor the targeted field is properly formatted for autocomplete .<form action=”/”

  • kiamlaluno
    7 modules user-login authentication
    I am trying to create a module that will check for two databases when logging in a user to Drupal. If drupal’s native login is a success but the external application does not have that account, then the module will create an account on the external application. If the account is not on drupal but is on the external application then drupal will create a local account. If the user does not exist on either database then the login will fail. Which hook(s) would I need to implement this in a module?

  • kiamlaluno
    7 forms
    I have a form with radios on it. I do submit on the same page (there’s no $form[‘#action’] assigned in the below code). What I want to do is to get submitted year in template.php so that I can define my logic based on received value.To check that’s all work fine I wanted print_r the contents of form[‘values’]. I did that in submit function but it didn’t work. Actually, I can’t print anything from both validate and submit functions.So my question is how I can get the submitted value to template.p

  • everaftergraphics
    7 taxonomy css
    I have to create a website that allows for a “new” tag to be floated above certain pictures that have the specific taxonomy term of “new”. I created a view for the “new” where I added an empty div below the image and then floated it above the image and added the actual “new” image with CSS. This is what it looks like For the “new” node.tpl.php the code looks like this:<article class=”node-<?php print $node->nid; ?> <?php print $classes; ?> clearfix”<?php print $attributes

  • Waqas
    7 hook-form-alter
    I am implementing hook_form_FORM_ID_alter(). I have managed to setup for, and be able to collect custom values from the fields. When I submit the form, the node is created without my custom fields (i.e field_1 an field_2).function mymodule_form_AYG_node_form_alter(&$form, &$form_state, $form_id){$options_first = _mymodule_get_first_dropdown_options();$selected = isset($form_state[‘values’][‘field_1’]) ? $form_state[‘values’][‘field_1’] : key($options_first);$form[‘field_1’] = array(‘#wei

  • ijujym
    7 drush
    Iv managed to install Drush to the site on Go Daddy shared hosting(thanks to the greate tutorial!). Simple commands run without any errors, but when I try:drush pm-update ctoolsIt returns:-bash-3.2$ drush pm-update ctools The external command could not be executed due to an application error. [error][error]<br /> <b>Parse error</b>: syntax error, unexpected ‘{‘ in <b>/home/

  • kiamlaluno
    7 taxonomy ubercart
    I upgraded a D6/Ubercart 2 website to D7/Ubercart 3. The upgrade seems to have gone very well and I have all of my updated modules installed. The only issue I am seeing right now is that I cannot save changes to any Ubercart Product content node. When I try to edit and save a product node, I receive a generic “The website encountered an unexpected error. Please try again later” error. However, watchdog is more verbose with what went wrong:PDOException: SQLSTATE[42000]: Syntax error or access vio

  • Webdrips
    7 panels
    I’ve recently taken over a site that’s displaying a very generic error when attempting to access a page that’s known not to exist (e.g. /people/incorrect-name): “The website encountered an unexpected error. Please try again later.” I checked the log and I see this: Recoverable fatal error: Argument 2 passed to drupal_goto() must be an array, string given in drupal_goto() (line 686 of common.inc).I then started looking at how the /people/* pages are built. It turns out two panel pages are in play

  • Rosamunda Rosamunda
    7 fields panels tokens display-suite
    I have this core profile field in Drupal7: profile-curso-basico. I want it to be shown in the user´s profile only if the field has information in it (it´s a deprecated field, but some old users have data in it, and migrate modules didn´t import it properly, because it´s a hardcoded list).I´m using panels, token and Display Suite modules. At the profile page, I have this panel with a special coded DS field, that has dinamic information using tokens.If I just paste: Mi Curso: %user:profile-curso

  • Lukasz Zaroda
    7 drush
    I’m trying to upload a database on the server with SSH by using sql-sync, but I’m getting the following error:PHP Parse error: syntax error, unexpected ‘{‘ in /home/luken/programs/drush/includes/environment.inc on line 517 X-Powered-By: PHP/4.4.7 Content-type: text/html […]As you see from the error message, it is using PHP 4.4.7, while I want to use PHP 5.4.I tried adding the following line to .bash_profile.export DRUSH_PHP=php54 (that is php version I wanted to use, and it works when I normal

  • Torbjørn T.
    calculations lengths hooks
    I want to systematically have some indentation in \parboxes and minipage environments. To do this, I add the following code in the preambule of my LaTeX file:\makeatletter \g@addto@macro\@parboxrestore{\setlength{\parindent}{1.5em}} \makeatotherIt works, except when I load the calc package. I get then! Missing number, treated as zero. <to be read again> etc. It seems \g@addto@macro does not like the way \setlength is redefined in calc. How could one solve this problem?Here is a minimal wor

  • XZS
    standalone hooks
    Using the commands \AtBeginDocument and \AtEndDocument with the standalone documentclass yields unexpected effects.I have the following three files.% main.tex \documentclass{scrartcl} \usepackage[subpreambles]{standalone} \AtBeginDocument{begin main \\} \AtEndDocument{end main \\} \begin{document}%before\input{sub1}between\input{sub2}after \end{document}and% sub1.tex \documentclass{standalone} \AtBeginDocument{begin sub1 \\} \AtEndDocument{end sub1 \\} \begin{document}% \end{document}sub2.te

  • user1632018
    php theme-development functions jquery hooks
    I am developing a theme and I have called jquery along with other JS files from a theme-enqueue.php file. For some reason only the Jquery file that is hosted on googles servers is adding the theme URL into the URL path so it is not loading it and causing other JS files to not load properly. The hook is done properly and it is pointed only to their server and does not include a get_bloginfo or get_template_uri.The file it is adding my theme URL to is:’http://ajax.googleapis.com/ajax/libs/jquery/1

  • wpStudent
    php query-posts hooks functions mysql
    I have a plugin which creates a new database table. Upon activating the plugin is there a way to insert all my posts ids into that table?Right now I’m using an action hook to immediately insert the id of new posts I publish.function transfer_post_id($post_ID) { global $wpdb;if (!($wpdb->get_row(“SELECT post_id FROM $my_table WHERE post_id = $post_ID” ) ) ) { //if post id not already added$wpdb->insert( $my_table, array( ‘post_id’ => $post_ID ) ); }return $post_ID; }add_action ( ‘p

  • Lyon
    hooks
    I am new to Drupal, and I was trying a small example from Book “Pro Drupal 7 Development”, this is an example of basic menu system, here is code:function menufun_menu() { $items[‘menufun’] = array(‘title’ => ‘Greeting’,’page callback’ => ‘menufun_hello’,’access callback’ => TRUE,’type’ => MENU_CALLBACK, ); return $items; }function menufun_hello($first_name = ”, $last_name = ”) { return t(‘Hello, @first_name @last_name’,array(‘@first_name’ => $first_name, ‘@last_name’ => $last

  • kiamlaluno
    7 modules hooks
    Today I changed the weight of a custom module of mine in order to change the execution method of hooks (hook_form_alter). I’ve changed the weight to 1 value heavier than the other module’s weight. This seemed the safest thing to do instead of giving it a “random” weight of 100. The original module is a core module (translation) so I hope I didn’t break anything.When adjusting the weight of a module in order to change the execution order of hooks, what are the things to look out for and what are

  • Atif Mohammed Ameenuddin
    theme-development hooks
    I would like to write a function to email me the URL of the website when my theme is activated.What is the hook initiated when the theme is activated?

  • leeand00
    plugins plugin-development hooks actions
    I’ve recently started using the Hikari Hooks plugin for WordPress as it seems to allow you to get a good idea of what do_actions are being called on the page, so that you can easily find out where potential hooks for plugin code might lie.Are there better tools/plugins for accomplishing the same thing?In particular I was looking for one that might notify me of post status transition actions such as new_to_publish and draft_to_publish…It appears that Hikari Hooks does notify you of such changes

  • Roland Franssen
    7 hooks
    Im using the menu_trail_by_path which does a pretty good job for most of my URL’s, however in a custom module I’m setting the breadcrumbs directly (drupal_set_breadcrumb in a page callback). These crumbs get messed up due the menu_trail_by_path module (sort of overwritten I guess =/)This happens because menu_trail_by_path sets the crumbs using hook_page_delivery_callback_alter which is called after the page callback apparently.I would like to keep my custom crumbs in the page callback as it has

  • bungeshea
    hooks
    When I wish my filter or action hook to override all others, I will assign it a priority of 999. However, lately I have been seeing some people use extreme values for the priority, such as 20000, and even 99999Besides the fact that using priorities this high is ridiculous, will they actually work? Is there a limit to hook priority? What will happen if the limit is exceeded? Is there a performance difference when using extreme priorities?Update: @harke suggests on Stack Overflow that the number i

  • arifshaikh
    jquery android html redirect phonegap
    I am trying to create a android app with phonegap, the first page is the login page, it queries to a server for user authentication, the server returns json string: true if the login is successful or false otherwise. I am getting the response but i am not able to redirect to next html page. I am using the below code $(‘#loginForm’).submit(function(){var uid = $(‘#login’).val();var pwd = $(‘#password’).val();$.getJSON(‘http://xxx.com/phonegap/login.php’,{ userid: uid, password: pwd },function(jso

  • Larold
    powershell redirect
    I have a script that generates output of various forms – mostly standard output and error channels.I have tried things like:script.ps1 > $somefile 2>&1 script.ps1 | tee-object <args> script.ps1 | out-file <args>I’ve also tried start-transcript / stop-transcript. All of these methodologies have their drawbacks, or just don’t plain seem to work.What is the closest powershell equivalent of the UNIX-style invocation:myScript.ps1 > $somefile 2>&1When I try the above co

  • johnnyfittizio
    php html redirect laravel laravel-4
    This is the situation:In my Laravel 4 app, after validating, it redirect to the same page displaying a succesfull message. It works fine. The problem is that the page is quite heavy and so the redirecting process it takes up to 3 seconds. What i would like to do, is to display a message without redirecting. In order to save the time that takes to load the page again, and display the message instantly.This is the code:return Redirect::back()->with(‘message’,'<b>Congratulations! You have

  • Uzair Khan
    php urls redirect permalinks
    If i try to access my wordpress page using the native url structure i.e. for instance:www.mywebsite.com/?p=123I am redirected to my homepage. It doesn’t seem to be an htaccess issue for I tried without it as well. This is also causing some of the ajax requests to fail. It works fine if I go back to the default url scheme.

  • kiamlaluno
    redirect pathauto
    When I use a username as an url parameter like: ‘www.example.com/user/adam’ instead of ‘www.example.com/user/27’ I get a database exception:Error messagePDOException: SQLSTATE[22018]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the nvarchar value ‘adam’ to data type int.: SELECT base.[uid] AS [uid], base.[name] AS [name], base.[pass] AS [pass], base.[mail] AS [mail], base.[theme] AS [theme], base.[signature] AS [signature], base.[signature_format] AS [

  • Gavin Miller
    redirect hyperlink ethics
    I’m just looking through some of the webmaster stats that Google provides, and noticed that the most common links to our website are to some research articles that we’ve put up in PDF format. The articles are also available on the site in HTML.I was looking at the sites (mostly forums and blogs) which link to these articles and was thinking that none of the people clicking the links would actually get to see our website, and that we’re giving something away for free and not even getting some pag

  • l0b0
    bash shell redirect variables stderr
    Let’s say I have a script like the following:useless.shecho “This Is Error” 1>&2 echo “This Is Output”And I have another shell script:alsoUseless.sh./useless.sh | sed ‘s/Output/Useless/’I want to capture “This Is Error”, or any other stderr from useless.sh, into a variable. Let’s call it ERROR.Notice that I am using stdout for something. I want to continue using stdout, so redirecting stderr into stdout is not helpful, in this case.So, basically, I want to do./useless.sh 2> $ERROR | .

  • enjiner
    iis redirect web-browser internet-explorer-10 internet-explorer-11
    I have an IIS redirection configured to redirect all browser requests to a single page, where the HTTP_USER_AGENT matches ‘rv:11.0’. This is mostly working as expected (Internet Explorer 11 requests are being redirected to the specific page). However, we are also experiencing some false positives. A user on Internet Explorer 10 is also being incorrectly redirected to this page after following particular links, despite having a different user agent. When we test this user agent string using the ‘

  • LazyOne
    zend-framework .htaccess redirect error-handling
    I developed a website using Zend Framework. In order to handle errors, I want to add to the htaccess file the following lines so I can redirect the user to the corresponding every time there is an error.ErrorDocument 500 /errors/500.html ErrorDocument 404 /errors/404.html ErrorDocument 403 /errors/403.htmlso my htaccess file now in the /public folder looks like this:RewriteEngine on # Rewrite rules for Zend FrameworkRewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* index.php# Security: Don’t al

  • Quintin Robinson
    exception-handling redirect error-handling
    I’m trying to standardize the way I handle exceptions in my web application (homemade framework) but I’m not certain of the “correct” way to handle various situations. I’m wondering if there is a best practice from UI/ user-friendly point of view.User logs into application and opens two tabs showing the same screen. On one tab they issue a delete command on object FOO. Then, in the other tab they then click the edit command on FOO (which no longer exists); e.g. a GET request for editObject.ph

Web site is in building