MySQL Field Type Plugin

9 years 3 months ago #204709 by toddfletcher
Replied by toddfletcher on topic Re: MySQL Field Type Plugin
Excellent! I knew that was somewhere in there, but couldn't remember.

So how can I retrieve that value in code on a page? Basically when a user views a video, I need to know if that value is flagged. I can retrieve the basic joomla user data very easily with the

$user = JFactory::getUser();

bit of code. But it doesn't seem as obvious to get a cbsubs field.

Thanks in advance!! :)

Please Log in to join the conversation.

9 years 3 months ago - 9 years 3 months ago #204757 by pepperstreet
Replied by pepperstreet on topic Re: MySQL Field Type Plugin

toddfletcher wrote: ...
So how can I retrieve that value in code on a page? Basically when a user views a video, I need to know if that value is flagged. ... But it doesn't seem as obvious to get a cbsubs field.


Not sure if it is best practice to get infos via customSQL queries or including CB API... not really my daily-business-focus ;-)
You may have a look for inspiration here:
Getcbfield

and of course here:
AllMySocials Tutorials - Index

Establishing $user object
Obtaining field values through API

Please Log in to join the conversation.

9 years 3 months ago #204987 by toddfletcher
Replied by toddfletcher on topic Re: MySQL Field Type Plugin
I figured it out. I am just checking if the subscription has tripped a flag. I was able to create a php function that grabs what I need from the CB profiler table... like this:

function getannualflag($userid) {
$db = JFactory::getDBO();
$query = "SELECT * FROM jos_comprofiler WHERE id =" . $userid;

$db->setQuery($query);
$rows = $db->loadObjectList();
if (isset($rows[0]))
{
if ($rows[0]->cb_annualflag == 1)
{
return 1;
}
else
{
return 0;
}
}
}

Works great. Remembering that cb_subs can already trip that flag in a cbfield helped!

Please Log in to join the conversation.

9 years 3 months ago - 9 years 3 months ago #205820 by penkz
Replied by penkz on topic Re: MySQL Field Type Plugin
its possible to do this query whith this plugin?

SELECT 
(SELECT name from st_users WHERE username = pf.superior) as superior
FROM
st_users st,
sys_perfil pf
WHERE
st.id = '{USERID}'
AND pf.bc = st.username

im trying, but shows nothing...
and in phpmyadmin works...

Please Log in to join the conversation.

9 years 1 month ago #209154 by Ptit Philippe
Replied by Ptit Philippe on topic Re: MySQL Field Type Plugin
Hello,

I use this component to build an URL
' www.databad.com/fichejoueur.php?Licence= ' + cb_licence

but it's displayed like a text not like an clickable URL

how to configure the field ?

Thanks

Please Log in to join the conversation.

9 years 1 month ago - 9 years 1 month ago #209155 by pepperstreet
Replied by pepperstreet on topic Re: MySQL Field Type Plugin

Ptit Philippe wrote: ...
but it's displayed like a text not like an clickable URL
how to configure the field ?
...


I assume "cb_license" is your SQL result value... and it is just appended on your base URL. Do you really need the absolute URL? Anyway...

Put your path into your desired HTML syntax. Just a simple a-Tag or additional markup like SPAN or DIV and classes for better styling. e.g.:
<a href="http://www.databad.com/fichejoueur.php?Licence=[cb_license]" title="Optional Title here">Your clickable link name here</a>

Then you have to fill the PREFIX and SUFFIX fields.

PREFIX contains the first half of your URL, that is right BEFORE your cb_field value:
<a href="http://www.databad.com/fichejoueur.php?Licence=

SUFFIX is the part just BEHIND your CB value:
" title="Optional Title here">Your clickable link name here</a>

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.208 seconds

Facebook Twitter LinkedIn