max_allowed_packet error when importing a large database

November 4, 2009 arnelbornales Leave a comment

I got max_allowed_packet error when importing a sql database from the server,

anyways, I solved it through setting new values for this “max_allowed_packet”!

ok, here it is
1. login to your mysql account

mysql -uYOUR_USERNAME -pYOUR_PASSWORD

2. Now, when your logged in set the new value for your “max_allowed_packet”

set global max_allowed_packet = 1073741824;

3. to check the new value of our max_allowed_packet

show variables like ‘max%’

There you go!

Categories: mysql

Wamp Error – [EparseError] No tray Icon was specified

October 30, 2009 arnelbornales 1 comment

I had an error about wamp recently: [EparseError] No tray Icon was specified
I almost tried to re-install my wamp server, but stumbled upon finding things from google.

The problem is in wampmanager.ini.
check out your  wampmanager.ini if it’s WHOLE EMPTY,
then this would be a great solution for that problem.

Now,

paste this code inside your wampmanager.ini file (usually located at C:\wamp\wampmanager.ini)

[Config]
ImageList=images_on.bmp
ServiceCheckInterval=1
ServiceGlyphRunning=13
ServiceGlyphPaused=14
ServiceGlyphStopped=15
TrayIconAllRunning=16
TrayIconSomeRunning=17
TrayIconNoneRunning=18

[Services]
Name: wampapache
Name: wampmysqld

[StartupAction]
Action: run; FileName: “c:/wamp/bin/php/php5.2.5/php-win.exe”;Parameters: “refresh.php”;WorkingDir: “c:/wamp/scripts”; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors

Save the file and click Start Wampserver

There you go!

Categories: Wamp, Wamp error

How to show unread messages using privatemsg module

October 26, 2009 arnelbornales Leave a comment

Recently, Im working on privatemsg module. I already customized the form: removing the subject field(replacing it with the node title), removing the recipients field, for these are some of the clients specifications. Now, my next task is to show all unread messages. Unfortunately, there’s no unread messages tab nor page for it. So, I decided to ask help by filling issues in privatemsg module. Berdir quickly suggested me on how to achieve what I wanted and I thanked him for that suggestion because it worked for me smoothly.

so, here’s the custom module

first, create a .info file named it as privatemsg_unread.info

 

; $Id: privatemsg_unread.info $
name = Show Unread Private messages
description = Show Unread Private messages
package = CUSTOM MODULE
core = 6.x

 

Next, Create the module file,named it as privatemsg_unread.module

function privatemsg_unread_menu() {
$items['messages/unread'] = array(
‘title’ => ‘Unread’,
‘page callback’ => ‘unread_messages’,
‘access callback’ => ‘privatemsg_user_access’,
‘type’ => MENU_LOCAL_TASK,
‘weight’ => -20,
);
return $items;
}
function unread_messages(){
$unread_msgss = drupal_get_form(‘privatemsg_list’, ‘unread’);
return $unread_msgss;
}
function privatemsg_unread_privatemsg_sql_list_alter(&$fragments, $account, $argument) {
if ($argument == ‘unread’) {
$fragments['where'][2] = ‘pmi.is_new > 0′;
}
}

 

Put it inside a folder privatemsg_unread upload to your modules folder(usually sites/all/modules)
enable the module(admin/build/module) then voila!!!

To test(if only you have recent unread messages, otherwise no messages will be displayed) ,
try to access www.YOURSITE.com/messages/unread

Feel free to add some more..

Categories: Drupal, Drupal Planet

how to override a specific output in drupal

October 20, 2009 arnelbornales 1 comment

Finding a hard time how to override a specific output in drupal?

well, there’s a way how to do that

for example, we will override the country field in addresses module

located in address/address.inc

here’s the function:


function theme_addresses_field_country_name($afields) {
$countries = _addresses_country_get();
return '<dt>'. t('Country') .': </dt><dd>'. $countries[$afields['country']] .'</dd>';
}

what we will do is actually we will override this throug our template.php file

we take acquai_marina for this

function acquai_marina_addresses_field_country_name($afields) {
$countries = _addresses_country_get();
return $countries[$afields['country']];
}

or

function phptemplate_addresses_field_country_name($afields) {
$countries = _addresses_country_get();
return $countries[$afields['country']];
}

There we remove the extra tags to for country field

As you can see, we replace the string/text from “theme” to “acquia_marina”/”phptemplate”.

don’t be confused about “acquia_marina” or “phptemplate”  because they behave the same.

This snippet works with hook_theme() or theme_YOURMODULE() override.

Categories: Drupal, Drupal Planet

my visitors location

October 3, 2009 arnelbornales Leave a comment

Applying Visitor Flag Counter for this wordpress site

Categories: 1 Tags:

How to redirect a form in drupal

August 24, 2009 arnelbornales 1 comment

<?php

function MODULENAME_form_alter(&$form, $form_state, $form_id){
global $user;
switch ($form_id) {
// This is our form ID.
case ‘YOUR_NODE_FORM_ID’: // like page_node_form(for node/add/page)
$form['buttons']['submit']['#submit'][] = ‘redirect_this_form’;
break;
}
}
function redirect_this_form($form, &$form_state) {
if ($form_state['nid']) {
$node = node_load(array(‘nid’ => $form_state['nid']));
switch($node->type) {
case ‘page’:
$form_state['redirect'] = ‘pages’; // you should specicify here where want to redirect the form after submission
}
}
}

?>

Categories: Drupal Tags: ,

How to set-up paypal sandbox in ubercart

August 24, 2009 arnelbornales 4 comments

taken from Ubercart PayPal sandbox setup

PayPal sandbox preface:

The trick with the PayPal sandbox is you have 3 accounts. The primary account is your developer account. This logs you into http://developer.paypal.com/. The other two (one Buyer one Seller) work within the sandbox system. You need to login with your developer account before you can use these other accounts. The way I set mine up was to use my email address for the developer account and just use the default address generated by PayPal for the Buyer and Seller accounts. Also, if need be you can create multiple Buyer and Seller accounts under your developer account.

Below is a complete step-by-step for setup and checkout (tested with Drupal 6.10 and Ubercart 2.0 beta3)

1. Go to http://developer.paypal.com/ and create an account. This is separate from any existing PayPal account you may have.

2. Click on “Create a preconfigured buyer or seller account.”

3. Check “Buyer”, leave the email address alone, change the password if you’d like (but remember to write it down), then click “Create Account”.

4. Click again on “Create a preconfigured buyer or seller account.” but this time create a “Seller” account.

5. On the “Test Accounts” page enable test mode for the business account by clicking “Disabled” (which changes it to “Enabled”).

6. In Drupal, enable the PayPal module (under Ubercart – payments)

7. Under “Administer » Store administration » Configuration » Payment settings” expand the “PayPal Website Payments Standard settings”.

8. Set “PayPal e-mail address:” to the “Log-in email” you see for the business account you created (unless you manually set this the email address will be something like “you_12313131233_biz@here.com”). You should be able to get to “Test Accounts” page with the link: https://developer.paypal.com/devscr?cmd=_sandbox-acct-session and see your Seller “Log-in email” address.

9. You can then change the rest of the settings in the Ubercart PayPal module as you’d like. I recommend changing the “Order review submit button text:” to something like “Pay with PayPal”.

To complete a test checkout:

1. Make sure you are logged in to PayPal’s sandbox server using your main account (go here: http://developer.paypal.com)

2. In Drupal proceed to checkout as you normally would and after you click the button that would normally say “Submit Order”, you will be redirected to PayPal’s sandbox server. If you are properly logged in with your developer account you will see “XXX’s Test Store” at the top of the page.

3. Log in with your Buyer account information (something like “you_12313765733_per@here.com”). Careful here as this is constantly crashing FF3 on my machine.

4. Complete the transaction using your phony test account for the Buyer.

5. You will then see a page saying your transaction is complete and a button taking you back to your store. Order emails do not appear to get sent (to either the buyer or store admin) if the user does not click this button to return to the store, although the order’s status is updated to “Payment receiver”.

this works with me! thanks to ryangroe@ubercart

Categories: Drupal, Ubercart Tags: , ,

Unable to send email in ubercart

August 24, 2009 arnelbornales 1 comment

“Unable to send e-mail. Please contact the site administrator if the problem persists.”

after i completed my payment from paypal sandbox i got this error messages.
What I did is I just configured the my contact details

http://www.example.com/admin/store/settings/store/edit

that’s it! and this solves my problem above.

hope this helps!

Categories: Drupal, Ubercart Tags: , ,

How to create a link image in drupal

June 11, 2009 arnelbornales 1 comment

this snippet enables you to create a image link

print l('Business Package - Human Resource Information System (HRIS) ','solutions/hris_ja',array('html' => TRUE));

notice there are 3 parameters: l(1st_param,2nd_param,3rd_param);

1st_param: the html image
2nd_param: the url/path
3rd_param: enable html to TRUE

http://www.arnelbornales.site90.net/blog

Categories: Drupal Tags:

How to include jquery.js

March 27, 2009 arnelbornales 1 comment

Well, I just updated our company site then suddenly i have a error on one of my scripts written in jquery after a time searching for this problem i’ve noticed that jquery.js was not loaded.

Solution for this is creating a script.js inside your theme directory. Suppose you have a custom theme we will name as “custom_theme”. inside your custom_name folder create a script.js file this way drupal will load this file as well as jquery.js

you can dig more about this in drupal http://drupal.org/node/243134

Categories: Drupal, JQuery Tags: ,