Tempcode Identifiers Needed


How to pull the members…
Post count?
Topic count?
Signature?
How can I pull this info using Tempcode? I didn't find anything in the Tempcode tutorial on how to achieve this.
Also, I need to be able to strip down a query string to only display parts of it. Here's an example:
User visits ?q=testvalue, I want to be able to remove '?q=' from that string
I'm using {$QUERY_STRING} but that returns q=testvalue (it just removes ? and everything before it)
EDIT: I used the following which seems to work, but not quite how I expected:
{$REPLACE,q=,,{$QUERY_STRING}}
This does work, but only if the user requests that string and that string alone. If others are passed in the URL, it's a mess. Is there a more effective way of doing this? To maybe 'dissect' the URL and only return the requested string instead of all the strings?
Thanks!
Last edit: by Joe


The use of {$LAST_VISIT_TIME} causes a critical error:
PHP ERROR [1] Call to undefined function cns_read_in_member_profile() in sources/symbols2.php on line 2120
EDIT: weirdest thing, but it's not producing this error anymore!
Last edit: by Joe


These bits of info will probably need custom tempcode symbols created. If you can follow and write some PHP code, the documentation for this is here: Code Book, part 1b (Further back-end concepts) - ComposrJoe said
I'm working on a custom members area that displays all data of a member in one area. So far I've been successful at pulling most profile information – there's just a couple things I can't seem to figure out.
How to pull the members…
Post count?
Topic count?
Signature?
How can I pull this info using Tempcode? I didn't find anything in the Tempcode tutorial on how to achieve this.
Check the sources/hooks/systems/symbols and sources_custom/hooks/systems/symbols directories for examples of how new symbols are coded. Any symbols you create should be placed in the sources_custom/hooks/systems/symbols directory (create it if it doesn't exist). If you can follow the existing Composr code, you would need to find the parts of the code that generate the info you are wanting in the scripts that generate the profile tabs (should be found in sources/hooks/systems/profile_tabs) and integrate those bits of code into your new symbols code files.
Try the $_GET tempcode symbol: {$_GET,q}Joe said
Also, I need to be able to strip down a query string to only display parts of it. Here's an example:
User visits ?q=testvalue, I want to be able to remove '?q=' from that string
I'm using {$QUERY_STRING} but that returns q=testvalue (it just removes ? and everything before it)
EDIT: I used the following which seems to work, but not quite how I expected:
This does work, but only if the user requests that string and that string alone. If others are passed in the URL, it's a mess. Is there a more effective way of doing this? To maybe 'dissect' the URL and only return the requested string instead of all the strings?{$REPLACE,q=,,{$QUERY_STRING}}
Thanks!
From “Tempcode Identifiers Needed”, 12th November 2017, 1:19 am
That should return the value of q and ignore any other variables.
Jason
My ocPortal Sites: Holleywood Studio / Tech Fusion Online
My Composr Sites: NEWBotics Labs




The use of {$LAST_VISIT_TIME} causes a critical error:
Fixed for next release.
https://github.com/ocproducts/composr/commit/7e103010b5e50fb1620981eefb066e63ebe14ddd
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- 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.




Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- 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.


Basically what I'm trying to do is hide main_website_inner when the site is closed, so only the box and closed message displays.
I could put {$CONFIG_OPTION,site_closed} into an IF statement and surround the DIV containing this element so that it hides when the site is closed.


Code
{+START,IF,{$CONFIG_OPTION,site_closed,1}}CLOSED{+END}
{+START,IF,{$CONFIG_OPTION,site_closed,0}}OPEN{+END}
{+START,IF,{$CONFIG_OPTION,site_closed},1}CLOSED{+END}
{+START,IF,{$CONFIG_OPTION,site_closed},0}OPEN{+END}
(returns both)
Code
{+START,IF_PASSED_AND_TRUE,{$CONFIG_OPTION,site_closed}}CLOSED{+END}
{+START,IF_NON_PASSED_OR_FALSE,{$CONFIG_OPTION,site_closed}}OPEN{+END}
(returns open, even when site is closed)


{+START,IF,{$EQ,{$CONFIG_OPTION,site_closed},1}}CLOSED{+END}
{+START,IF,{$EQ,{$CONFIG_OPTION,site_closed},0}}OPEN{+END}
Jason
My ocPortal Sites: Holleywood Studio / Tech Fusion Online
My Composr Sites: NEWBotics Labs


Code
{+START,IF,{$CONFIG_OPTION,site_closed}}CLOSED{+END}
{+START,IF,{$NOT,{$CONFIG_OPTION,site_closed}}}OPEN{+END}
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- 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.


Chris Graham said
Jason's will work, but it can be simpler…Code
{+START,IF,{$CONFIG_OPTION,site_closed}}CLOSED{+END}
{+START,IF,{$NOT,{$CONFIG_OPTION,site_closed}}}OPEN{+END}From “Post #3,386”, 23rd November 2017, 1:47 pm
Haha, that was simple I guess. I was just overthinking it!


Why do some Tempcode identifiers have multiple variations with an asterisk or other symbol?
Example:
Code
{$COPYRIGHT}, {$COPYRIGHT`} | {$USERNAME*}, {$USERNAME}
They seem to output the same though.


Joe said
Question:
Why do some Tempcode identifiers have multiple variations with an asterisk or other symbol?
Example:Code
{$COPYRIGHT}, {$COPYRIGHT`} | {$USERNAME*}, {$USERNAME}
They seem to output the same though.
From “Post #3,422”, 3rd December 2017, 2:01 am
See "Escaping" section of Tempcode programming tutorial.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- 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.


I'm trying to expand this functionality to appear in more areas than just on the forums.
The forum posts template uses {+START,IF_PASSED_AND_TRUE,HIGHLIGHT_NAME}{+END} but when I use that on other areas of the site it doesn't work.
I've also tried:
Code
{+START,IF_NON_EMPTY,HIGHLIGHT_NAME}{+END}, {$CPF_VALUE,Highlighted name}
..with no luck.


Symbols and directives will work anywhere, so long as they don't depend on the aforementioned parameters.
{$CPF_VALUE,m_highlighted_name} should work. It's not documented (I'll correct that), but this symbol supports almost any field from the f_members table as well as CPFs.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- 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.


I'm detailing some member-specific features using icon links; one is the ability to change their username/display name but this feature isn't available for FB accounts, so I want to hide this icon entirely for FB accounts.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- 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.


I'm giving a payment example on my site. The example will take the current month and day (maybe there's some parameters I can use to extract the current day number and the current month), add 30 (using {$ADD}) and give the date of a next payment (since payments are due every month).
Of course telling people the payment is due every month would be the easiest solution, but I suspect some will complain about not knowing the exact (or close) date of when a new payment will be required. In addition, I'll be giving examples of prorations that would be issued if they cancelled on such and such dates (this is the advanced part, I think I can figure this out).
Now there's the issue of some months having 28-31 days. I think it would be cool to implement something that takes this into account, but if it's too complex then I'll just use 30 in my examples to give a general idea.


use_contextual_dates means like 'Today', 'Yesterday'.
verbose uses the verbose language strings which present long-form dates.
server_time means in the server's own timezone, rather than the current user.
timestamp is a unix Timestamp. If not given it will be the current time.
member_id is the member who's timezone to use (if not just the current user's).
{$FROM_TIMESTAMP,format_string,timestamp}
format_string is as per PHP's strftime function.
timestamp is a unix Timestamp. If not given it will be the current time.
You probably want FROM_TIMESTAMP.
I'm not sure how "adding 30" would give you the end of the month. I think you actually want something like {$MAX,{$FROM_TIMESTAMP,%d,{TIMESTAMP},30}.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- 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.