Questions tagged [session]

The tag has no usage guidance.

50 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
502 views

Display message once per session to users with a specific role

I need to display a message to only users with a specific role. The message should appear either as soon as the user logs in or if they re-open their browser after having closed it when logged in to ...
2
votes
1answer
319 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
90 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. ...
2
votes
0answers
368 views

Woocommerce cart is a non-object inside `admin_post` action

I'm writing a custom integration plugin for Woocommerce, to add a dynamic product to the cart. Right now, without the plugin, I make POST request via a form inside an external page containing the ...
1
vote
0answers
22 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....
1
vote
0answers
182 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
413 views

Session destroyed on page redirect

I am developing a plugin where I have started a session on init hook. I have a form which when submit calls a function which uses SDK (i.e payment is handled here). If this function returns FALSE ...
1
vote
1answer
461 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: ...
1
vote
0answers
406 views

iframe does not store session/cookie when refresh parent

I have been searching around but there was no specific answer or any indication about the problem I am facing. I have a domain, parent.com, which is just a full screen container of a WordPress-...
1
vote
1answer
628 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 ...
1
vote
0answers
76 views

Login/Logout Session Sharing - Multiple Wordpress Installations

I am on Wordpress 4.4.2, I have multiple wordpress installations (Not Multisite) 1st Installation :- www.example.com 2nd installation :- www.example.com/blog/ I have pasted this in my Wp-Config ...
1
vote
2answers
85 views

Disallow second login session

I am trying to find a solution for 2 months now but unfortunately I came up with no results. I have a subscription based website which streams music. What customers basically buy is a "panel" where ...
1
vote
0answers
263 views

captcha not working in my custom plugin

I am trying to create a contact form with captcha, but captcha not working. I created captcha image by this in another file and stored value in session: //I already have start session and the ...
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
185 views

Unique session WordPress

I want to allow only one session at the time across browsers and PCs. I want to "disconect" or log out to the old session if a new session starts in Wordpress.
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
0answers
15 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
1answer
26 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( '...
0
votes
0answers
62 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() { ...
0
votes
1answer
40 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
277 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
107 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 ...
0
votes
0answers
110 views

How to do polling of session variable with ajax in WordPress admin plugin for progress bar

I'm working on a plugin. I have a somewhat long running php process and I am trying to show a progress bar by polling a session variable with ajax and displaying on the front end. I previously had it ...
0
votes
0answers
19 views

session start for each page loaded

For my plugin, I would like to use $_SESSION in the admin part. Thanks tutorials, I understood that Wordpress has got a behaviour to remove some global variables and the best way is to use a hook to ...
0
votes
1answer
55 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)? ...
0
votes
0answers
795 views

Changing the WP login session cookie time?

As i know, WordPress makes login session cookie expire in 48 hours or on browser close. And in 14 days, if we check the "Remember Me". I want to change this time to 5 seconds: function ...
0
votes
0answers
20 views

$_SESSION Not working after X amount of page views

I've written up a simple function that's output into header.php, which displays the login/register modal upon so many views in this case I've set it at 4, however its firing on the first view of my ...
0
votes
0answers
52 views

Session constantly resets variable

I'm using sessions in wordpress but I have a problem where a variable I store keeps getting reset everytime I change page. it's "d_curr" and my code is the following : add_action('init', '...
0
votes
2answers
626 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
181 views

how to show posts of category random by session

Currently my homepage posts shows as random and arranged by visitor session but in category it arranged by last added, I want to arrange posts random in category similar to homepage function ...
0
votes
1answer
104 views

Looking to load a different template part on every load/refresh

I basically have a site where I have several different template headers that I want to load via get_template_part. The basic idea is when someone first visits the site, they should see a random ...
0
votes
2answers
63 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 ...
0
votes
1answer
681 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
1answer
24 views

Capture and display users name

Can anyone tel me if a plug-in exists that can do the following: Check is it's the users first visit, if so the user will be prompted to input their first name into a text field. Their name will then ...
0
votes
1answer
601 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 ...
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 ...
0
votes
0answers
2k views

Session variables lost during Ajax calls - Wordpress - Sage Starter Theme

I'm using the starter theme Sage to create a custom Wordpress Theme. I made a very simple infinite scroll system to display every posts. On that point, everything seems to work fine. Now, I have to ...
0
votes
0answers
84 views

Session stays active until page update in dashboard

Something very strange is happening. I am using sessions on my wordpress website and for some reason, a session stays active until I update the page in the Wordpress website. I have build a template ...
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
0answers
88 views

Sessions in plugin development?

I'm developing a plugin. At present I have two files. dotmailer.php and dotmailer-add.php. I'm creating a newsletter widget. My dotmailer.php plugin adds an admin menu, with options. It allows the ...
0
votes
0answers
1k views

How to 'remember' a site member's last visited page?

I've seen this on a couple of sites - they offer a multipage tutorials to site members. When you return to the site, they have a link that takes to the last page of the tutorial you were on. How is ...
0
votes
0answers
4k views

How to dynamically change the locale?

Sorry about making this so lengthy. I just want to explain everything clearly and walk you through what I have tried so far to solve this problem. There is an English and a Spanish version of the ...
0
votes
0answers
131 views

Reading Wordpress sessions in Magento

I'm looking for a way to read a session set in Wordpress, in Magento. Reading Magento sessions in Wordpress proved to be no problem but the other way around seems nearly impossible. Here's my ...
0
votes
0answers
276 views

White screen after login attempt

In my wordpress site, I built a login area. In my page-login.php I ask the user to enter his login information which after click on submit will be sent to the same page - on top of the page his ...
0
votes
0answers
162 views

SHORTINIT and sessions

Is it possible to use SHORTINIT for AJAX called php file and use a Wordpress shared $_SESSION global in it? I have this thus far: ini_set('html_errors', 0); define('SHORTINIT', true); require 'wp-...
0
votes
4answers
927 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
169 views

Changing user_login ends current session

I have a site we wanted the login username to be the user's e-mail address. The user_login column contains the e-mail address. No problem. I created a custom function so that when the user updates ...
0
votes
1answer
188 views

User not logged first time I open the homepage

I am experiencing a weird issue and I didn't find any luck on Google. Every time I open my homepage it looks like I am not logged in (there is the form to login). But if I click on any internal link ...
0
votes
1answer
4k views

Session is not starting

I've read the usage of session() in WordPress from here and here. And I placed the following code into the very starting of my functions.php: /** * ENABLING SESSION TO THE SITE * Thanks: Shazzad ...
-1
votes
1answer
4k views

how to manage Session in Wordpress using custom login?

I am new to WordPress, i want to implement custom Login functionality using WordPress. I am using the following Code to create custom login, In wp.config file if( !session_id() ) { session_start()...