Skip to Content Skip to Menu

🏖 Summer has arrived! Start your summer right with our summer sale!Get 30% off Now!

MySQL Field Type Plugin

12 years 2 weeks 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 or Create an account to join the conversation.

12 years 2 weeks ago - 12 years 2 weeks 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
Last edit: 12 years 2 weeks ago by pepperstreet.

Please Log in or Create an account to join the conversation.

12 years 2 weeks 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 or Create an account to join the conversation.

  • penkz
  • penkz
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
12 years 5 days ago - 12 years 5 days 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...
Last edit: 12 years 5 days ago by penkz.

Please Log in or Create an account to join the conversation.

11 years 10 months 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 or Create an account to join the conversation.

11 years 10 months ago - 11 years 10 months 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.:
Code:
<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:
Code:
<a href="http://www.databad.com/fichejoueur.php?Licence=

SUFFIX is the part just BEHIND your CB value:
Code:
" title="Optional Title here">Your clickable link name here</a>
Last edit: 11 years 10 months ago by pepperstreet.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum