in my multi author website I have a button that users can upload their avatars. I need to display this button in author page. I can do it. I added this button to author page. The problem is that author can see this button in other author's page too . That's why I need to display this button in author page of current user. I am so sorry I have no any reference code. I have no any idea how …
I'm building a plugin that picks a random post from the database and delivers the result dynamically to the user. For certain aspects I need to know the post ID that's been randomly selected. Session data would work perfectly for this if it weren't for website caching. When a site is cached, the post that is supposed to load dynamically, based on the session data, doesn't load anything. What alternatives do I have to using $_SESSION?
Is there a way to find out what is using PHP sessions or spawning PHP processes? My Wordpress site gets heavy traffic (3.5 million hits per month). We discovered recently that we had permissions set incorrectly for a long time, meaning nothing could access PHP sessions. Unfortunately, after we fixed permissions, we found that tons of PHP processes are being spawned rapidly and the server goes completely unresponsive. It won't even come back from health check. It's a dedicated Nginx …
WordPress 5.9 Users trying to access the homepage when the session expires, are sent to re-authenticate. The behavior seems weird since it only applies to the homepage. Users with expired sessions can access all other pages without being asked to re-authenticate. Why is the behavior inconsistent, and how can users with expired sessions not be redirected to re-authenticate?
Please help . I need to add class to this button if user is not logged in <?php echo apply_filters( 'my_order_html', '<button type="submit" class="ADD-CLASS-HERE cfw-primary-btn cfw-next-tab validate" name="my_list_html" id="place_order" formnovalidate="formnovalidate" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '"><span class="cfw-button-text">' . esc_html( $order_button_text ) . '</span></button>' ); // @codingStandardsIgnoreLine ?>
TLDR: I'm generating a random token on a front-end form and storing it in $_SESSION to later retrieve by the ajax script. THE ISSUE: The code retrieved by the ajax script does not match the one generated by the form. It seems the token script is run 2x although it's only called once and returns the same code each time on a ajax call. The ajax-side code only changes when the page is refreshed. ABC - The token code on …
My website requires users to complete their profile before they can place an order. So far, I have been able to redirect a user to his profile editing page if his profile is incompleted when he tries to place an order. add_action('woocommerce_before_checkout_form',function(){ if (is_user_logged_in()){ $user = wp_get_current_user(); if ( bpprocn_has_incomplete_profile($user->id) ) { // check user's profile completed or not if (wp_redirect(bp_core_get_user_domain( $user->id ) . bp_get_profile_slug() . '/edit/group/2')) exit; } } }); Now I am trying to figure out how to …
When I attempt an OAuth handshake, the first step is a GET call to obtain an access code like so. # Redirect to request authorization code $url = $this->get_authorization_url(); header("Location: $url"); exit; Just before I send this I store the current URL in a $_SESSION['last_url'] variable so that after authentication is complete I can redirect it back to the page the user originally attempted. This authorization url uses the client id and secret to obtain an access code which is …
So I have a form that allows the user to select a city. Once selected, this city is then saved to a $_SESSION variable as such : $_SESSION['city_selected'] = $_POST['location_select']; This works fine once selected. When I var_dump($_SESSION); I see my variable perfectly on after selecting the city and the page refreshing. Then, if I move to a different page or refresh the same page - the var_dump(); returns NULL I can't seem to figure this out. My PHP session …
The default login cookie has expiry time as "session", so suppose when I close my browser, I need to login again when I visit wp-admin. But I've found that serveral time I've closed my browser (kill the chrome manually), and when I come back I still able to login without login. What would be the reason? Update: Only chrome has this issue, Firefox / Safrai are okay. I tested under Mac, close the browser fist and additional Quit the app …
I am needing to allow a user to select a location from a dropdown on the front-end, that then sets a session cookie for that chosen location... any help here? Ok so this is the outlined task: Location selector: 1st step is to simply have the location option slide down and then save the PHP cookie for later use I am getting the cookie to set ' add_filter( 'query_vars', 'addnew_query_vars', 10, 1 ); function addnew_query_vars($vars) { $vars[] = 'loc'; // …
I have been trying to figure out how to add session variables to WordPress Custom Pages for the past few days but have still been unable to find a solution. From researching it seems WordPress does not allow you to move Session variables from one page to the next. I have tried removing all of the 'session_start();' from each page and adding the below to functions.php file. add_action('init', 'myStartSession', 1); function myStartSession() { if(!session_id()) { session_start(); } } Have also …
I'm trying to use this on both wp-config.php files of each install within the same domain which is a subdomain im using for the main site. So to be clear here... the 2 wordpress installs are on a subdomain.. first install in on http://mysubdomain.domain.com/ second install is in a folder... http://mysubdomain.domain.com/wp-install-2/ When logging in the base site first then clicking to the next site which is /wp-install-2/ i'm not logged in. What can i do to make this work for …
I get the error message "Another plugin is attempting to start a session with WordPress. WP Session Manager will not work! how to find error" I am trying to correct the code of somebody. He uses dompf. There is stuff like $_Session in the code. What do I need to do with the code so there is no error anymore?
I'm creating a backend feature that calculated user's login sessions during the past 2 weeks. This is easy enough to do by incrementing a custom user field when the user logs in using wp_login: add_action('wp_login', 'calculate_login_sessions_custom', 99, 2); This works well, and I was able to program it so that it doesn't count logins from the past 2 weeks. (The client only wants to see logins from the past 2 weeks). The issue is, if someone logs out, I need …
I would prefer not installing a plugin to achieve this and I don't mind coding something myself. I'm simply unsure of the "wordpress-y" way to go about it. So here goes, Each one of the products has four variations, always the same, they are the region selection and the prices are different based on those. However, I would like to have a dropdown in the main nav of the site where customers can specify what variation (region) price is displayed …
Hello I am working on building a plugin which has the following functionality like stated below My problem is I am stuck at point I have created registration form for the users where users will be able to registered successfully after that they will receive an email and after that they will become the final user and I also make this entry in a separate database table . I also provide admin with facility to approve the User. But My …
I am developing a custom search where the user inputs data on the first page with a form. Upon clicking submit, the user is brought to a second page for the results. I pass the data via pulling in the form results via $_POST. Then assigning it to a $_SESSION. It works great… until I hit the next button to go to page 2. The pagination works fine, but the issue is that the variables do not load on the …
I build a custom plugin that make me able to use SESSION to passe parameters from a page to others pages without GET parameters. This works very well. Basically i start my session like this : add_action('init', 'myStartSession', 1); function myStartSession() { if (session_status() == PHP_SESSION_NONE) { session_start(); } } And then set session variable like this in different part of the site $_SESSION['key'] = "value"; And finish like this add_action('wp_logout', 'myEndSession'); function myEndSession() { session_destroy(); } Problem : If …
Not sure if this is a bug or by design, but it's damn annoying. Every so often, more so after updating the core, while in the admin section, I get booted out with the infamous "Your session has expired" message. Strange in itself since apparently WP doesn't use sessions. The login prompt comes with a "remember me" checkbox, why isn't it remembering? I guess there's a distinction between "remember me" and "keep me logged in" here. I've disabled all plugins, …