Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is this possible? I want to use Gravity Forms or another hook to somehow write to the END of a user_meta field - not overwrite it.

For example...

Before:

$purchase_history = get_the_author_meta('purchase_history', $user->ID);
echo $purchase_history; ('Concert in the Park 01/12/2004')

After:

echo $purchase_history; ('Concert in the Park 01/12/2004', 'Pancake Breakfast 05/15/2005')

Any ideas? Thanks.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use get_user_meta():

$original = get_user_meta( 
    $user->ID, 
    'purchase_history', 
    TRUE 
);

echo $original . ' Pancake Breakfast 05/15/2005';

To update the value use update_user_meta():

update_user_meta( 
    $user->ID,  
    'purchase_history',   
    $original . 'Pancake Breakfast 05/15/2005' 
);
share|improve this answer
    
thanks. i realized this concept after i asked, but now just need to research how to get gravity forms to let me hook into it. have any ideas on that? –  GhostToast Jan 9 '13 at 22:43
2  
gravityhelp.com/documentation/page/Gform_pre_submission -- There we go –  GhostToast Jan 10 '13 at 15:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.