Jump to content

n1concepts

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by n1concepts

  1. I agree with gizmola comments & to add one note: * If you or client doesn't want the hassle of trying to figure out alot of the configurations that's required with WP (itself) and WooCommerce, then Shopify a good option (pretty easy to setup & manage). However, there comes the difference w/the two - you'll pay (Shopify) for that ease-of-use vs getting WP & WooCommerce (pretty much) setup at little to no cost.
  2. Hi, I need to modify some code found on Github to redirect if the user is not already logged in as the set 'wp user' from the script or 'admin'. Github link: https://gist.github.com/cliffordp/e8d1d9f732328ba360ad <?php function auto_login() { // @TODO: change these 2 items $loginpageid = '1234'; //Page ID of your login page $loginusername = 'wpusername'; //username of the WordPress user account to impersonate // get this username's ID $user = get_user_by( 'login', $loginusername ); // only attempt to auto-login if at www.site.com/auto-login/ (i.e. www.site.com/?p=1234 ) and a user by that username was found if (!is_page( $loginpageid ) || ! $user instanceof WP_User ) { return; } else { $user_id = $user->ID; // login as this user wp_set_current_user( $user_id, $loginusername ); wp_set_auth_cookie( $user_id ); do_action( 'wp_login', $loginusername, $user ); // redirect to home page after logging in (i.e. don't show content of www.site.com/?p=1234 ) wp_redirect( home_url() ); exit; } } add_action( 'wp', 'auto_login', 1 ); ?> Basically, I want to define in the function php file the logic to redirect viewer to the login page if the following conditions not met: 1. is_page NOT '1234' and/or wpusername not found 2. No user currently logged in (either wpusername or any wp admin) Again, if either of those conditions not met, then the script should redirect to 'wp_login' ----- Can anyone advise what edits can be made to this code to accomplish that goal - thx
  3. Disregard, using the code generated by the tool (RFG) that is setting the favicon. The issue I'm seeing is when I minimize the brower (itself) - THEN - that browser's favicon / title name shows which is correct being it's the parent containing the (multiple tabs, inside). Thanks for those that reviewed post - topic closed.
  4. Hi, I used Real Favicon Generator to create the required files to show the favicon on web pages which works. However, if/when I minimize the browsers (Chrome, Firefox, etc...) in this case Chrome - the website's favicon & title changes to the browser's favicon & title. Note: I see from other websites where their 'coded' favicon remains even when the browser is minimized. Q: How can I accomplish this - keep the site's favicon & title showing in brower tab, even when minimized? Thx!
  5. Thx for response requinix && maxxd - both your comments (I agree & on point). I would prefer to handle this on the backend with php, however, not my call - lead devs prefer JS so reason I was inquiring (thx) For the code (copying from WWW) - yeah, use to boiler plate customization (certainly not using 'as is' - thx again for respnose). We got it working but not how I would have preferred - but always multiple ways to accomplish similar results.
  6. Hi, I'm working with an example set of code to create a Stripe (Token) and that script works Great! Example code found at https://jsfiddle.net/ywain/5yz4z2yn/ However, I need to capture the 'token' which is found at line 38 within the Javascript code. My issue: how can I pass that var (result.token.id) to an external PHP file? If you want to see the simulation - just fill out the form (use 4242 4242 4242 4242 for the test card & current of future 'two-digit' year) other values are random. In the HTML code (simulated form) you'll see that the 'token' class display the token when (result.token) JS condition is met / TRUE <div class="success"> Success! Your Stripe token is <span class="token"></span> </div> I'll suppress the token from showing the var once I am able to grab the value & pass into the, external, PHP (Stripe api's for processing). Again, here's the code snippet in question from the 'Javascript file found at https://jsfiddle.net/ywain/5yz4z2yn/ if (result.token) { // Use the token to create a charge or a customer // https://stripe.com/docs/charges successElement.querySelector('.token').textContent = result.token.id; successElement.classList.add('visible'); Again, I need to (somehow) grab 'result.token.id' and (securely) pass that value to an external PHP file. Note: I do not want to use cookies b/c that not a stable solution for all browsers nor safe. Appreciate any suggestions - thx!
  7. Thanks - I will implement tomorrow morning and update ticket with result (appreciate your help!)
  8. Hi, I'm working on implementing the Payflow api into a php-based website and having issues with the payments processing at PayPal. Note: the PayPal api is using the Payflow class - that class can be found via this link: https://github.com/rcastera/Paypal-PayFlow-API-Wrapper-Class/blob/master/Class.PayFlow.php Paypal is now asking for me to produce the actual API call - from the cURL prior to that cURL process firing so I need to - some how - echo out that prepared URL statement from the 'public' function to which I can then save to a file or in a MySQL database table. I need some guidance to help me get that URL echo'ed or assigned to a local var from the OOP class named 'payFlow and method named, 'processTransaction' - see excerpt of that class below: lines 609 thru 641 from the provided link: https://github.com/rcastera/Paypal-PayFlow-API-Wrapper-Class/blob/master/Class.PayFlow.php public function processTransaction() { // Uses the CURL library for php to establish a connection, // submit the post, and record the response. if(function_exists('curl_init') && extension_loaded('curl')) { $request = curl_init($this->getEnvironment()); // Initiate curl object curl_setopt($request, CURLOPT_HTTPHEADER, $this->getHeaders($this->NVP)); curl_setopt($request, CURLOPT_HEADER, 1); // Set to 0 to eliminate header info from response curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt($request, CURLOPT_TIMEOUT, 45); // times out after 45 secs curl_setopt($request, CURLOPT_FORBID_REUSE, TRUE); //forces closure of connection when done curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // Uncomment this line if you get no gateway response. curl_setopt($request, CURLOPT_POST, 1); //data sent as POST curl_setopt($request, CURLOPT_POSTFIELDS, $this->getNVP()); // Use HTTP POST to send the data $postResponse = curl_exec($request); // Execute curl post and store results in $post_response // Additional options may be required depending upon your server configuration // you can find documentation on curl options at http://www.php.net/curl_setopt curl_close($request); // close curl object // Get the response. $this->response = $postResponse; $this->response = $this->parseResults($this->response); if(isset($this->response['RESULT']) && $this->response['RESULT'] == 0) { return TRUE; } else { return FALSE; } } else { return FALSE; } } Again, what i need is the ability to (some how) capture $request and echo that out (return that value) outside the function so I can assign to a local variable to then save to MySQL database or echo at a later date. Any help accomplishing this task - which is prior to line 628 - appreciated (thx) brgds, Craig
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.