Using Database Fields in Comcode Page

Post

Posted
Rating:
#6415 (In Topic #1629)
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’

Adding from the cms_f_member_custom_fields table

I am trying my hand on my first Comcode Page.  I want to pull some fields from the cms_f_member_custom_fields table. 

The tempcode {$CPF_VALUE,Some Custom Field} works on the f_members table.  I also want to pull from the cms_f_member_custom_fields table.  The custom profile fields are in a different table than what the $CPF_VALUE tempcode works on.

I know how to program a php page to do this, not inside Composr.  What is the proper way to do this with a Comcode Page?

Thanks so much!
 
Online now: No Back to the top

Post

Posted
Rating:
#6418
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
f_member_custom_fields holds CPF values, and CPF_VALUE was originally designed to use them.
It being able to get f_members fields is a bonus feature for it.
Try passing the field ID number, or the field name.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#6422
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Thanks Chris!

I tried to use the CPF_VALUE tempcode, but it does not pull the f_member_custom_fields values (unless I am doing this incorrectly).  I want to let members print out a stylized page, based upon their database custom field inputs.  I thought Composr's WYSIWYG editor was a great option, because I can add the Comcode page to their panel, use the custom fields, and the Comcode pages have a link at the bottom of the page for printing. 

I haven't been able to figure out how to use a Comcode page to do what I am trying to do.  Is this possible with a Comcode page?  

Am I better off creating a php page without the WYSIWYG editor?   Can the page still be linked in the member's Menu dropdowns?

Thanks again!
Online now: No Back to the top

Post

Posted
Rating:
#6424
Avatar
Site staff
Adam is in the usergroup ‘Super-moderators’
Perhaps a mini-block would work? You can then include these on your Comcode page like any other block.
Online now: No Back to the top

Post

Posted
Rating:
#6426
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Thank you Adam, for trying to help me!
Online now: No Back to the top

Post

Posted
Rating:
#6432
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
CPF_VALUE is working fine for me. If I do this on my test site, after setting the default First name field to test on my admin account (account #2)…

Code

{$CPF_VALUE,First name}
{$CPF_VALUE,firstname}
{$CPF_VALUE,42}
{$CPF_VALUE,First name,2}
{$CPF_VALUE,firstname,2}
{$CPF_VALUE,42,2}

I get…

Code

test
test
test
test
test
test

If you're not able to get it working, please provide full details on what is not working for you (name of the CPF, how it is configured, the Tempcode you are using), and we will try and help.

Here I'm using 3 different syntaxes the CPF_VALUE symbol accepts for looking up CPFs (written name, internal codename, field ID), and testing both for the current user and with an explicit member ID.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

gabriel58, Vaiva, Salman, Terry, Paul D, ManojSree, deepu_ms

Forum statistics:
  • 1,151 topics, 5,503 posts, 6,644 members
  • Our newest member is TheMaker
Birthdays:
Back to Top