SearchRecent postsThe Random ToolboxDrupal 7 Setting up variables for use in a template (preprocess and process functions) Rendering Drupal 7 fields (the right way) Linux Secure Copy (scp) command Restrict Free Shipping in Magento Quickbooks Text Connection Ticket Cross-Site Request Forgery (CSRF) jQuery Events: MouseOver / MouseOut vs. MouseEnter / MouseLeave Monthly archive
|
August 2011Assign Multiple Roles to User Programmatically in Drupal$user = user_load(104); $details = array( 'uid' => $user->uid, 'roles' => $user->roles ); $details['roles']['7'] = 'FREE ORDER'; user_save($user, $details); Get URL arguments using Javascript - $_GET Variablesif (location.search != "") { var x = location.search.substr(1).split(";") for (var i=0; i<x.length; i++) { var y = x[i].split("="); alert("Key '" + y[0] + "' has the content '" + y[1]+"'") } } Remove Newline from Text of Element / Convert \n to <br />I was trying to write an if statement to perform some actions when a certain error message was present. I went round and round trying to figure out why the text of the element wouldn't match in my if statement. Turns out it was because there was a line break before the text which is considered content. Drupal Administration Menu not displaying with custom themeI have been creating a custom theme for my drupal website and I ran into this problem where the Drupal Administration Menu (module) disappears for custom themes that are not based on out-of-the-box themes. I did a lot of searching for a solution with no luck, so in the end I just ran through the code of existing themes to see what code is required for the menu. Hopefully I can help someone who may have the same question! You basically need to have this code at the end of your page.tpl.php file: Ubercart Credit Card Fields Not Showing at Checkout - Only Shows Loading BarInside of Secure Pages Module, add See this post for more details: This also applies to any other payment method you have like: |