Forum Replies Created
-
AuthorPosts
-
smithandjonesMember
Hi Khaled,
I would really appreciate if you could reply to my last post on this redirection issue. I could not get the form based redirection to work.
I need to get this issue sorted before I put my site live.
regards
Robert
smithandjonesMemberHi Khaled
I’m having problems getting your form based redirection to work.
I created an html meta field with the default value <input type=”hidden” name=”redirect_to” value=”http://example.com”>
And then I placed the field in my profile update form.
First problem is that the url e.g. ‘http://example.com’ is visible in the form.
Second problem is that I do not understand your next two instructions;
1. ‘and set redirection to “Referer” for targeted role.’
2. ‘You can use $_REQUEST[‘pf_http_referer’] to obtain referer url.’
Are you referring to changes to the ‘user_meta_after_user_update’ function?
Could you show me a simple example of how to configure a profile update form and its associated function in order to redirect the user back to the previous page (I mean the page BEFORE the page containing the profile update form.
Many thanks
Robert
smithandjonesMemberHi Khaled
Still no further on in getting a simple logout function to work. You have a logout redirect function built into User Meta Pro but no logout shortcode? Could you review my last post and advise how I can get a wordpress menu item to work as a single click logout with the User Meta Pro redirect also working.
Regards
Robert
smithandjonesMemberHi Khaled
I tried using the code you suggested but it doesn’t accept it as a menu link. I think it is probably me not understanding the usage.
So what I’m trying to do is insert a code into a wordpress menu item which will directly log the user out of my site and redirect to the home page.
If you could help further I would be very grateful.
Regards
Robert
smithandjonesMemberHello again
Can you help with this issue please.
Regards
Robert
smithandjonesMemberHi Khaled
Could I check one more point with this code please.
I used code based on your suggestion as follows;
add_action( 'user_meta_after_user_update', 'user_meta_after_user_update_function' ); function user_meta_after_user_update_function( $response ){ $userID = $response->ID; $BuyerCurrencySelect = get_user_meta( $userID, 'buyer_default_currency_select', true ); if ( empty( $BuyerCurrencySelect ) ) return; switch( $BuyerCurrencySelect ) { case 'British Pound Sterling (£)' : update_user_meta( $userID, 'buyer_default_currency_code', 'GBP' ); update_user_meta( $userID, 'buyer_default_currency_symbol', '£' ); break; case 'US Dollar ($)' : update_user_meta( $userID, 'buyer_default_currency_code', 'USD' ); update_user_meta( $userID, 'buyer_default_currency_symbol', '$' ); break; case 'Euro (€)' : update_user_meta( $userID, 'buyer_default_currency_code', 'EUR' ); update_user_meta( $userID, 'buyer_default_currency_symbol', '€' ); break; }
The code above works fine.
So I wanted to do the same for the seller profile. I used the following code within the same function;
$userID = $response->ID; $SellerCurrencySelect = get_user_meta( $userID, 'seller_listing_currency_select', true ); if ( empty( $SellerCurrencySelect ) ) return; switch( $SellerCurrencySelect ) { case 'British Pound Sterling (£)' : update_user_meta( $userID, 'seller_default_currency_code', 'GBP' ); update_user_meta( $userID, 'seller_default_currency_symbol', '£' ); break; case 'US Dollar ($)' : update_user_meta( $userID, 'seller_default_currency_code', 'USD' ); update_user_meta( $userID, 'seller_default_currency_symbol', '$' ); break; case 'Euro (€)' : update_user_meta( $userID, 'seller_default_currency_code', 'EUR' ); update_user_meta( $userID, 'seller_default_currency_symbol', '€' ); break; }
This second code did not work.
So I experimented and changed one line from;
$SellerCurrencySelect = get_user_meta( $userID, 'seller_listing_currency_select', true );
to;
$SellerCurrencySelect = get_user_meta( $userID, 'seller_listing_currency', true );
Have you any idea why the second use of the same function was failing until I removed the ‘select’ term? Both variables are select types.
Regards
Robert
smithandjonesMemberPerfect!
Thanks Khaled
smithandjonesMemberHi Khaled. The latest code works perfectly.
Many thanks
Robert
smithandjonesMemberHello Khaled
I tried the code you suggested but it is still returning ‘ARRAY’. Could you look at the code again please.
Regards
Robert
smithandjonesMemberHi Khaled
Re point 2. Thank you, works fine.
Re point 1. I tried making a shortcode to allow the array to be displayed.
function payment_methods_func() { extract( shortcode_atts( array( 'info' => 'seller_payment_methods', ), $atts ) ); $user_id = get_current_user_id(); return $res = get_user_meta($user_id, $info, false); } add_shortcode( 'payment_methods', 'payment_methods_func' );
But when I use the shortcode, I get the word ‘Array’ displayed instead of the required values from the array.
I have tried the shortcode with a single string variable and it works fine.
Can you help please.
Regards
Robert
smithandjonesMemberI haven’t had any reply so yesterday I spent a couple of hours experimenting which I guess is a good way to learn!
I got the following code to work, but with a couple of issues;
add_action( 'user_meta_after_user_update', 'user_meta_after_user_update_function' ); function user_meta_after_user_update_function( $response ){ extract( shortcode_atts( array( 'info' => 'buyer_default_currency_symbol', ), $atts ) ); $user_id = get_current_user_id(); $res = get_user_meta($user_id, $info, true); update_user_meta($user_id, 'wpcf-buyer-default-currency-symbol', $res); }
Here are the issues I need help with;
1. I don’t know how to extract checkbox type variables where you can have more than one value?
2. I have a problem with the ‘Country’ field. Although it displays the full country name in the drop down, e.g. ‘United Kingdom’, it actually returns the abbreviation,e.g. ‘UK’. I need to derive and display the full country name. How is this possible please?
Regards
Robert
-
AuthorPosts