Skip to Content Skip to Menu

Check if a field is publish or not

  • bab2on
  • bab2on
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 0
14 years 10 months ago #119637 by bab2on
Check if a field is publish or not was created by bab2on
Check if a field is publish or not

Hi,

in one of my plugin i need to know if a field is publish or not

for no the only solution i found is a sql query :

[code:1]$cb_plfile_publish = "SELECT published FROM #__comprofiler_fields WHERE name='cb_plfile'";
$_CB_database->setQuery( $cb_plfile_publish );
$cb_plfile_publish = $_CB_database->loadResult();[/code:1]

is there a more simple way to have this information ? i want to reduce sql query.


Thanks for your support !

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

  • bab2on
  • bab2on
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 0
14 years 9 months ago #120854 by bab2on
Replied by bab2on on topic Re:Check if a field is publish or not
any idea ?

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

  • bab2on
  • bab2on
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 0
14 years 8 months ago #122885 by bab2on
Replied by bab2on on topic Re:Check if a field is publish or not
Can an admin asnwer ? Thanks! :)

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
14 years 8 months ago #122889 by krileon
Replied by krileon on topic Re:Check if a field is publish or not
bab2on wrote:

Can an admin asnwer ? Thanks! :)


You're already using likely the most lightweight way of doing so.

Why are you needing to frequently check if a field is published or not? If you want to reduce the queries you should cache the result in a static variable.

Also depends on where you're trying to obtain a fields status; if outside of CB you can use CB API after including it (see tutorials in signature).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

  • bab2on
  • bab2on
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 0
14 years 8 months ago #122900 by bab2on
Replied by bab2on on topic Re:Check if a field is publish or not
Hi, Thanks for answering.

I need to check this because my plugin have several parameters set by some fields allow or not by the administrator, the plugin react differently according to those settings.

those setting can be change at any time by the admin, so the plugin each time is call have to check this.


For static variable don't know well this ... so i have to check if it can do the job.


and it's inside CB (plugin for CB)

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

Moderators: beatnantkrileon
Powered by Kunena Forum