Questions tagged [session]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
2k views

Show menu item only if user is logged In (not word press login)

I am working on a web app word press. I am new to word press So maybe you will feel that this question is silly, I tried everything but i don't want to use any plugin. here is what I need to show the ...
0
votes
0answers
9 views

Using auth_cookie_expiration to extend session timeout doesn't work

I'm trying to extend the session timeout in our WP based site (default timeout is too short for our users). For this purpose, tried to add a code snippet using auth_cookie_expiration to functions.php, ...
0
votes
1answer
1k views

Why WordPress not logout after I have close my browser?

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 ...
0
votes
1answer
621 views

sharing the same cookie session with multiple wordpress installs on the same domain?

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 ...
1
vote
1answer
655 views

External Authentication, session_tokens not destroyed on logout

There are many questions and answers on external authentication and some code prior to WordPress 4.0 need some tweaking to get them to work. For example, adding a fourth parameter to the ...
0
votes
0answers
8 views

Run once per session / flag in WP session variable

I am creating a plugin, and I want an object to be created once per session (i.e. when the visitor arrives at my website, and then not again for the remainder of the session). I tried the code below, ...
0
votes
1answer
1k views

How to create session for user which is not an admin user

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 ...
1
vote
2answers
4k views

WP_Session not acting with AJAX

The concept is to put a Button in Post Content which the user will click. Two things - The ID of the post and Number of times the user clicks the Button should be displayed. Reason - With this we ...
1
vote
1answer
21 views

How to expire session after 2 hours and also expire when browser closed?

I want to expire session after 2 hours and also want to expire session when browser closed add_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3); function my_expiration_filter($seconds, ...
2
votes
1answer
2k views

Custom Connect to Facebook, problem logging in/logging out

I am working on a custom function for login in my users via facebook. I started by reading this nice tutorial on how to login in via Facebook: http://digitalzoomstudio.net/2013/02/09/tutorial-how-to-...
0
votes
4answers
1k views

Session alternative for plugins (due to caching)

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 ...
0
votes
1answer
22 views

Best hook for when a user session ends?

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: ...
0
votes
0answers
12 views

Complete a form section once then recorded for a session

I want a user to complete a form on my site which consists of a product section and then a shipping section to collect their address info. Once user submits form the first time, a thank you page ...
1
vote
1answer
20 views

Session Experies and Get Logged Out Within Few Minutes

I have wordpress simple blog with few plugins installed. My problem is that after logging and working for few minutes (hardly 2-5 minutes), session expires and I get logged out of the admin area. ...
0
votes
0answers
16 views

Save WooCommerce checkout fields when leaving checkout page

THE SITUATION In this shop, the employee attendant takes order over the phone. We use a plugin named 'Shop as Client' to achieve that. THE PROBLEM Sometimes, after it´s all set to complete the ...
1
vote
1answer
555 views

$_SESSION variables lost during OAuth callback

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: ...
0
votes
0answers
40 views

Why isn't working WooCommerce session inside shortcode?

Hope you're doing great! I am trying to print the WC()->session->get inside a shortcode but getting error , bellow is my code and error function set_session(){ global $woocommerce; WC()->...
0
votes
0answers
8 views

Woocommerce Sessions - Utilization of WooCommerce Box Size Packer

I'm trying to modify the WooCommerce - USPS Shipping Method Plugin - box packer algorithm to export the "quoted" box size to our shipping platform. I've run trials on the my staging site and it seems ...
0
votes
2answers
656 views

PHP Session Variable to WordPress Error

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 ...
0
votes
1answer
739 views

Allow user to select location and then set cookie for location in WordPress

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: ...
0
votes
0answers
33 views

Trying to configure cron to get next value from array on each run

So I have this block of code and it is driving me crazy: if ( ! wp_next_scheduled( 'change_quote_hook_short' ) ) { wp_schedule_event( time(), 'one_minute', 'change_quote_hook_short' ); } ...
0
votes
1answer
69 views

Handling nonces for actions from guests to logged-in users

Imagine the following scenario: John has an account on my website, but is currently not logged in. He clicks the "upvote" button on an article, but is redirected to the login page because only logged-...
4
votes
2answers
6k views

How should you hook a session_start() when authoring a plugin?

Learning more about sessions I've gathered that a session_start() should come directly after <?php per Where exactly do I put a SESSION_START? and I wanted to play around and create a plugin that ...
6
votes
1answer
10k views

Destroy user sessions based on user ID

I want to programatically log a specific user out of our WordPress system based on their user ID much like the 'Log Out of All Sessions' button in the WordPress user editor section. How am I able to ...
0
votes
1answer
34 views

Pass Wordpress variable to the next page

I would like to pass a category name into the next page. I'm using Session. In functions.php I added: function session_initialize() { if ( ! session_id() ) { session_start(); } } add_action( '...
-1
votes
1answer
48 views

Create a Custom Login System in WordPress [closed]

Please I need help with this. I wrote a basic code to create a login form that will validate, retrieve data and display on my dashboard but I have the following challenges: It always displays "...
1
vote
1answer
114 views

PHP header() gives headers already sent

I am working on a checkout proces in Wordpress where if customer clicks on the checkout button he gets redirected to a payment provider. Important to know: I use a session in this proces. I use PHP ...
0
votes
0answers
73 views

Easy way to check auth_cookie_expiration setting in browser dev tools?

I'm trying to change the auth_cookie_expiration setting in my functions.php file in order to limit all logins to 2 hours. I've done the basic hook for this: function expire_in_120_minutes() { ...
1
vote
1answer
55 views

How to store post ID's in cookie or session to display the same posts later

I run a wp_query that fetches 4 posts from db with rand() and displays them in a grid to visitors. What I need is to display the exact same posts the query fetched the first time, a second time to ...
0
votes
1answer
22 views

Re-use Nonce in Repeating Event Signup Buttons

My understanding is that wordpress nonces (not exactly a "number used once") prevent cross-origin request forgery and last 12 hours. I'm displaying a schedule of classes with a registration button ...
0
votes
2answers
1k views

One time login on 2 different Wordpress sites

Im trying to figure out how to login one time to mydomain.com and being automatically loged in to mydomain.com/blog . I have figured out how to share tables (so that the same users on my main site, ...
1
vote
2answers
3k views

share login/logout sessions across two installs?

I'm having some issues sharing the user sessions across two installs. (a) site on http://stolenmx.com (b) site on http://arcade.stolenmx.com I have installed B in the same database as A and I have ...
0
votes
2answers
2k views

Unset session variable on page reload / setup but exclude AJAX

I'm currently trying to unset a session variable in WordPress if the page get's reloaded. I've tried a lot but it's not working like I want it. This is my function: /** * Unset filter session if ...
2
votes
1answer
95 views

Random popup image per user with no repeat

I am pulling images from an ACF gallery that resides on another page. What I intend to do with this is to have these images displaying full screen on my home page on a popup every time the page loads. ...
0
votes
1answer
46 views

$_SESSION inside php function executed by AJAX

I am defining $_SESSION['session_test'] from $_POST['reason'] I get from AJAX call. Inside of this function, $_SESSION['session_test'] does get defined, and I get desired echo result. add_action('...
0
votes
1answer
352 views

Front end ajax user login session issue

I am having an issue where the ajax login form allows me to login, sort of. If I set the redirect to the homepage after login it sends me to the homepage and gives me the admin bar at the top. However ...
0
votes
1answer
18 views

Use WP user status (logged_in) to manage access to independent application

I have WP installed in the root of my website. In the same directory there’s a completely independent application. What I want to do is the following: when the user accesses the page containing the ...
0
votes
1answer
120 views

ajax polling with admin-ajax.php

Is it possible to do ajax polling in WordPress with admin-ajax.php for example every 300ms? I have tried this and it appears that doing the ajax request with admin-ajax takes longer than the ...
7
votes
1answer
9k views

Preventing session timeout

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 ...
1
vote
0answers
24 views

Check if user is logged in to site A when visiting site B

I have two separate WP installs. The main site (a.com) and the blog for that site, which is on a subdomain (blog.a.com). I need to be able to check if a user visiting blog.a.com is logged in to a.com....
0
votes
2answers
68 views

Add class when more page is visited

I would like to add a CSS class to the body if a visitor goes to the second or third etc. page of the website. Or vice-versa: add a class only on the first visited page. The goal is that I can ...
28
votes
5answers
77k views

How to store and receive variables in WP sessions?

I have a form with some checkboxes and inputboxes selectboxes and it shows what the user wants via an ajax call. The problem is that when the user click on the item and the detail page is shown and ...
1
vote
0answers
110 views

Expired session error (admin) when I try to make a call to WooCommerce api [closed]

I have activated the WooCommerce API that is mounted on the WP, the administrator session expires every 2 hours, the problem is that when I try to make a call to the WooCommerce API, it returns a 200 ...
0
votes
1answer
63 views

how to remember specific action/event for current user?

i have made multi-language site thanks to polylang now i dont want to use polylang's switcher as it causes layout issues so i found a better solution is by putting a link on top. for example if user ...
0
votes
1answer
42 views

Safe to start a php session on get_header action?

I now usually php sessions are started from the init hook, but get_header runs before writing the page, sono technically speaking, I can open a session from there. Is there any other reason I should ...
0
votes
1answer
64 views

How to destroy all user sessions via WP-CLI

In installed WP-CLI v1.5.0 I ran wp --info and it return the correct info. I then ran wp user session destroy user1 --all and got this: CORRECT>w user session destroy prvweb -all (y|n|e|a)? ...
3
votes
1answer
358 views

Find out what is using PHP sessions in WordPress

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 ...
2
votes
1answer
3k views

How to log out everywhere else, destroy all sessions “all other devices”?

WordPress panel service "log out everywhere else" is doing a nice job. I want to use this as a function outside the panel. Screenshoot
1
vote
0answers
209 views

Share WordPress login info with other PHP app

A customer asked for this feature: website with WordPress website with PHP app where is a login form Request is: "when i login info WordPress I've to be able to share login data with the PHP app so ...
1
vote
0answers
222 views

Logout USER form backoffice after 30 minutes of inactivity [closed]

I looking for to logout user from backoffice after 30 minutes of non activity except Administrator role. Thanks.