*Solved *FEU: getting the username.

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Akonkagva
Forum Members
Forum Members
Posts: 11
Joined: Mon Aug 31, 2009 8:09 pm

*Solved *FEU: getting the username.

Post by Akonkagva »

In FEU to print username we simply use {username}.
I need to create little user defined tag which would use logged in user as it's username and add it to SQL.
Example:
$username1 = "uca";
$password = "Example";
$host = "localhost";
$database = "uca";

// Make the connect to MySQL or die
// and display an error.
$link = mysql_connect($host, $username1, $password);
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
echo "Username".$username;
$query ="SELECT * FROM cms_module_feusers_users_paid WHERE 'username' = {$username} and 'sms_paid_one' = 1";
echo $query;
mysq;_query(..........
$id = mysql_num_rows($results);
if($id > ...........
How can I modify my code to make it display correct SQL with $username inside it ?
Last edited by Akonkagva on Wed Dec 30, 2009 1:47 pm, edited 1 time in total.
Peciura

Re: FEU: getting the username.

Post by Peciura »

Install module customcontent
http://dev.cmsmadesimple.org/projects/customcontent

Read module help, also search forum for

Code: Select all

$ccuser->property('propertyname')
$ccuser->loggedin()
$ccuser->memberof('group')
$ccuser->username()
Note tags like

Code: Select all

{$customcontent_loginname}
{$customcontent_loggedin} 
are deprecated.
Akonkagva
Forum Members
Forum Members
Posts: 11
Joined: Mon Aug 31, 2009 8:09 pm

Re: FEU: getting the username.

Post by Akonkagva »

Sorry, I am still confused.

How can I just add current logged in username into sql statement. As in sql provided ?

Thank you for your patience.
Akonkagva
Forum Members
Forum Members
Posts: 11
Joined: Mon Aug 31, 2009 8:09 pm

Re: FEU: getting the username.

Post by Akonkagva »

Let's make task even more simple:
{php}$thisStringShouldContainUsername = {$customcontent_loginname}{/php} // Big mistake
How to do something like this ?
Peciura

Re: FEU: getting the username.

Post by Peciura »

Let's make task even more simple:
{php}$thisStringShouldContainUsername = {$customcontent_loginname}{/php} // Big mistake
How to do something like this ?

Code: Select all

{php}
global $gCms;
$smarty = $gCms->GetSmarty();
$thisStringShouldContainUsername = $smarty->get_template_vars('customcontent_loginname');
{/php}

OR your SQL statement can be in UDT.
If your UDT is

Code: Select all

{my_udt my_parameter='some_value'}
In UDT parameter can be accessed this way

Code: Select all

$params['my_parameter'];
More info about UDT at http://wiki.cmsmadesimple.org/index.php ... fined_Tags
Akonkagva
Forum Members
Forum Members
Posts: 11
Joined: Mon Aug 31, 2009 8:09 pm

Re: FEU: getting the username.

Post by Akonkagva »

{php}
global $gCms;
$smarty = $gCms->GetSmarty();
$thisStringShouldContainUsername = $smarty->get_template_vars('customcontent_loginname');
{/php}
Doesn't work, I have installed both Feu, and Custom Content. Cashable set to false.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: FEU: getting the username.

Post by Dr.CSS »

You most likely have a problem from using {php}...
Akonkagva
Forum Members
Forum Members
Posts: 11
Joined: Mon Aug 31, 2009 8:09 pm

Re: FEU: getting the username.

Post by Akonkagva »

Yes, in UDT after a bit reworking it works fine ! Thank you guy's ! I really needed your help !
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: FEU: getting the username.

Post by Dr.CSS »

Post Reply

Return to “Modules/Add-Ons”