Václav Greif
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Set different prices for different customer groupsHi,
thanks for great support.Is there a button when browsing a product to go to specific pricing for that product?
I mean I would find editing all the prices on one screen much more user-friendly than having to enter product on one screen and than go to another plugin to add a specific price…
Am I missing something?
Thanks!
Forum: Plugins
In reply to: [WooCommerce] Set different prices for different customer groupsThanks for this plugin! It’s still one step more from what I would need (I have to count the discount, instead of just entering the specific price), but so far it’s the only solution I found at all.
Also, is the discount applied before or after adding the tax? I ask, because I usually need to show price with tax for regular customers, and without tax for VIP…
Is it possible to import price rules from csv?
If I manage to solve this issue, there’s no reason for messing with Prestashop…:-)
Forum: Plugins
In reply to: [WordPress MU Domain Mapping] Add a domain from plugin?? Ok, short and exact answer…
I did something like this:
$wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping'; // if new domain is domain.com, set active status to 0 if ($new_domain_host == 'domain.com') { $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active = %d WHERE blog_id = %s", 0, get_current_blog_id())); } // if record for this blog doesn't exist yet, insert it elseif ( null == $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM {$wpdb->dmtable} WHERE blog_id = %d", get_current_blog_id()) )) { $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtable} ( blog_id, domain, active ) VALUES ( %d, %s, %d )", get_current_blog_id(), $new_site_url, 1) ); } // else update the record else { $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET blog_id = %d, domain = %s, active = %d WHERE blog_id = %s", get_current_blog_id(), $new_site_url, 1, get_current_blog_id())); }
Seems to work fine for what I need…
Forum: Plugins
In reply to: [Social Connect] [BUG] Facebook access token isn't savedI think I solved this by adding:
$sc_access_token = $_REQUEST['social_connect_access_token'];
And than later saving the value, when the user is created
update_user_meta($user_id,'facebook_token',$sc_access_token);
I also found a way to save the extended access token (works only with the new Facebook SDK). I’m passing the user’s Facebook ID into this function
function get_extended_token ($fb_user_id) { //facebook application configuration try{ require_once(dirname(__FILE__) . '\lib\facebook-php\src\facebook.php' ); } catch(Exception $o){ print_r($o); } $config = array( 'appId' => 'aaa', 'secret' => '12345', 'allowSignedRequest' => false // optional but should be set to false for non-canvas apps ); $facebook = new Facebook($config); if($user_id) { global $current_user; try { $access_token = get_user_meta($current_user->ID,'facebook_token',true); $facebook->setAccessToken($access_token); $facebook->setExtendedAccessToken(); $access_token = $facebook->getAccessToken(); update_user_meta($current_user->ID,'facebook_extended_token',$access_token); } else { } }
Not sure where this code should be put in Social Connect…
Forum: Plugins
In reply to: [Social Connect] Get more info – setting scope permissionThis is difficult to do upgrade safe, as I don’t see a way to change the connect.js dynamically.
Maybe you could help?
Forum: Plugins
In reply to: [Social Connect] Save access token (extended)I managed to make the getUser function work, but still I wasn’t able to get the extended access token. Anyoneo would know how to get it?
Thanks
Forum: Plugins
In reply to: [Social Connect] Get more info – setting scope permissionFor anyone neeeding this, I changed the scope in media/js/connect.js, like
window.open('https://graph.facebook.com/oauth/authorize?client_id=' + client_id + '&redirect_uri=' + redirect_uri + '&scope=publish_actions,user_birthday,user_hometown,email', '','scrollbars=no,menubar=no,height=500,width=800,resizable=yes,toolbar=no,status=no');
Than I just added saving of these fields, like
$sc_birthday = date('Y-m-d',strtotime($fb_json->{ 'birthday' })); $sc_hometown = preg_replace('/^([^,]*).*$/', '$1', $fb_json->hometown->{ 'name' });
and later
update_user_meta($user_id,'birthdate',$sc_birthday); update_user_meta($user_id,'city',$sc_hometown);
Forum: Plugins
In reply to: [Social Connect] Logout from facebook after registrationFound out how to do this, I put following code on my ‘Thanks for registration page’:
<script type="text/javascript"> jQuery(document).ready(function($) { $.ajaxSetup({ cache: true }); $.getScript('//connect.facebook.net/en_UK/all.js', function(){ FB.init({ appId: '123456' }); FB.getLoginStatus(function(response) { if (response && response.status === 'connected') { FB.logout(function(response) { }); } }); }); setTimeout(function() { location.href = "<?php echo get_site_url()?>/"; },4000); }); </script>
Might be nice feature to add to core…
Forum: Plugins
In reply to: [Social Connect] Save access token (extended)Also, after I login with SC into WordPress, the getUser() function still returns 0. Is there any way that could be fixed?
$config = array( 'appId' => '12225', 'secret' => '4f045612', 'allowSignedRequest' => false // optional but should be set to false for non-canvas apps ); $facebook = new Facebook($config); $user_id = $facebook->getUser();
Forum: Plugins
In reply to: [Social Connect] Link WP account with social accountI mean, I think adding something like:
function sc_social_connect_process_login( $is_ajax = false, $link_account = false ) {
and later:
} elseif ( $link_account ) { update_user_meta( get_current_user_id(), $sc_provider_identity_key, $sc_provider_identity ); $user_data = get_userdata( get_current_user_id() ); $user_login = $user_data->user_login; } elseif ( $user_id = email_exists( $sc_email ) && !$link_account) { // User not found by provider identity, check by email update_user_meta( $user_id, $sc_provider_identity_key, $sc_provider_identity ); $user_data = get_userdata( $user_id ); $user_login = $user_data->user_login;
Than it should be enough to just pass the $link_account = true to the function somehow, when clicked on the link account button (these might be the same as the sc login button, only with some class).
Not sure if that helps…:-)
Forum: Plugins
In reply to: [Social Connect] Link WP account with social accountIt would be of course possible to store $_SESSSION variable “account-link” to check if the user wants to link accounts, but I’m pretty sure there has to be easier way to pass something to the sc_social_connect_process_login function…
Forum: Plugins
In reply to: [Social Connect] Link WP account with social accountHmm, should be quite easy, adding something like
elseif ( $action == "link_account" ) { update_user_meta( get_current_user_id(), $sc_provider_identity_key, $sc_provider_identity ); $user_data = get_userdata( get_current_user_id() ); $user_login = $user_data->user_login;
should do that, I think. I just don’t know how to pass the “action” variable.. Could you help me?
Forum: Plugins
In reply to: [Social Connect] Link WP account with social accountThanks – are you planning to add this feature, or should I try to hack it together myself?
Forum: Plugins
In reply to: [eShop] Displaying shipping options on checkout pageDone, for anyone interested, I set up 3 shipping modes:
Local pickup in place 1
Local pickup in place 2
Shipping via post2 Countries, CZ and SK, and set proper zones/prices.
I used position:absolute; in CSS to display the whole div where I need it.
Thanks for great support.
Forum: Plugins
In reply to: [eShop] Displaying shipping options on checkout pageAlmost got it working, the only thing remaining is I would need to display the shipping options on the right of the form – any hints how to do that? Thanks!