Check who is logged in my webpage

unfortunately i need a function that i can create a page (assume the page called check) in my website.
And allow other admin that can check other who is logged in as member at my check page.

i tried to use get.email from my database.
and then at the data base get the user name .
and track who is logged in and surfing my webpage at that moment .
but im out of luck.

i have tried to play with the code about 2 weeks and still no idea how to do it.
anyone can help? :frowning:

and for another request is.
i have made a database and the permission are set to [Only site member author can view the content].
it is working perfectly.
However when i put the same database at another page and i need the database that can display all of the data from the database to another admin from my page.
it only can show the data from the admin himself (or i should say it only show the data from whoever logged in themself).

so i need to change the data permission to [Anyone can view the content] to make the database can show all data to that admin.
but the problem is i dowan let other member to saw all of the data inside the database…
it make me confuse.

Hi,
Welcome to Wix Code :slight_smile:
Can you please paste here your code so we can inspect ?
Roi

Ah…sorry about that…i was deleted entire code already

Hi. This is something which should be possible with logged in users. It is proven to work in other systems I work with.

  1. When you have the login process, create an entry in a ‘activity’ table
  2. in the site code, put a cycle e.g. every five minutes, that checks if it is a logged in user and update activity

Unless a user really logs off, you can’t see a real active site user. Maybe with a real socketio application, but it is not advised. Also, when is a user then logged off: minimze windows, switch tab, browse away and so on. As software consultant I often have that discussion, and never is there an answer. I’ld opt for an activity table (if it is not in wix already)

Thanks for Edgar Koster Advice…
i got no idea how to do that. ‘activity’ table.
can you please put some sample code here so that i can learn ?

and another issue. ( i know im annoiying xD)
im doing some button that will change the language of my webpage,
at the begin is seems ok,
but after few hour of learning i found an issue.
issue example.

  1. page original state is english.
  2. put a button and add some code that will change entire page text and picture to other language.
  3. click button. it changed.
  4. after that , click other page it changed back to english again.

here are the code that i using.

let localeEn;
let localeCn;
let localeBm;

export function localEn_click_1(event, $w) {
$w(“#tncEn”).show();
$w(“#tncBm”).hide();
$w(“#tncCn”).hide();
$w(“#floatText”).text = “English Text”;
$w(“#bankImage1”).src = “english image url”;
localeBm = false;
localeEn = true;
localeCn = false;
}

export function localBm_click_1(event, $w) {
$w(“#tncEn”).hide();
$w(“#tncBm”).show();
$w(“#tncCn”).hide();
$w(“#floatText”).text = “BM Text”;
$w(“#bankImage1”).src = “bm image url”;
localeBm = true;
localeEn = false;
localeCn = false;
}

export function localCn_click_1(event, $w) {
$w(“#tncEn”).hide();
$w(“#tncBm”).hide();
$w(“#tncCn”).show();
$w(“#floatText”).text = “chinese text”;
$w(“#bankImage1”).src = “chinese image url”;
localeBm = false;
localeEn = false;
localeCn = true;
}

$w.onReady(function () {

if (localeEn === null ) (localeCn === null) (localeBm === null); { 
	
	$w("#tncEn").show(); 
	$w("#tncBm").hide(); 
	$w("#tncCn").hide(); 
	$w("#floatText").text = "english text"; 
	$w("#bankImage1").src = "english image url"; 
	localeBm = false; 
	localeEn = true; 
	localeCn = false; 
	} 

if (localeEn === true) { 
	$w("#tncEn").show(); 
	$w("#tncBm").hide(); 
	$w("#tncCn").hide(); 
	$w("#floatText").text = "en text"; 
	$w("#bankImage1").src = "english image url"; 
	localeBm = false; 
	localeEn = true; 
	localeCn = false; 
	} 
if (localeBm === true) { 
	$w("#tncEn").hide(); 
	$w("#tncBm").show(); 
	$w("#tncCn").hide(); 
	$w("#floatText").text = "bm text"; 
	$w("#bankImage1").src = "bm image url"; 
	localeBm = true; 
	localeEn = false; 
	localeCn = false; 
} 
	if (localeCn === true) { 
	$w("#tncEn").hide(); 
	$w("#tncBm").hide(); 
	$w("#tncCn").show(); 
	$w("#floatText").text = "chinese text"; 
	$w("#bankImage1").src = "chinese image url"; 
	localeBm = false; 
	localeEn = false; 
	localeCn = true; 
		
	}	 

//

//TODO: write your page related code here... 

});

and i was doing it on Site code not at the Page code .

Hi there. Can you put the issue above in a new post? What you need to do here is use a storage (session or local) value to store the language. I have a language toggle in my header, store that via site code in a store item and on the pages in page code get that value to do stuff.

I’ll try to get a start example somewhere this week for the ‘activity’ method

sure, and thanks for your help too :slight_smile: