Word Count component
Hi, I need to create a quick little component that will pull the word count from my articles. I've checked the community here and can't find much more than a suggestion for a product idea that wasn't picked up. I can pull the body of my articles with a simple API call:/restapi/vc/messages/id/3701/body This will dismiss all the content in other parts of the page (related content, labels etc.) but it returns a bunch of HTML, is there any quick of stripping out everything that isn't contained in a <span> tag, counting that and storing it in a variable? Hopefully I want to end with nothing but a number at the bottom of my articles, doens't sound too hard but I'm struggling so far. Thanks, Dom148Views0likes4CommentsHow can i change the position of a element?
Hi, Please have a look at the screen shot, i am facing a issue like the community search bar rite now its position absolute so that it shows proper on the black strip but if i checked it on the other resolution screen so the position of this element is changes. i want to add the search bar in the navigation strip in <li>. Is there is any way to do this or via css i can fix the position of this particular element.deend9 years agoMentor79Views0likes1CommentHTTP client URL encoding
Hi, I am wondering if anyhow knows how to get the HTTP client to work with special characters. I have a URL string that contains "+" and ":". If I use the FreeMarker ?url method for the string, I get something like: https%3A%2F%2Fabc.com%2Fapi%2Fv2%2Fsearch.json%3Fpage%3D2%26query%3Dtabc%253Acba%2Babc%253Acba which fails in Lithium with this error message: Method public final lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel lithium.coreapi.webui.template.models.HttpClientTemplateModel.request(java.lang.String) throws freemarker.template.TemplateModelException threw an exception when invoked on lithium.coreapi.webui.template.models.HttpClientTemplateModel object "lithium.coreapi.webui.template.models.HttpClientTemplateModel@e453be1" with arguments of types [java.lang.String,]. See cause exception. The failing instruction (FTL stack trace): If I manually replaced the "+" with " " and leave ":" as decoded, the call fails intermittently with the same error.perk9 years agoAdept223Views0likes4CommentsUnable to add multiple domains
Hi, For my community we are trying to add multiple domains (comma seperated) in Allowed domain namestext box (Community Admin > HTTP Client) but lithium throwing follwing error "One or more domains entered is not allowed." Your help could be highly appreciated. Thanks & Regards, Phaniphani9 years agoAdvisor87Views0likes2Comments- deend9 years agoMentor270Views1like2Comments
Using html asset in custom component
I have a file with a bit of HTMLstored as .html file in the Asset library. But when trying to use that in a custom component <#include asset.get("/html/assets/header_en_non-auth.html")> in the preview it says The ""http://xx.yy.com/html/assets/header_en_auth.html?FAC271340083837713A9A30F4B680D51"" widget cannot be found. From the Asset library I can open the file and see it correctly and I can also see it using the full URL from the error message.miikka9 years agoMaven139Views0likes2CommentsMeta tags for shorttitle
Is it possible to add meta tags for a page shorttile using values from page.head.title? This is the shorttitle used for our on site search (not Lithium search) and elsewhere -- not to be confused with the breadcrumb shorttitle. Thanks!lilim9 years agoBoss122Views0likes2CommentsUsing Api v2 LiQL need to get all information at single shot
Hi, I have a requirement where Using Lithium API v2 LiQL I need to getall message ids with message names, thread ids with thread names and board ids with borad names with single query. How can we do that.? Please give me pointers on this. Thanks, BhargavBhargav19 years agoGuide88Views0likes1CommentPage Initialization Redirect
Hi, I am trying to address a couple of issues we have on our SEO side and have attempted to address these using the Page Initialization tab in Studio. For instance, we have a label called Resources, unfortunately there is no distinction between the url ending '/Resources' and '/resources'. I had hoped that we could address these using canonical URLs etc but this functionality does not seem to have been rolled out yet. I set up a very basic test to see my approach would work, simply 'look in URL for Resources, change to resources'. This works in that it does redirect. However, this is only registering as 302 temporary redirect. This does not address the issue from an SEO standpoint as none of the link equity from the first URL, i.e. /Resources, is carried over to the new URL. Has anyone had a similar issue? Is there anyway of specifying this as a 301 redirect? Thanks, Dom223Views0likes1CommentWhat does the SSO setting "Enable Auto-Signin for Fallback SSO" do?
Does anyone know what this SSO setting does?: "Enable Auto-Signin for Fallback SSO" In a Lithium post it says that it "Enables auto-signin via fallback SSO if cookie-based sign-in fails." https://community.lithium.com/t5/Single-Sign-On-SSO/Configure-SSO-options/ta-p/108915 What are the benefits of turning on this setting, and what SSO development would we have to do on our side to make user of it, if any?Solvediftomkins9 years agoMaven181Views0likes1CommentMobile Metrics via API
I am looking for metrics regarding community activity on mobile. Ideally I would like to be able to access them through the API, but I havent been able to find anything so far. I have referenced the PDF containing the list of metrics and did not see what I was looking for, but I figured I would post and see if anyone knew anyway to get this information. I would like to pull forum replies, blog comments and kudos formobile if possible. Please let me know if anyone has any suggestions. Thanks in advance! :)erjames59 years agoExpert65Views0likes0CommentsCustom component repository
I'm going to throw this out there. There is a huge gap in the creation of custom components. Between both versions of the API there is a lot you can do. But there's still a lot of work required to do things. You're always starting from scratch. Even when you know someone else's great idea. What I really want to see, right here in the Lithium community is a custom component repository with version control and forking. I want to be able to write a component that pulls in the specific data I need and have it easily accesible to others. I want other developers to jump in and edit the layout so it has the default header, footer and columns correct with CSS classes. Someone else to optimise a loop and speed it up. And then visible to everyone to one click add to their stage. And if it updates AFTER I've added it to my community, then an alert in Studio lets me choose to pull in the new version of the component. Some of what we build is closed and we'll keep it, but there's other times we could all just chip in. I think it's a pretty big addition to the product and would be happy to contribute. Any thoughts?Tim_h9 years agoBoss126Views8likes2CommentsDecode Lithium SSO Cookie
Hi, I want to read the params in the encoded lithium SSO cookie. Actually there are encoded like it is descripted in the howto's. On the Lithium site (custom component) I want to read thecookie and work with the parameters. Is there any way to get/decode the saved paramters in the cookie? Regards, Michaelmicha809 years agoExpert84Views0likes0CommentsAPI to list through user macros
Hello. I would like the ability to use API 2 to look for specific user macros. Example: I want to look if a user has a macro with a specific title. I think currently the only way is to "manually"check "does macro_1_title" exist? If so, what's its title. If title equals xyz, perform action. Rinse, repeat. Would be great if I could, for example, select * from macros where user.id = 'id' and title = 'title'.57Views0likes0CommentsDo we need this SEO setting?: "Append topic ID to title and description meta tags"
Greetings Lithosphere! We have the followingSEO setting checked by default: "append topic ID to title and description meta tags". It appends a string of numbers to the topic title, which means that in Google Results, there is a number in every title. We'd prefer to remove the number, as it's not aesthetically pleasing. I understand the underlying SEO reason for this of avoiding duplicate content. However, none of our posts should have the exact same content. If they do, someone has cross-posted and our moderators should address it. Can we safely turn off this setting and stop appending the numbers, without hurting SEO? Any other considerations? Cheers, Alaniftomkins9 years agoMaven137Views3likes1CommentHow do I differentiate a text string by category/board?
In our knowledgebasearea, we would like the "New Message" button to display "New Article". The text key for this is... menubar.button.new_message However, when this is changed, it also affects the forums area where we would like it to say "New Message". Is there a way to have this button change text based on the board? If not, is there freemarker code I could use to create a custom button that behaves the same way?Solveddustin9 years agoExpert249Views0likes7CommentsGet stats of user using V2 call
Hi All, I have tried the user resource calls: SELECT * FROM users WHERE id = '4' SELECT metrics FROM users WHERE id = '4' It does not give any user stats. as of V1 :/restapi/vc/users/id/4/metrics Please help me on this. Regards, Mahesh Revanwar105Views0likes2CommentsAdvice on performance for external API query
Hi all, I'm looking for a bit of advice on improving the performance of a very simple API call that I've used to develop a Joomla CMS Module in PHP for use on a client's main website. The purpose of the module is to display the 3 most recent posts for a specified "Custom Tag" which the Community admins apply to various posts. We have two categories in our community, and the module displays posts from both categories so there are 2 API calls as follows: http://saneforums.org/restapi/vc/categories/id/lived-experience-forum/posts/for/metadata/key/modbar.anxiety/value/true?message_viewer.topic_sort_order=last_post_date&restapi.format_detail=full_list_element&restapi.response_style=view&page_size=3 and http://saneforums.org/restapi/vc/categories/id/carers-forum/posts/for/metadata/key/modbar.anxiety/value/true?message_viewer.topic_sort_order=last_post_date&restapi.format_detail=full_list_element&restapi.response_style=view&page_size=3 Each API call is loaded in to a separate PHP variable which I then use PHP's Simple XML Parser on to extract the data I need to display in the module. You can look at the module in action here (down on the right hand side, heading "From SANE Forums"): https://www.sane.org/mental-health-and-illness/facts-and-guides/anxiety-disorder The problem is that the pages which have the module on them are loading very slowly at around 8 to 10 seconds while all of other pages load instantly. The site is hosted on a pretty serious setup at Rackspace so it's not a general hosting issue, and as I said it only happens on pages with the module assigned. So I can only assume that the page load delay is coming from the query to the Lithium API and I'm wondering if anyone has any advice on that front. One option I've thought of is to have a separate script activated by Cron which calls the API and generates a static XML file which the module would access instead of doing the real-time query - does that sound like a possible solution? Would appreciate any advice that anyone might have. Thanks NathanSolvedsnaffle9 years agoExpert264Views0likes3CommentsSpecial Characters in Subject line.
Hi, Is there any limitation in the special characters added in the subject line. C:\Windows\Panther\unattended.xml is the subject line used in the title. We can able to post the topic but none of the user unable to give kudos and last and missing some of the content on the right side. Can anyone provide a solution for it.106Views0likes2CommentsJava call not returning author.email, but the studio api browser does
I am doing an api call with a java client and executing the following query using api v2: SELECT id, body, view_href, subject, author.email FROM messages WHERE replies.count(*) = 0 AND depth = 0 When I look at the author.email field it comes back empty. If I do the same query in the studio api browser the email is returned. Can anyone think of why this would happen? All the other values are coming back. api browser: { "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "messages", "list_item_type" : "message", "size" : 1, "items" : [ { "type" : "message", "id" : "58", "view_href" : "/t5/Welcome-Board/asdsada/m-p/58#M36", "author" : { "type" : "user", "email" : "blah@blah.com" }, "subject" : "asdsada", "body" : "<P>asdasdasdasd</P>" } ] }, "metadata" : { } } java code: { "metadata":{ }, "http_code":200, "data":{ "size":1, "list_item_type":"message", "type":"messages", "items":[ { "author":{ "type":"user", "email":"" }, "subject":"asdsada", "id":"58", "href":"/messages/58", "type":"message", "body":"<P>asdasdasdasd<\/P>", "view_href":"http://stage-community.zuora.com/t5/Welcome-Board/asdsada/m-p/58#M36" } ] }, "message":"", "status":"success" }196Views0likes6CommentsHow to get latest Idea based on Status using LIQL?
Hi Guys, I want to create some widget that retrieve list of latest Ideas based on their statuses using LIQL. So I start with this query to begin: SELECT subject, view_href, status.name FROM messages WHERE board.id='Idea-Center' and depth=0 ORDER BY post_time DESC LIMIT 2 and here's what I get: { "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "messages", "list_item_type" : "message", "size" : 2, "items" : [ { "type" : "message", "view_href" : "/t5/Idea-Center/uat-test/idi-p/2077", "subject" : "[uat] test", "status" : { "type" : "message_status", "name" : "Untuk Masa Depan" } }, { "type" : "message", "view_href" : "/t5/Idea-Center/uat-test/idi-p/2073", "subject" : "[uat] test", "status" : { "type" : "message_status", "name" : "Baru" } } ] }, "metadata" : { } } Then, I want to shortlist the result based on the status.name = 'Baru'. So, here's my updated LIQL: SELECT subject, view_href, status.name FROM messages WHERE board.id='Idea-Center' and depth=0 and status.name='Baru' ORDER BY post_time DESC LIMIT 2 But, I get an error like this: { "status" : "error", "message" : "invalid query syntax for SELECT subject,view_href,status.name FROM messages WHERE board.id = 'Idea-Center' AND depth = 0 AND status.name = 'Baru' ORDER BY post_time DESC", "data" : { "type" : "error_data", "code" : 604, "developer_message" : "'status.name' is not a valid constraint for the object 'messages'. in: SELECT subject,view_href,status.name FROM messages WHERE board.id = 'Idea-Center' AND depth = 0 AND status.name = 'Baru' ORDER BY post_time DESC", "more_info" : "" }, "metadata" : { } } As you can see inhttp://community.lithium.com/t5/Community-API-v2/Message-resource/ta-p/113091article, the status.name is part of messages. So, why can't I use it like board.id? Thanks Guys, arnantoakbarSolvedarnantoakbar9 years agoContributor176Views0likes2CommentsForum Thread Layout
Hello! I was checking out this site:http://community.k2.com/ and I really like the thread layout shown below. I would like to do something like this. Any tips on how I can create something like this? I assumed creating a custom component and API (if you have an API codethat you can share, it would be awesome). Any help would be greatly appreciated. Thanks!Solvedskylinegtr9 years agoMentor561Views0likes13CommentsAPI: Ordering/moving/parenting nodes in Community Structure
Hi, I want to render a Community tree similar to the Admin Community Structure as well as move and reorder nodes. Are there realtime REST APIs to return a paginated list of nodes (including hidden) at the community-level or category-level in the order (index, or nodeposition) they are rendered in the Lithium Admin Community Structure (e.g. with categories floated to the top, chats anchored to the bottom)? And/or any other sorting mechanism? Are there REST APIs to get/set the order (index, or nodeposition) of a node within a community-level or category-level (e.g. relative to sibling nodes with or without the category and chat enforced positioning)? Are there REST APIs to move (re-parent) a node to the community or a new category? Thanks, Benbma9 years agoMentor208Views1like2CommentsHow Lithium treats # in the SSO URL is a problem
Lithium is investigating this but say that a hashtag in a URL is interpreted as a fragment indentifier, and so it get redirected as follows: For single sign on we have our login page here (developed with angular js)https://www.carfax.com/community/#/join . I put that link in the Lithium Admin panel under system > SSO. Lithium redirects as follows: https://www.carfax.com/community/?referer=http%3A%2F%2Fcommunity.carfax.com%2F#/login What we need it to do is this: https://www.carfax.com/community/#/login?referer=http%3A%2F%2Fcommunity.carfax.com%2F This is so we can implement the token so that when a non registered or non logged in user attempts to click on reply or like to a post, he/she is sent to the login page, and then taken back to where they were (say a forum post).dpratt9 years agoAdept76Views0likes1CommentHow can we create custom components in Mobile v2?
Currently, Iare working on the community with Mobile V2, I want to add a small component to it. I kind of forget the link of tutorial in the LITHIUM Community. Is there anyone who can help to point me to the right place of such tutorial?126Views0likes2CommentsGet readonly status using RestAPI or LiQL
Hi @all, we made a board only readonly and want to get this information using the RestAPI or LiQL. Setup "Readonly" 1. Wehave done the setting in: Community Admin => Community structure => Manage board 2. There is an option like "Set all messages to readonly" (in German it is called "Alle Beiträge auf schreibgeschützt setzen.") Regardless of which option Ichoose (RestAPI or LiQL) I do not get the information about this setting. Does anyone know how to get this? Many thanks! Regards, Michaelmicha809 years agoExpert125Views0likes3CommentsReport generated by rest API
I am the business owner here, but before I send my developer out on a mission, I wanted to check and see if what I want is possible.. We have a lot of requests for a report of unanswered threads. I know this is obtainable in the rest API, but wanted to know if we could output something similiar to the search export where it's title, URL, board and date of thread that has no responses in a way that is exportable to excel rather than XML output. In this most ideal scenerio this could be ran daily and emailed to interested parties. Has anyone built something similiar or know if it's possible?Solvedallisonn9 years agoGenius186Views0likes4CommentsLatest comments in sidebar limit to 5
Hi, I want to limit the latest comments component (blogs.widget.latest-comments) to only show the latest 5 comments. Is this possible with configurations in the admin area or give a special xml attribute in the studio => page => xml tab? Ordo I have to recreate this with a custom component? Reagrds, Michaelmicha809 years agoExpert168Views0likes5CommentsHow to get the recipient list of a private note with REST API
Hi all, We are developing a mobile application for our community. So i am trying to take stock of all API calls that we will need. I'm facing a problem with private notes API.When we have multiple recipients. This is my REST API call: /restapi/vc/users/id/user_id/mailbox/notes/id/note_id Insteadof returning the recipient list in thenode 'to', thisreturnsno recipient node. Is there any solution for this issue? Likea parameter that i can add to this call so that i can see the recipient list in this case? Thanks & Regards, HocineHocine9 years agoContributor79Views0likes0CommentsIncrease completed registrations?
Hi there. I was thinking this morning, that maybe we could help new users complete their registration if we suggest a username for them, and I couldn't figure out the XML Text generator for sso users. Hence this basic code. Anyone want to pick it apart? Basically, on the page where you've already logged in through sso, but haven't picked a username yet I check if a user with your sso already exists and either suggest your sso as username, or loop through variations(sso_1,sso_2,etc.) to find an available name. <#if !user.anonymous> <#attempt> <#assign usersso = restadmin("/users/id/${user.id}/sso_id").value /> <#recover> <#assign usersso = "" /> </#attempt> </#if> <#if usersso?? && usersso != ""> <#attempt> <#assign userNameExists = restadmin("/users/login/${usersso}/login").value/> <#recover> <#assign userNameExists = "N"/> <#assign userName = usersso/> </#attempt> </#if> <#if userNameExists??> <#if userNameExists != "N"> <#list 1..50 as u> <#attempt> <#assign userNameExists = restadmin("/users/login/${usersso}_${u}/login").value/> <#recover> <#assign userNameExists = "N"/> <#assign userName = "${usersso}_${u}"/> </#attempt> <#if userNameExists == "N"> <#break> </#if> </#list> </#if> <#if userName??> <script> $(window).load( function() { $("#lia-login").val('${userName}'); }); </script> </#if> </#if>120Views3likes1CommentGet endpoint url in freemarker
Hi Guys, We have multiple environments running, allwith a different URL.. On all the environments, we use a custom endpoint.. They are the same (code is just copied to other environment), but the URL is different in environments, but we cannot get the 'absolute' url to the endpoint in an easy way.. So we have to do ugly if/else statements to change the url.. Example: If we call the endpoint: in env A:/etgtr99956/plugins/custom/kpn/kpnbus/post-message in env B: /kpn/plugins/custom/kpn/kpn/post-message The first diff (etgtr99956,kpn) is easy to fix, becausethats just the ${community.id}, but the second (kpnbus, kpn) is no logic difference, so it cannot be filled up easily with an existing variable.. Thus we have to do ugly if/else statements, like this -> <#if community.id == 'etgtr99956'> <#assign url = '/etgtr99956/plugins/custom/kpn/kpnbus/post-message' /> <#elseifcommunity.id == 'kpn' && env == stage> <#assign url = '/kpn/plugins/custom/kpn/kpn/post-message'/> <#else> <#assign url = '/kpn/plugins/custom/kpn/kpnbus/post-message'/> </#if> So point is: Is there an easy way to get theabsolute url to the endpoint from within freemarker? Thanks!SolvedKPNOnline9 years agoMentor320Views0likes4CommentsHow to query messages with no views?
Hey, I want to create a nightly process that will pick up all unviewed messages and perform some task in an external system. What would be the best way to query messages with 0 views? I was looking into the Message Resource from API V2Message Resource. I found the metrics.views on the message resource, but it seems that I can only use that field in order by: SELECT * FROM messages ORDER BY metrics.views DESC This doesn't seem to work: SELECT * FROM messages where metrics.views = 0 What would be the best way to do this query?Solved108Views0likes1CommentNot able to find RSS Feed option in drop-down menu for private boards.
Hi All, I am not able to find the "subcribe to RSS Feed" option in the drop down menu for the private boards. In other case for non - private boards, it is showing me the option in the drop-down menu. Can you please guide me with the approach to resolve this issue. Thanks & Regards, Vishwajit Shinde.88Views0likes1CommentREST API: Get kudos for a certain topic by date range?
Hello! I've browsed the forum / REST API documentation for a couple of hours but didn't find the answer to my problem: I would like to access the kudos count of a certain thread but limit that to a date range. The API call for kudos count for a message doesn't seem to accept queries. I've found a way to do it for messages count for a certain board: http://community.spotify.com/restapi/vc/boards/id/spotifycontribute/search/messages/count?q=date:[1341341612%20TO%201341946412] Now I would like to have something like this (does not work): http://community.spotify.com/restapi/vc/threads/id/123456/search/kudos/count?q=date:[1341341612%20TO%201341946412] Background: I'm a super user at the Spotify community that manages the incoming ideas and pings the staff when an idea needs an update. I've made a google spreadsheet and included the kudos count for each idea via ImportXML() that sorts them by defined priority (kudos, status, date). Works great but now I would like to have a column that displays the received kudos of a single idea for the last month / half year. I could make a kudos "database" in another spreadsheet but that seems like a very tiresome workaround. Any quick solution to that? Obviously I'm relying only on the REST API. ;)Premify9 years agoHelper211Views0likes4CommentsRetrieve attachment via REST API
Hi We are trying to retrieve message attatchments using the REST API. This solution isn't acceptable because we can't make all attachments public. Is there a way, using the API authentication, to retrieve actual attachment data?Yossis9 years agoGuide190Views0likes3CommentsBadge for consecutive, daily logins
I thought it was about time to upgrade from the "ugly" javascript and use only Freemarker. The old code is here. Here's the new code; please feed back :) <#if !user.anonymous> <#assign date_check = http.session.attributes.name.get("badge_daily_check_date", "")/> <#-- Read browser session variable to see if we already checked today --> <#assign date_format = restadmin("/users/id/${user.id}/settings/name/layout.format_pattern_date").value/> <#-- Check user's date format settings --> <#assign date_now = datesupport.getDateAsString()/> <#-- Get today's date --> <#assign date_now = date_now?datetime("${date_format}")?string["yyyy-MM-dd"]/> <#-- convert today's date to our preferred date format --> <#if date_check != date_now> <#-- Only run the script if we did not already check today --> ${http.session.setAttribute("badge_daily_check_date", "${date_now}")} <#-- Set the browser session variable to today's date, so we don't keep running this script on the same day --> <#assign userData = restadmin("/users/id/${user.id}/profiles/name/days_consecutive").value /> <#assign userData_date = date_now/> <#-- Set the date variable to today, so we can compare again the next time the user visits us. This will be used if it's the user's first login --> <#assign userData_cur = "0"/> <#-- The current tally of consecutive logins. This will be used if it's the user's first login --> <#assign userData_max = "0"/> <#-- The max tally of consecutive logins ever. This will be used if it's the user's first login --> <#if userData == ""> <#-- If we don't have any consecutive login data for the user start fresh --> <#assign userData_all = date_now + ',' + userData_cur + ',' + userData_max/> <#-- construct the data for the api call for a new user --> <#assign result = restadmin("/users/id/${user.id}/profiles/name/days_consecutive/set?value=${userData_all}") /> <#-- write the new user's consecutive data --> <#else> <#-- If we do already have consecutive login data for the user then continue --> <#assign userData_date = userData?substring(0,10)/> <#-- Grab the last date the user logged in from the stored variable in the db --> <#if userData_date != date_now> <#-- check again if we didn't already check the user today --> <#assign userData_max = userData?substring( userData?index_of(",",12)+1,userData?length)/> <#-- get the user's max daily logins tally --> <#assign diffCheck = ((date_now?datetime("yyyy-MM-dd")?long - userData_date?datetime("yyyy-MM-dd")?long)/(1000 * 60 * 60 * 24))?int/> <#-- compare the last date the user logged in to the date today --> <#if (diffCheck == 1)> <#-- if the user logged in yesterday, and today --> <#assign userData_cur = userData?substring( 11 , userData?last_index_of(","))?number + 1/> <#-- set the current tally of the user's consecutive days --> <#if (userData_cur?number > userData_max?number)> <#-- if the user's current tally exceeds the user's max --> <#assign userData_max = userData_max?number + 1/> <#-- then increment the user's current tally AND the user's max tally --> </#if> </#if> <#assign userData_all = date_now + ',' + userData_cur + ',' + userData_max/> <#-- construct the data for the api call for a new user --> <#assign result = restadmin("/users/id/${user.id}/profiles/name/days_consecutive/set?value=${userData_all}") /> <#-- write the new user's consecutive data --> <#-- the rest is simply checking if the user has x days consecutive, assigning the needed role if they do --> <#assign hasConsecutiveDays_1000 = false/> <#assign hasConsecutiveDays_500 = false/> <#assign hasConsecutiveDays_200 = false/> <#assign hasConsecutiveDays_100 = false/> <#assign hasConsecutiveDays_50 = false/> <#assign hasConsecutiveDays_25 = false/> <#assign hasConsecutiveDays_15 = false/> <#assign hasConsecutiveDays_10 = false/> <#assign hasConsecutiveDays_9 = false/> <#assign hasConsecutiveDays_8 = false/> <#assign hasConsecutiveDays_7 = false/> <#assign hasConsecutiveDays_6 = false/> <#assign hasConsecutiveDays_5 = false/> <#assign hasConsecutiveDays_4 = false/> <#assign hasConsecutiveDays_3 = false/> <#assign hasConsecutiveDays_2 = false/> <#assign hasConsecutiveDays_1 = false/> <#assign selfRoles = restadmin("/users/self/roles").roles.role /> <#list selfRoles as selfRole> <#if selfRole.name == "consecutiveDays_1000"><#assign hasConsecutiveDays_1000 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_500"><#assign hasConsecutiveDays_500 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_200"><#assign hasConsecutiveDays_200 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_100"><#assign hasConsecutiveDays_100 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_50"><#assign hasConsecutiveDays_50 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_25"><#assign hasConsecutiveDays_25 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_15"><#assign hasConsecutiveDays_15 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_10"><#assign hasConsecutiveDays_10 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_9"><#assign hasConsecutiveDays_9 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_8"><#assign hasConsecutiveDays_8 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_7"><#assign hasConsecutiveDays_7 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_6"><#assign hasConsecutiveDays_6 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_5"><#assign hasConsecutiveDays_5 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_4"><#assign hasConsecutiveDays_4 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_3"><#assign hasConsecutiveDays_3 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_2"><#assign hasConsecutiveDays_2 = true/><#break></#if> <#if selfRole.name == "consecutiveDays_1"><#assign hasConsecutiveDays_1 = true/><#break></#if> </#list> <#assign consecutiveDays = userData_max?number/> <#if hasConsecutiveDays_1000 == false> <#if (consecutiveDays >= 1000)> <#if hasConsecutiveDays_1000 == false><#assign result = restadmin("/roles/name/consecutiveDays_1000/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_500/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 500)> <#if hasConsecutiveDays_500 == false><#assign result = restadmin("/roles/name/consecutiveDays_500/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_200/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 200)> <#if hasConsecutiveDays_200 == false><#assign result = restadmin("/roles/name/consecutiveDays_200/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_100/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 100)> <#if hasConsecutiveDays_100 == false><#assign result = restadmin("/roles/name/consecutiveDays_100/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_50/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 50)> <#if hasConsecutiveDays_50 == false><#assign result = restadmin("/roles/name/consecutiveDays_50/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_25/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 25)> <#if hasConsecutiveDays_25 == false><#assign result = restadmin("/roles/name/consecutiveDays_25/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_15/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 15)> <#if hasConsecutiveDays_15 == false><#assign result = restadmin("/roles/name/consecutiveDays_15/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_10/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 10)> <#if hasConsecutiveDays_10 == false><#assign result = restadmin("/roles/name/consecutiveDays_10/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_9/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 9)> <#if hasConsecutiveDays_9 == false><#assign result = restadmin("/roles/name/consecutiveDays_9/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_8/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 8)> <#if hasConsecutiveDays_8 == false><#assign result = restadmin("/roles/name/consecutiveDays_8/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_7/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 7)> <#if hasConsecutiveDays_7 == false><#assign result = restadmin("/roles/name/consecutiveDays_7/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_6/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 6)> <#if hasConsecutiveDays_6 == false><#assign result = restadmin("/roles/name/consecutiveDays_6/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_5/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 5)> <#if hasConsecutiveDays_5 == false><#assign result = restadmin("/roles/name/consecutiveDays_5/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_4/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 4)> <#if hasConsecutiveDays_4 == false><#assign result = restadmin("/roles/name/consecutiveDays_4/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_3/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 3)> <#if hasConsecutiveDays_3 == false><#assign result = restadmin("/roles/name/consecutiveDays_3/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_2/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 2)> <#if hasConsecutiveDays_2 == false><#assign result = restadmin("/roles/name/consecutiveDays_2/users/add?role.user=id/${user.id}")/><#assign result = restadmin("/roles/name/consecutiveDays_1/users/remove?role.user=id/${user.id}")/></#if> <#elseif (consecutiveDays >= 1)> <#if hasConsecutiveDays_1 == false><#assign result = restadmin("/roles/name/consecutiveDays_1/users/add?role.user=id/${user.id}")/></#if> </#if> </#if> </#if> </#if> </#if> </#if>148Views3likes2CommentsDisplay users by user id using API
Hello, I have 15 product expert users that I would like to display on the community home page. Is there a way that I can display these users by user id using API?Any API code sampleavailablethat I can insertinto a custom component? Thank you in advance.Solvedskylinegtr9 years agoMentor220Views0likes4Comments