Ok, I have the script working great, luv it!! But I want to display information about the members on all pages using the smarty template system thru-out my whole site, and if they are not logged in display a welcome andl ogin instead of the members information. Such as if you go to the site it would say welcome, would you liek to log in? so you do and then instead the message is gone after login and instead displays a memebers menu or something. Can it be done?
Sure, it is possible, use code like that: 1. Use session_start(); in top of all your PHP pages 2. Use the following in your smarty code: Code: {if $smarty.session._amember_login} Hello {$smarty.session._amember_user.name_f}! {else} Please login {/if}
Hi, What code do I have to use for the same problem with the exception that I want to display info on my PHP pages, not in the smarty templates? Thanks
I agree, I would like to know how to do this also. I Would like to be able to only show certain content for my members and not visitors on my other php pages that are not using the smarty templates.. B)
Code: <? session_start(); if ($_SESSION['_amember_login']){ print "Hello " . $_SESSION['_amember_user']['name_f'] . "!"; } else { print "Please login"; } ?>
Displaying number of current subscribers on home page Hi Alex: I was wondering if there is a way to dynamically display the current number of subscibers on an html page, either inside my protected area or outside the protected area, like on the home "sales" page before someone signs up, so they can see that other's are subscribed and how many. It just need it to be automatically updated each time someone subscribes. Thanks again for a GREAT script & keep up the good work!
something like this: PHP: <?php function get_amember_users_count(){ $mc = mysql_connect("localhost", "username", "password",1 ); if (!$mc) { print "MySQL connection failed: " . mysql_error(); return -1; } $ok = mysql_select_db("databasename", $mc); if (!$ok) { print "Cannot change MySQL database : " . mysql_error(); return -1; } $q = mysql_query("SELECT COUNT(member_id) FROM amember_members WHERE status > 0", $mc); if (!$q) { return "Query error: ".mysql_error(); return -1; } list($c) = mysql_fetch_row($q); return $c; } print get_amember_users_count(); ?>
One more request.... Thanks Alex! One more question related to this: Is it possible to display the current number of LOGGED IN users on a page? This could prove useful on a download page, just in case 20 people are all downloading the same file at once...of it is slow, they would know why. Thanks!