Does anyone know how I can change the aMember Login link in Wordpress to detect whether the user is logged in, and if so, allow them to click the link for 'my account' page.
You can use this code in wordpress template: PHP: if(am4PluginsManager::getAPI()->getUser())// User is logged in show account link}else{// User is not logged in show login link}
I have aMember links in my WordPress site that change based on the login status. I use two aMember text widgets in a sidebar on the homepage to do this. Here is a detailed video on how to do this. Sorry for the shameless self promotion, but this video was already produced and handy. It's a little long, but too much info is usually better than not enough
I'm looking for something similar to the above. At the moment I'm using: include "../amember/library/Am/Lite.php"; echo Am_Lite::getInstance()->renderLoginForm(); To get the login form in a widget in Joomla. Is there a way to show the users name after they are logged in? in place of the login form? Thanks
Use something like this: PHP: include "../amember/library/Am/Lite.php";if($user = Am_Lite::getInstance()->getUser()){ echo "Welcome ".$user['name_f']." ".$user['name_l']." !";}else echo Am_Lite::getInstance()->renderLoginForm();
This works, as in it shows the login form but they are logged in in amember and it still shows the form. Are there some sort of session details that need to be passed over?
This will not work unfortunately. You can get it working only when Session Storage Method is set to "database" Joomla use the same PHP sessions but change save_handler, and session_name so, there is no way to access aMember's session in this situation. If you would like to use login work the way explained above, disable suhosin extension in php and switch session storage in aMember to database.
Yep cool, all works ok, is there anyway I can add some code to the script that refreshes the page? You have to manual click refresh to see the difference, I also put a logout link on it that works but doesnt refresh the joomla page to see the difference.
Do you display login form in frame? Or use ajax? It should redirect you to aMember and then redirect back, so page will be refreshed automatically.
Well I was using a plugin called Jumi. But stopped that and enabled the normal Joomla login form. This works better and does refresh but I want to redirect after login to the member area which is not working (there is an option to redirect in the module settings). I think the reason is that it is logging into amember then coming back to the home page of joomla by default so not redirecting. Is this something to do with the Joomla plugin I got from you guys?