Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount! Get 20% off now with code SPOOKY-2024!

[SOLVED] Alphauserpoints as cb field

12 years 6 months ago - 11 years 9 months ago #197140 by deltafidesign
[SOLVED] Alphauserpoints as cb field was created by deltafidesign
Is there a way to create a cb field that contains the alphauserpoints' of every user and automatically update this value when points are added or subtracted?

I know that there are also plugins that show user points and tabs, but I want a CB field not only to show the value but to use this value for conditions etc...
Last edit: 11 years 9 months ago by krileon.

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
12 years 6 months ago #197149 by nant
Replied by nant on topic Re: Alphauserpoints as cb field

deltafidesign wrote: Is there a way to create a cb field that contains the alphauserpoints' of every user and automatically update this value when points are added or subtracted?

I know that there are also plugins that show user points and tabs, but I want a CB field not only to show the value but to use this value for conditions etc...


Try using the CB Query field plugin.
You will have to figure out the query to grab the points for user, but after that you can display as a CB field.

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

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 9 months ago #218523 by mfe13
Replied by mfe13 on topic Re: Alphauserpoints as cb field

nant wrote:

deltafidesign wrote: Is there a way to create a cb field that contains the alphauserpoints' of every user and automatically update this value when points are added or subtracted?

I know that there are also plugins that show user points and tabs, but I want a CB field not only to show the value but to use this value for conditions etc...


Try using the CB Query field plugin.
You will have to figure out the query to grab the points for user, but after that you can display as a CB field.

hello,
This post is old and I need to do the same thing but I do not know how.
Are there examples somewhere to learn it?
Thank you very much for your help.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #218532 by krileon
Replied by krileon on topic Re: Alphauserpoints as cb field
Review your database tables and find where points are stored for a user then query for them. Example as follows.

SELECT `points` FROM `#__table` WHERE `user` = '[user_id]'

Note the above is a query structure example, it won't work and isn't for AUP!


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.
The following user(s) said Thank You: mfe13

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

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 9 months ago #218545 by mfe13
Replied by mfe13 on topic Re: Alphauserpoints as cb field
Ok thanks,

I know that php is like this :
Code:
{ $query = "SELECT points" . " FROM #__alpha_userpoints" . " WHERE userid='".$userid."'" ; $db->setQuery($query, 0, $count); $points = $db->loadResult(); }

So I wrote that in query field :

SELECT `points` FROM `#_alpha_userpoints` WHERE `userid` = '[userid]'


But there is no result. I forgot something?
Thank you
Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #218555 by krileon
Replied by krileon on topic Re: Alphauserpoints as cb field
You only have 1 underscore with the prefix. It should be #__ instead of #_. Your substitution should also be [user_id] and not [userid].


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.

Moderators: beatnantkrileon
Powered by Kunena Forum